Author Topic: Inchworm2 (MB)(PY)-26.10.04  (Read 3284 times)

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Inchworm2 (MB)(PY)-26.10.04
« on: April 19, 2005, 02:06:21 PM »
Code: [Select]
' Inch Worm2
' by Purple Youko
' October 26 2004
' for version 2.33 Multi-bot league
' Now a considerably bettercombat robot
' and much cuter than most
' And make a reliable MB every time.

def type 50
def counter 51
def newmom 52
def adult 53
def fix 54
' fix works as a chemical signal between head and tail
def avoid 55

cond
*.robage 0 =
start
.fixpos inc
40 .stifftie store
1 .readtie store
.shoot .ploc store
stop

cond
*.robage 20 =
start
.fixpos dec
stop

' new mom
' ***********
cond
*.robage 2 >
*.numties 0 =
*.eye5 50 <
*.eye7 50 <
*.eye3 50 <
start
50 .repro store
20 .newmom store
1 .type store
0 .adult store
stop

' tie to baby
' ************
cond
*.type 1 =
*.newmom 19 =
start
1 .tie store
stop

' program tail
' *************
cond
*.type 0 =
*.numties 0 !=
start
2 .type store
stop

'what if I can't make a tail? (panic)
' *************************************
cond
*.robage 2 >
*.numties 0 =
*.eye5 40 >
start
50 .aimsx store
stop

cond
*.robage 2 >
*.numties 0 =
*.eye9 40 > or
*.eye5 40 > or
*.eye2 40 >
*.newmom 0 =
start
100 .aimsx store
stop

' Increment counters
' **********************
cond
*.type 1 =
*.adult 1 =
*.eye5 50 <
*.eye7 60 <
*.eye3 60 <
start
.counter inc
stop

cond
*.newmom 0 >
start
.newmom dec
stop

cond
*.robage 15 =
start
628 .aimsx store
1 .tienum store
628 .tieval store
.aimsx .tieloc store
stop

' straighten out
' ****************
cond
*.multi 1 =
*.adult 0 =
start
628 .fixang store
1 .tienum store
1 .adult store
stop

'fix position
' **************
cond
*.type 2 =
*.fix 1 =
start
1 .fixpos store
0 .fix store
stop

 'unfix position
' **************
cond
*.type 2 =
*.fix 2 =
start
0 .fixpos store
0 .fix store
stop

' head fixes and tail unfixes
' *****************************
cond
*.type 1 =
*.counter 1 =
start
1 .fixpos store
1 .tienum store
2 .tieval store
.fix .tieloc store
stop

' shrink tie
' **********
cond
*.type 1 =
*.counter 2 =
start
1 .tienum store
120 .fixlen store
stop

' head unfixes and tail fixes
' *****************************
cond
*.type 1 =
*.counter 6 =
start
0 .fixpos store
1 .tienum store
1 .tieval store
.fixpos .tieloc store
stop

' stretch tie
' ************
cond
*.type 1 =
*.counter 7 =
start
1 .tienum store
360 .fixlen store
stop

'reset counter
' **************
cond
*.type 1 =
*.counter 10 =
start
0 .counter store
628 .fixang store
stop



' search for food
' *****************
cond
*.type 1 =
*.eye1 20 >
*.eye1 *.eye5 >
*.fixed 0 =
*.avoid 0 =
start
*.eye1 *.eye5 sub 3 div .sx store
stop

cond
*.type 1 =
*.eye9 20 >
*.eye9 *.eye5 >
*.fixed 0 =
*.avoid 0 =
start
*.eye5 *.eye9 sub 3 div .sx store
stop

cond
*.type 1 =
*.eye7 20 >
*.eye7 *.eye4 >
*.fixed 0 =
*.avoid 0 =
start
*.eye4 *.eye7 sub 2 div .sx store
stop

cond
*.type 1 =
*.eye3 20 >
*.eye3 *.eye6 >
*.fixed 0 =
*.avoid 0 =
start
*.eye3 *.eye6 sub 2 div .sx store
stop

'shoot when it sees a target
' ******************************
cond
*.eye5 28 >
*.eye4 20 >
*.eye6 20 >
*.refeye *.myeye !=
*.multi 1 =
start
1 .fixpos store
1 .tienum store
1 .tieval store
.fix .tieloc store
stop

cond
*.eye5 25 >
*.refeye *.myeye !=
*.multi 1 =
start
-1 .shoot store
stop

'avoids conspecs
' ******************
cond
*.type 1 =
*.eye5 20 >
*.refeye *.myeye =
*.multi 1 =
*.newmom 0 =
*.robage 50 >
start
5 .avoid store
stop

cond
*.avoid 0 >
start
0 .fixpos store
15 .sx store
.avoid dec
1 .tienum store
.fixpos .tieloc store
1 .tieval store
stop

'share energy
' ***************
cond
*.nrg *.trefnrg !%=
start
50 .sharenrg store
stop

'reproduce
' *************
cond
*.type 1 =
*.nrg 5000 >
start
1 .deltie store
stop

'body management
' *********************
cond
*.nrg 2000 >
*.body 500 <
start
50 .strbody store
stop

cond
*.nrg 1000 <
*.body 100 >
start
100 .fdbody store
stop

cond
*.slime 100 <
start
10 .mkslime store
stop

cond
*.poison 500 <
start
20 .strpoison store
stop

' waste amanagement
' ************************
cond
*.waste 100 >
start
-4 .shoot store
*.waste .shootval store
stop
end
« Last Edit: May 06, 2014, 11:57:13 AM by Botsareus »
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D