Author Topic: Black ant (IB)(Eight)-03.10.04  (Read 4179 times)

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Black ant (IB)(Eight)-03.10.04
« on: January 13, 2007, 11:17:17 AM »
'Topic: Ant bot
' Black Ant by Eight 03.10.04
'
' repro basics/angle-calc lifted from PY's ant bot
' these broadcast knowledge of food locations
' so friendlies will find the exact spot

def qx 50
def qy 51
def cycle 52
def type 53
' 0 = none
' 1 = worker
' 2 = queen
' 3 = nomadic queen
def gear 54
def tick 55
def pattern 56
' 0 = initialize to 1
' 1 = search
' 2 = eat food
' 3 = return home
' 4 = avoid friends
' 5 = seek target food
def alone 57
def egg 58
def see 59
def fx 60
def fy 61
def gear2 62

' waste
cond
*.waste 100 >
*.eye5 0 =
start
100 .shootval store
-4 .shoot store
stop

'clockwork
cond
*.type 2 =
*.gear2 0 =
start
50 .gear2 store
stop

cond
*.type 2 =
*.gear2 0 >
start
.gear2 dec
stop

'gear left
cond
*.type 1 =
*.tick 0 =
*.gear 50 =
start
.tick inc
.cycle dec
stop

'right
cond
*.type 1 =
*.tick 1 =
*.gear 0 >
start
.gear dec
stop

'left
cond
*.type 1 =
*.tick 0 =
*.gear 50 <
start
.gear inc
stop

'gear right
cond
*.type 1 =
*.gear 0 =
start
.tick dec
stop

'initialize
cond
*.robage 0 =
start
0 .type store
0 .pattern store
stop

'initialize
cond
*.robage 2 =
*.numties 0 =
start
2 .type store
1 .fixpos store
stop

'queen where am I
cond
*.type 2 =
*.qx 0 =
*.qy 0 =
start
*.xpos .qx store
*.ypos .qy store
stop

'send coordinates
cond
*.type 2 =
*.eye5 70 >
*.refup *.myup =
*.refaimdx *.myaimdx =
*.refage 300 <
start
*.qx .out1 store
*.qy .out2 store
stop

'receive coordinates
cond
*.type 0 =
*.eye5 70 >
*.refup *.myup =
*.refaimdx *.myaimdx =
*.in1 0 >
*.in2 0 >
start
*.in1 .qx store
*.in2 .qy store
.type inc
stop

'sever birth tie
cond
*.type 2 =
*.egg 43 =
start
.deltie inc
stop

'adjust counters
cond
*.egg 0 >
start
.egg dec
stop

'reproduce as queen
cond
*.robage 300 <
*.eye5 30 <
*.type 2 =
*.nrg 2500 >
*.gear2 25 =
*.egg 0 =
start
mult
50 .repro store
45 .egg store
stop

'reproduce as queen
cond
*.eye5 30 <
*.type 2 =
*.nrg 5000 >
*.body 5000 >
*.gear2 25 =
*.egg 0 =
start
mult
10 .repro store
45 .egg store
stop

'spin queen
cond
*.type 2 =
*.see 0 =
start
20 .aimdx store
stop

'queen attack
cond
*.type 2 =
*.eye5 50 >
*.refup *.myup !=
*.refaimdx *.myaimdx !=
start
-6 .shoot store
stop

'remove behavior from new queens
cond
*.type 2 =
*.pattern 0 !=
start
0 .pattern store
stop

'initialize worker behavior
cond
*.type 1 =
*.pattern 0 =
start
.pattern inc
stop

'behavior
cond
*.pattern 1 =
*.vel 3 <
start
*.nrg 1000 div .up store
stop

'behavior
cond
*.pattern 1 =
*.see 0 =
*.tick 0 =
start
10 .aimsx store
stop

'behavior
cond
*.pattern 1 =
*.see 0 =
*.tick 1 =
start
10 .aimdx store
stop

'behavior
cond
*.pattern 1 =
*.eye5 0 >
*.refup *.myup =
*.refaimdx *.myaimdx =
*.reffixed 0 =
*.in1 0 !=
*.in2 0 !=
start
*.in1 .fx store
*.in2 .fy store
5 .pattern store
stop

'behavior
cond
*.pattern 5 =
start
5 .up store
stop

'PYs Head for home gene modified
cond
*.pattern 5 =
*.fx 0 !=
*.fy 0 !=
start
*.fx *.fy angle .setaim store
stop

'at target
cond
*.pattern 5 =
*.xpos *.fx %=
*.ypos *.fy %=
start
0 .fx store
0 .fy store
1 .pattern store
stop

