Author Topic: Ant-bot 4 (IB)(PY)-15.10.04  (Read 9787 times)

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« on: January 13, 2007, 11:01:33 AM »
'Topic: Ant bot
'PY
'
'' Ant-Bot4
' Written by Purple Youko for version 2.33
' Use on size 2 or higher with plenty of veggies.
' now the Queen can hijack other workers

def type 50
' type 0 = worker
' type 1 = warrior
' type 2 = queen
' type 3 = new queen
def robid 51
' robid 1000 = makes new queen
' robid 900 - 999 makes warrior
' robid < 900 makes new worker
def queenx 52
def queeny 53
def newmom 54
def hfh 55
' Head For Home that is
' hfh 0 = search for food
' hfh 1 = head for home
' hfh 2 = feed the queen
def queenid 56
def feeding 57
def counter 58
def counter2 59
' used for breeding new workers if too long a delay.


' initialize at birth
cond
*.robage 0 =
start
1000 rnd .robid store
.tie inc
stop

cond
*.robage 50 =
*.robid 990 >
start
3 .type store
14000 rnd 100 add .queenx store
10000 rnd 100 add .queeny store
32000 rnd .queenid store
stop

'cond
'*.robage 0 =
'*.robid 990 >
'*.robid 1000 !=
'start
'1 .type store
'stop

' Copy queen's ID into out1
'cond
'*.robage 1 =
'*.eye5 0 !=
'start
'*.in1 .out1 store
'*.in2 .queenid store
'stop

' make new robots into queens at start of sim
' or when breeding ties go wrong
cond
*.robage 2 =
*.numties 0 =
start
3 .type store
'1 .fixpos store
32000 rnd 1 add .queenid store
*.queenid .out2 store
32000 rnd 1 add .out1 store
1000 .robid store
stop

' Queen programs young with her ID
cond
*.type 2 =
*.tiepres 1 =
*.newmom 41 =
start
1 .tienum store
*.out1 .tieval store
.out1 .tieloc store
stop

' Queen programs young with her ID
cond
*.type 2 =
*.tiepres 1 =
*.newmom 42 =
start
1 .tienum store
*.out2 .tieval store
.queenid .tieloc store
stop

' Queen programs young with her position
cond
*.type 2 =
*.tiepres 1 =
*.newmom 44 =
start
1 .tienum store
*.xpos .tieval store
.queenx .tieloc store
stop

cond
*.type 2 =
*.tiepres 1 =
*.newmom 43 =
start
1 .tienum store
*.ypos .tieval store
.queeny .tieloc store
stop

' sever birth tie. Off you go little worker
cond
*.type 2 =
*.newmom 40 =
start
.deltie inc
stop

' Adjust counters
cond
*.newmom 0 >
start
.newmom dec
stop

cond
start
.counter inc
.counter2 inc
stop

cond
*.counter 50 >
start
0 .counter store
stop

cond
*.type 2 !=
*.counter 20 =
*.hfh 2 !=
*.feeding 0 =
start
1 .fixpos store
stop

cond
*.type 2 !=
*.counter 21 =
*.hfh 1 =
start
0 .fixpos store
stop

' rotate as queen
cond
*.type 2 =
start
20 .aimdx store
stop

' initial reproduction for young queen
' need some little worker ants quickly
cond
*.eye5 30 <
*.type 2 =
*.nrg 2000 >
*.robage 100 <
*.newmom 0 =
start
' give away 500 body only.
' clear stack first though
mult mult
32000 *.body div .repro store
46 .newmom store
stop

' Breed new workers if none come back to feed queen
cond
*.eye5 30 <
*.type 2 =
*.nrg 2000 <
*.counter2 1000 >
*.newmom 0 =
start
' give away 500 body only.
' clear stack first though
mult mult
32000 *.body div .repro store
46 .newmom store
0 .counter2 store
stop

' Reset counter2 if queen gets fed
cond
*.pleas 0 >
start
0 .counter2 store
stop

