Author Topic: Black Ant-a (IB)(Eight)-05.10.04  (Read 4497 times)

Offline Eight

  • Bot Neophyte
  • *
  • Posts: 1
    • View Profile
Black Ant-a (IB)(Eight)-05.10.04
« on: October 19, 2005, 09:22:53 PM »
the final incarnation of the black ant from last year.


' Black Ant by Eight 05.10.04a
'
' 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 =
*.type 0 =
start
.type inc
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 =
*.reffixed 1 =
*.in1 0 !=
*.in2 0 !=
start
5 .dn store
*.in1 .qx store
*.in2 .qy store
stop

'doublecheck queen coordinates
cond
*.type 0 =
*.qx 0 !=
*.qy 0 !=
start
.type inc
stop

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

'reproduce as queen
cond
*.robage 5000 <
*.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 2000 >
*.gear2 25 =
*.egg 0 =
start
mult
10 .repro store
45 .egg store
stop

'queen spin
cond
*.nrg 600 >
*.type 2 =
*.eye5 30 <
start
20 .aimdx store
stop

'queen attack
cond
*.type 2 =
*.eye5 30 >
*.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 =
start
*.nrg 1000 div 1 add .up store
stop

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

'behavior
cond
*.pattern 1 =
*.see 0 =
*.tick 1 =
start
20 .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

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

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

'behavior
cond
*.type 1 =
*.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 =
*.see 3 >
*.refup 0 =
*.refup *.myup !=
*.refaimdx *.myaimdx !=
start
-1 .shoot store
stop

'delete ties
cond
*.tiepres 0 !=
start
*.tiepres .deltie 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 30000 >
start
.pattern inc
stop

'nothing
cond
*.pattern 2 =
*.eye5 50 <
start
.pattern dec
stop

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

'feed any stopped ants
cond
*.type 1 =
*.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

'no return target
cond
*.pattern 3 =
*.qx 0 =
*.qy 0 =
start
.type inc
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

'PYs Head for home gene modified
cond
*.pattern 3 =
*.qx 0 !=
*.qy 0 !=
start
*.qx *.qy angle .setaim store
*.maxvel .up store
*.fx .out1 store
*.fy .out2 store
stop

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

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

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

'queen alone
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
.type dec
stop

'starving queen turn worker
cond
*.type 2 =
*.nrg 300 <
start
.type dec
stop

'nomad queen settles
cond
*.type 1 =
*.qx 0 =
*.qy 0 =
*.nrg 20000 >
*.body 2000 >
start
.type inc
stop

'slim down nomad queens
cond
*.nrg 32000 <
*.body 1000 >
*.qx 0 =
*.qy 0 =
start
100 .fdbody store
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
5 .aimsx store
stop

cond
*.pattern 1 =
*.eye1 *.eye9 >
start
30 .aimsx store
stop

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

cond
*.pattern 1 =
*.eye9 *.eye1 >
start
30 .aimdx 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