'behavior
cond
*.pattern 3 !=
*.pattern 4 !=
*.eye5 30 >
*.refup *.myup =
*.refaimdx *.myaimdx =
start
4 .pattern store
stop

'behavior
cond
*.pattern 4 =
*.fx 0 !=
*.fy 0 !=
start
314 rnd .aimdx store
5 .pattern store
stop

'behavior
cond
*.pattern 4 =
*.fx 0 =
*.fy 0 =
start
314 rnd .aimdx store
1 .pattern store
stop

'see foods
cond
*.eye5 40 >
*.refup *.myup !=
*.refaimdx *.myaimdx !=
start
*.xpos .fx store
*.ypos .fy store
1 .fixpos store
2 .pattern store
stop

'eat vegs
cond
*.pattern 2 =
*.eye5 40 >
*.refup 0 =
*.refup *.myup !=
*.refaimdx *.myaimdx !=
start
-1 .shoot store
stop

'eat enemies
cond
*.pattern 2 =
*.see 3 >
*.refup 0 >
*.refup *.myup !=
*.refaimdx *.myaimdx !=
start
-6 .shoot store
stop

'full
cond
*.pattern 2 =
*.nrg 20000 >
start
.pattern inc
stop

'nothing
cond
*.pattern 2 =
*.see 0 =
start
.pattern dec
stop

'advance
cond
*.pattern 2 =
*.vel 0 =
*.see 0 !=
*.fixed 0 =
start
5 .up store
stop

'unfix
cond
*.type 2 !=
*.eye5 40 <
*.fixed 1 =
start
0 .fixpos store
stop

'PYs Head for home gene modified
cond
*.pattern 3 =
*.qx 0 !=
*.qy 0 !=
start
*.qx *.qy angle .setaim store
stop

'behavior
cond
*.pattern 3 =
start
5 .up store
*.fx .out1 store
*.fy .out2 store
stop

'see the queen
cond
*.pattern 3 =
*.eye5 50 >
*.refup *.myup =
*.refaimdx *.myaimdx =
*.nrg 3000 >
*.reffixed 1 =
start
1 .fixpos store
500 .shootval store
-2 .shoot store
stop

'queen's not here
cond
*.pattern 3 =
*.xpos *.qx =
*.ypos *.qy =
start
1 .fixpos store
2 .type store
stop

'done
cond
*.pattern 3 =
*.nrg 3000 <
*.fx 0 >
*.fy 0 >
start
5 .pattern store
stop

'done
cond
*.pattern 3 =
*.nrg 3000 <
*.fx 0 =
*.fy 0 =
start
1 .pattern store
stop


'queen grow
cond
*.type 2 =
*.robage 300 >
*.body 31000 <
*.nrg 5000 >
start
100 .strbody store
stop

'slim down the workers until they get older
cond
*.robage 600 <
*.type 1 =
*.body 100 >
start
100 .fdbody store
stop

'hungry queen
cond
*.type 2 =
*.nrg 500 <
*.body 500 >
start
100 .fdbody store
stop

'starving queen turns worker
cond
*.type 2 =
*.nrg 500 <
*.body 500 <
start
0 .qx store
0 .qy store
.type dec
stop

'colony health
cond
*.type 2 =
*.gear2 25 =
start
.alone inc
stop

'queen is happy
cond
*.type 2 =
*.pleas 100 >
start
0 .alone store
stop

'where are my workers? fine I'll go solo
cond
*.type 2 =
*.alone 50 >
start
0 .qx store
0 .qy store
1 .type store
stop

'nomad queen settles
cond
*.type 1 =
*.nrg 30000 >
start
.type inc
stop

'detected
cond
*.type 1 =
*.eye4 *.eye6 !=
start
.see inc
stop

'nothing
cond
*.see 0 >
*.eye4 0 =
*.eye6 0 =
start
0 .see store
stop

'left
cond
*.eye4 *.eye6 >
start
10 .aimsx store
stop

cond
*.type 2 !=
*.see 0 =
*.eye1 *.eye9 >
start
60 .aimsx store
5 .sx store
stop

'right
cond
*.eye6 *.eye4 >
start
10 .aimdx store
stop

cond
*.type 2 !=
*.see 0 =
*.eye9 *.eye1 >
start
60 .aimdx store
5 .dx store
stop

'feel
cond
*55 0 =
*.shdn 0 !=
start
628 .aimdx store
stop

'feel
cond
*55 0 =
*.shsx 0 !=
start
200 .aimsx store
stop

'feel
cond
*55 0 =
*.shdx 0 !=
start
200 .aimdx store
stop

'shell
cond
*.nrg 2000 >
*.shell 20 <
start
20 .mkshell store
stop


end
If you try and take a cat apart to see how it works, the first thing you have in your hands is a non-working cat.
Douglas Adams