' Reproduce as queen
cond
*.eye5 30 <
*.type 2 =
*.nrg 5000 >
*.body 5000 >
*.newmom 0 =
start
' give away 500 body only.
' clear stack first though
mult
32000 *.body div .repro store
46 .newmom store
stop

' Queen's defences
cond
*.type 2 =
*.poison 500 <
*.nrg 2000 >
start
10 .strpoison store
.shoot .ploc store
stop

' Queen shoots tie
cond
*.type 2 =
*.eye5 40 >
*.eye4 *.eye6 =
*.in1 *.out1 !=
*.newmom 0 =
start
1 .tie store
0 .aimdx store
46 .newmom store
stop

' Queeny gets fat
cond
*.type 2 =
*.body 32000 <
*.nrg 2000 >
start
10 .strbody store
stop

cond
*.type 3 =
*.body 10000 <
*.nrg 5000 >
start
100 .strbody store
stop

' Queen gets low on energy
cond
*.type 2 =
*.nrg 500 <
start
10 .fdbody store
stop

cond
*.type 2 =
*.body 32000 <
*.nrg 4500 >
start
100 .strbody store
stop

' worker trades body for energy
cond
*.type 0 =
*.body 100 >
start
100 .fdbody store
stop

' worker selects direction to head after birth
cond
*.robage 10 =
start
1256 rnd .setaim store
stop

' All ants reset in1 and out1 if nothing is visible
cond
*.eye5 0 =
*.in1 0 !=
start
0 .in1 store
0 .in2 store
stop

' worker has collected enough food
cond
*.type 0 =
*.nrg 20000 >
*.hfh 0 =
start
1 .hfh store
0 .fixpos store
0 .feeding store
stop

' Head for home
cond
*.type 2 !=
*.hfh 1 =
start
*.queenx *.queeny angle .setaim store
stop

' set worker velocity
cond
*.type 0 =
*.robage 5 >
*.numties 0 =
*.vel 10 <
*.fixed 0 =
*.eye5 51 <
start
10 *.vel sub .up store
stop

' what if sated worker is blocked
' choose a new random direction and accelerate in it
cond
*.type 0 =
*.hfh 1 =
*.eye5 41 >
*.in2 *.queenid !=
start
2 .sx store
stop


' worker searches for food
cond
*.type 0 =
*.hfh 0 =
*.in1 *.out1 !=
*.eye3 *.eye7 !=
*.eye5 50 <
start
*.eye3 *.eye7 sub .aimsx store
'1 .fixpos store
stop

' worker searches for food
cond
*.type 0 =
*.hfh 0 =
*.in1 *.out1 !=
*.eye4 *.eye6 !=
*.eye5 40 <
start
*.eye4 *.eye6 sub .aimsx store
'1 .fixpos store
stop

' worker avoids conspecs
cond
*.robage 10 >
*.type 0 =
*.hfh 0 =
*.in1 *.out1 =
*.eye5 40 >
start
200 .aimsx store
stop

' worker avoids queen while searching for food
cond
*.robage 100 >
*.type 0 =
*.hfh 0 =
*.in1 *.out1 =
*.in2 *.queenid =
start
628 .aimsx store
stop


' worker or new queen finds food
cond
*.type 2 !=
*.hfh 0 =
*.eye5 40 >
*.in1 *.out1 !=
*.feeding 0 =
start
1 .fixpos store
.feeding inc
stop

' worker or new queen shoots food
cond
*.type 2 !=
*.hfh 0 =
*.eye5 40 >
*.in1 *.out1 !=
start
-1 .shoot store
stop

' worker or new queen stops feeding
cond
*.type 2 !=
*.feeding 0 >
*.eye5 41 <
*.fixed 0 !=
start
.feeding dec
0 .fixpos store
stop

' worker runs out of energy while returning to queen
cond
*.type 0 =
*.hfh 1 =
*.nrg 3000 <
start
0 .hfh store
1256 rnd .setaim store
stop

