Welcome To Darwinbots > Newbie
Overall Concept
Shasta:
This is not guaranteed but I think it should work to always try and get a sexual reproduction every 500 cycles. I crammed it into one gene but if you replace the starts with conds, ''' with starts, and the '''''''''' with stops it would work the same:
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']def sexreprocalled 61 'remember defs go at the top
def reprocalled 62
cond
start
*.nrg 7500 <
*.timer 430 >= and 'gives it some time to try and sexually reproduce, adjust as necessary
*.refeye *.myeye = and 'if I see a bot of the same species try to get it fertilized
'''
-8 .shoot store
'''''''''' 'essentially a new gene
*.fertilized 0 !=
*.sexreprocalled 1 != and
'''
50 .sexrepro store
1 .sexreprocalled store
''''''''''
*.nrg 7500 >
*.timer 500 >=
'''
50 .repro store
1 .reprocalled store
''''''''''
*.sexreprocalled 0 !=
*.reprocalled 0 != or
*.timer 500 >= and
'''
0 .sexreprocalled store
0 .reprocalled store
0 .timer store
stop
edit: If you want it to still reproduce if below 7500 and didnt sexually reproduce you can check against .sexreprocalled and .reprocalled and use .repro, with that you will always reproduce every 500th cycle.
So that should work, might not be the slickest way but oh well.
bacillus:
I haven't messed around with in-gene boolean logic, but I think that if you don't want the conditions from the last block of code to carry on, you have to clear the stack with the command clearbool before writing your next set of conditions.
EricL:
--- Quote from: bacillus ---I haven't messed around with in-gene boolean logic, but I think that if you don't want the conditions from the last block of code to carry on, you have to clear the stack with the command clearbool before writing your next set of conditions.
--- End quote ---
Not necessarily. This only matters if you perform boolean operations with the those values farther back on the stack.
for example:
false
10 .up store
true
true
and
50 .repro store
The bot above will reproduce but not move.
false
10 .up store
true
true
and and
50 .repro store
This one will neither move nor reproduce.
bacillus:
Ah, of course, how stupid of me. I was thinking of the way the cond command works.
Navigation
[0] Message Index
[*] Previous page
Go to full version