Darwinbots Forum
Bots and Simulations => Bestiary => F1 bots => Topic started by: rayz on January 05, 2009, 05:33:39 PM
-
The predecessor of the no fixpos version...found that fixpos could be quite helpful.
def enemysighted 50
def foodxpos 51
def foodypos 52
cond
start
-8 .shootval store
stop
cond
*.body 50 <
*.nrg 200 >
start
100 .strbody store
stop
cond
*.body 50 >
start
10 .fdbody store
stop
'eye5 goes all around, eye1 now points forward
'eye1 at 0
'eye2 at 157 right
'eye3 at 314
'eye4 at 471
'eye6 at 628
'eye7 at 785
'eye8 at 942
'eye9 at 1099
'cond
'start
'1221 .eye5width store
'157 .eye1width store
'157 .eye2width store
'157 .eye3width store
'157 .eye4width store
'157 .eye6width store
'157 .eye7width store
'157 .eye8width store '35
'157 .eye9width store
'-140 .eye1dir store '0
'-262 .eye2dir store '1
'-384 .eye3dir store '2
'-506 .eye4dir store '3
'-593 .eye6dir store '4
'-715 .eye7dir store '5
'-837 .eye8dir store '6
'-959 .eye9dir store '7
'stop
cond
start
*.tiepres .deltie store
stop
cond
start
359 .aimsx store
*.maxvel .up store
stop
'I've arrived at the spot, but no food...better stop looking.
cond
*.foodxpos 100 + *.xpos >= *.foodxpos 100 - *.xpos > |
*.foodypos 100 + *.ypos >= *.foodypos 100 - *.ypos > |
*.enemysighted 0 =
start
0 .out1 store
0 .out2 store
0 .out3 store
0 .foodxpos store
0 .foodypos store
0 .shoot store
stop
'Oh no, lost sight of it!
cond
*.refshoot *.myshoot = *.eye5 0 = |
*.enemysighted 1 =
start
0 .out1 store
0 .out2 store
0 .out3 store
0 .enemysighted store
0 .shoot store
0 .foodxpos store
0 .foodypos store
stop
'cond
'*.eye5 0 >
'start
'0 .aimsx store
'*.maxvel .up store
'stop
'Someone's telling me where the food is!
cond
*.refshoot *.myshoot =
*.enemysighted 0 =
*.in1 0 !=
*.in2 0 !=
start
*.in2 .out2 store
*.in3 .out3 store
*.in2 .foodxpos store
*.in3 .foodypos store
0 .aimsx store
0 .shoot store
stop
cond
*.refshoot *.myshoot =
start
0 .out1 store
0 .fixpos store
stop
cond
*.foodxpos 0 !=
*.foodypos 0 !=
*.enemysighted 0 =
start
*.foodxpos *.foodypos angle .setaim store
0 .aimsx store
*.maxvel .up store
0 .shoot store
stop
'Let the chase begin!
cond
*.eye5 0 !=
*.refshoot *.myshoot !=
start
1 .out1 store
*.refxpos .out2 store
*.refypos .out3 store
1 .enemysighted store
*.refxpos *.refypos angle .setaim store
0 .aimsx store
*.maxvel .up store
0 .fixpos store
0 .foodxpos store
0 .foodypos store
stop
cond
*.eye5 75 >
*.refshoot *.myshoot !=
start
1 .fixpos store
stop
cond
*.eye5 0 !=
*.refshoot *.myshoot !=
start
-6 .shoot store
stop
cond
*.eye5 25 <
*.refshoot *.myshoot !=
start
0 .fixpos store
0 .aimsx store
'*.refxpos *.refypos angle .setaim store
*maxvel .up store
stop
cond
*.eye5 25 >
*.refshoot *.myshoot =
1 0 =
start
*.maxvel .down store
0 .fixpos store
0 .up store
0 .shoot store
stopd
'Reproduce
cond
*.nrg 1000 >
*.fixpos 0 !=
start
50 .repro store
0 .fixpos store
0 .aimsx store
0 .up store
*.maxvel .dn store
stop
cond
*.nrg 1000 >
*.fixpos 0 =
start
0 .aimsx store
50 .repro store
stop
end
*.refxpos *.refypos angle .setaim store
-
*.foodxpos 100 + *.xpos >= *.foodxpos 100 - *.xpos > |
*.foodypos 100 + *.ypos >= *.foodypos 100 - *.ypos > |
I dont think this code will work
replace the "+" with "add"
and the "-" with "sub"
and the "|" with "or"
so the code should look like this
*.foodxpos 100 add *.xpos >= *.foodxpos 100 sub *.xpos > or
*.foodypos 100 add *.ypos >= *.foodypos 100 sub *.ypos > or
and / note that the "and" is not nessiccary as this will automaticaly be used when no other evaluation function is used
/ usefull to use when using complicated conditions logic.
this should work.
-
*.foodxpos 100 + *.xpos >= *.foodxpos 100 - *.xpos > |
*.foodypos 100 + *.ypos >= *.foodypos 100 - *.ypos > |
I dont think this code will work
replace the "+" with "add"
and the "-" with "sub"
and the "|" with "or"
so the code should look like this
*.foodxpos 100 add *.xpos >= *.foodxpos 100 sub *.xpos > or
*.foodypos 100 add *.ypos >= *.foodypos 100 sub *.ypos > or
and / note that the "and" is not nessiccary as this will automaticaly be used when no other evaluation function is used
/ usefull to use when using complicated conditions logic.
this should work.
Ooooooh... Thankee very much!
-
A - negates the value on top of the integer stack, + isn't a valid operator, or atleast it's not listed.
And | will operate on the integer stack values, while 'or' operates on the boolean stack. (Since it's 2 conditions they'll be in the boolean stack)
And the 'and' isn't nesesary when in the condition part of a gene because all conditions in that area get and'ed, but when using inline conditions you would need it.
-
And the 'and' isn't nesesary when in the condition part of a gene because all conditions in that area get and'ed, but when using inline conditions you would need it.
that is what I said.
but thanks for clearing it up a bit more
Ooooooh... Thankee very much!
no prob.
nice bot by the way.
add a strbody command so they dont become so small.
otherwise a fun bot to watch
-
I like it. Qualifier for F1.