' worker reaches queen
cond
*.type 0 =
*.hfh 1 =
*.in2 *.queenid =
*.eye5 50 >
start
2 .hfh store
1 .fixpos store
stop

' worker feeds queen
cond
*.type 0 =
*.hfh 2 =
*.nrg 3500 >
*.in2 *.queenid store
start
mult mult
500 .shootval store
-2 .shoot store
stop

' worker stops feeding queen
cond
*.type 0 =
*.hfh 2 =
*.nrg 3501 <
start
0 .hfh store
0.fixpos store
stop

' worker (or warrior) unfixes his position after birth or feeding the

queen
cond
*.type 2 !=
*.hfh 0 =
*.fixed 0 !=
*.feeding 0 =
start
0 .fixpos store
stop

' worker reaches queen's position to find her gone
cond
*.type 0 =
*.hfh 1 =
*.xpos *.queenx =
*.ypos *.queeny =
*.in2 *.queenid !=
start
' becomes new queen
1 .fixpos store
*.queenid .out2 store
2 .type store
stop

' new queen sets out to get some energy
cond
*.type 3 =
*.eye5 40 <
*.vel 20 <
*.robage 1000 <
start
20 *.vel sub .up store
stop

cond
*.type 3 =
*.hfh 1 =
start
5 .up store
stop

cond
*.type 3 =
*.eye8 *.eye2 !=
*.eye8 *.eye5 !=
*.hfh 0 =
start
*.eye2 *.eye8 sub .aimsx store
stop

cond
*.type 3 =
*.eye6 *.eye4 !=
*.eye6 *.eye5 !=
start
*.eye4 *.eye6 sub .aimsx store
stop

' new queen avoids conspecs
cond
*.type 3 =
*.eye5 40 >
*.in1 *.out1 =
start
320 .aimsx store
stop

' New queen has enough energy now
cond
*.type 3 =
*.nrg 30000 >
*.body 5000 >
start
1 .hfh store
stop

' New queen find home home
cond
*.type 3 =
*.hfh 1 =
*.xpos *.queenx %=
*.ypos *.queeny %=
start
1 .fixpos store
*.xpos .queenx store
*.ypos .queeny store
2 .type store
32000 rnd 1 add .out1 store
*.queenid .out2 store
stop

' get rid of waste. all types
cond
*.waste 100 >
start
100 .shootval store
-4 .shoot 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

Offline scood

  • Bot Neophyte
  • *
  • Posts: 44
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #1 on: April 09, 2007, 12:35:03 AM »
I dont have version 2.33

nor can I download it

can you please update it for 2.4

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #2 on: April 09, 2007, 09:44:16 AM »
Try it in 2.37
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline scood

  • Bot Neophyte
  • *
  • Posts: 44
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #3 on: April 09, 2007, 07:37:09 PM »
I did and it just sat there

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #4 on: April 09, 2007, 08:08:54 PM »
Unfortunately things change in DB just as they do in RL, what worked in the past may not work anymore. I don't have a copy of 2.33 anymore and PY isn't about to update this version. There might still be a working antbot somewhere in the bestiary though if you are lucky.
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

Offline abyaly

  • Bot Destroyer
  • ***
  • Posts: 363
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #5 on: April 10, 2007, 07:12:16 PM »
I remember I got an antbot to work in 2.37
you need a big enough field size, though.
Lancre operated on the feudal system, which was to say, everyone feuded all
the time and handed on the fight to their descendants.
        -- (Terry Pratchett, Carpe Jugulum)

Offline scood

  • Bot Neophyte
  • *
  • Posts: 44
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #6 on: April 12, 2007, 11:26:45 PM »
I tried that and it didnt work

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #7 on: April 13, 2007, 05:06:55 AM »
Did you do it on a size 2 or higher like it asks?  If I remember the ant bots were rather fragile even at their inception.

Offline scood

  • Bot Neophyte
  • *
  • Posts: 44
    • View Profile
Ant-bot 4 (IB)(PY)-15.10.04
« Reply #8 on: April 13, 2007, 11:18:45 PM »
yep and I had mutations off