Author Topic: Ant ver 0.2 (IB)(ChromiumDragon)-01.10.04  (Read 3260 times)

Offline Jez

  • Bot Overlord
  • ****
  • Posts: 788
    • View Profile
Ant ver 0.2 (IB)(ChromiumDragon)-01.10.04
« on: January 13, 2007, 11:07:13 AM »
'Topic: Ant bot
'ChromiumDragon

'Needs the 2.33 version (with angle command)

'Ant Ver. 0.2

'Defines
def bottype 59
'Stores if bot is motile or immotile (1=immotile, 2=motile, 3=in flux)

def job 51
'Stores the current job
' Immotile (1,2,3=program child)
' Motile (1=store mother location, 2=hunt for food, 3=feed, 4=return to queen, 5=feed queen)

def botdata 60

'Initilizations
'--------------
'Queen Initilize
cond
*59 3 =
*.in1 0 =
*.in2 0 =
'Not looking at a queen
start
1 .bottype store
*.ypos .out1 store
*.xpos .out2 store
1 .fixpos store
stop

'Worker Initilize
cond
*.bottype 3 =
*.in1 0 !=
*.in2 0 !=
'Looking at a queen
start
2 .bottype store
*.in1 .out1 store
*.in2 .out2 store
1 .tie store
0 .fixpos store
stop

'Initilize
cond
*.robage 1 =
start
3 .bottype store
stop

'Basic Queen Controls
'--------------------
'Rotate to till clear vision
cond
*.bottype 1 =
*.eye5 30 >
*.job 0 =
start
250 .aimdx store
stop

'Program child
'-------------
'Sever programmed child
cond
*.bottype 1 =
*.job 2 =
*.tiepres 1 =
start
1 .tienum store
1 .deltie store
0 .job store
stop

'Program child 1
cond
*.bottype 1 =
*.job 1 =
start
1 .tienum store
.job .tieloc store
2 .tieval store
2 .job store
stop

'Breed Worker
'-------------------
'Breed
cond
*.bottype 1 =
*.botdata 10 <
*.nrg 10000 >
*.numties 0 =
*.eye5 40 <
*.job 1 !=
start
20 .repro store
*.botdata inc
1 .job store
stop


'Worker food gathering
'---------------------
'Turn away from friendly
cond
*.bottype 2 =
*.in1 *.out1 =
*.in2 *.out2 =
*.eye5 40 >
*.job 2 =
start
628 .aimdx store
0 .in1 store
0 .in2 store
stop

'Move if slow
cond
*.bottype 2 =
*.vel 20 <
*.job 2 =
start
20 *.vel sub .up store
stop

'Search for food wide
cond
*.bottype 2 =
*.job 2 =
*.in1 *.out1 !=
*.in2 *.out2 !=
*.eye3 *.eye7 !=
*.eye5 40 <
start
*.eye3 *.eye7 sub .aimsx store
*.eye3 *.eye7 sub 4 div .sx store
stop

'Search for food narrow
cond
*.bottype 2 =
*.job 2 =
*.in1 *.out1 !=
*.in2 *.out2 !=
*.eye4 *.eye6 !=
*.eye5 40 <
start
*.eye4 *.eye6 sub 2 div .aimsx store
*.eye4 *.eye6 sub 8 div .sx store
stop

'Found food
cond
*.bottype 2 =
*.job 2 =
*.in1 *.out1 !=
*.in2 *.out2 !=
*.eye5 40 >
start
1 .fixpos store
3 .job store
stop

'Out of food
cond
*.bottype 2 =
*.job 3 =
*.eye5 40 <
*.nrg 20000 <
start
0 .fixpos store
2 .job store
stop

'Feed
'----
'Shoot
cond
*.bottype 2 =
*.job 3 =
*.nrg 20000 <
start
-1 .shoot store
stop

'Full, start home
cond
*.bottype 2 =
*.job 3 =
*.nrg 20000 >
start
4 .job store
0 .fixpos store
stop

'Return to queen
'---------------
'Point at queen
cond
*.bottype 2 =
*.job 4 =
*.nrg 8000 >
start
*.out2 *.out1 angle .setaim store
stop

'Move towards queen
cond
*.bottype 2 =
*.job 4 =
*.nrg 8000 >
*.vel 20 <
start
20 *.vel sub .up store
stop

'Out of gas, start feeding again
cond
*.bottype 2 =
*.job 4 =
*.nrg 8000 <
start
2 .job store
stop

'Close to queen
cond
*.out1 *.ypos sub 10 div 0 %=
*.out2 *.xpos sub 10 div 0 %=
*.bottype 2 =
*.job 4 =
*.nrg 8000 >
*.in1 *.out1 =
*.in2 *.out2 =
start
1 .fixpos store
5 .job store
stop

'Queen gone
cond
*.out1 *.ypos sub 10 div 0 %=
*.out2 *.xpos sub 10 div 0 %=
*.bottype 2 =
*.job 4 =
*.nrg 8000 >
*.eye5 30 <
start
0 .job store
1 .bottype store
1 .fixpos store
stop

'Feed queen
'----------
'Feed
cond
*.bottype 2 =
*.job 5 =
*.nrg 8000 >
start
1000 .shootval store
-2 .shoot store
stop

'Done feeding
cond
*.bottype 2 =
*.job 5 =
*.nrg 8000 <
start
0 .fixpos store
2 .job store
stop

'Misc
'------------
'Clear in1
cond
*.in1 0 !=
start
0 .in1 store
stop

'Clear in2
cond
*.in2 0 !=
start
0 .in2 store
stop

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