'My First Bot
'by EricL

'1 
cond
 *.robage 1 =
start
 1 .deltie store
 628 .aimsx store
stop

'2 Get rid of all ties
cond
*.robage 0 =
start
1 .tie store
77 .tienum store
stop

'3 Initialization
cond
 *.robage 0 =
start
 .paralyzed .memloc store
 .myeye .vloc store
 *.myeye .venval store
stop

'4
cond
 *.numties 0 =
start
 10 rnd .aimsx store
 40 .up store
stop

'5 Adjust aim on victim
cond
 *.eye1 *.eye9 !=
 *.numties 0 =
start
 *.eye1 *.eye9 sub .aimsx store
stop

'6 Adjust aim on victim
cond
 *.eye2 *.eye8 !=
 *.numties 0 =
start
 *.eye2 *.eye8 sub *.vel mult .aimsx store
stop

'7 Adjust aim on victim
cond
 *.eye3 *.eye7 !=
 *.numties 0 =
start
 *.eye3 *.eye7 sub *.vel mult 2 div .aimsx store
stop

'8 Adjust aim on victim
cond
 *.eye4 *.eye6 !=
 *.numties 0 =
start
 *.eye4 *.eye6 sub .aimsx store
stop

'9 Match lateral velocity and close with prey
cond
 *.eye5 10 >
 *.refshoot *.myshoot !=
 '*.refveldx 0 >
 *.numties 0 =
start
 *.refveldx .dx store
 *.refvelup 100 *.eye5 sub add .up store
stop

'10 Move towards things we can eat
cond
 *.vel 40 <
 *.refshoot *.myshoot !=
start
 40 rnd *.vel sub .up store
stop

'11 Feed - Lock and load on the victim
cond
 *.eye5 77 !=
 *.eye5 50 >
 *.eye4 *.eye6 =
 *.refshoot *.myshoot !=
 *.numties 0 =
 *.robage 1 >
start
 77 .tie store
 77 .tienum store
 *.refvelup .up store
 *.refveldx .dx store
 *.tieang 90 sub .aimsx store
 -6 .shoot store
stop

'12 Feed through Tie
cond
*.numties 0 >
*.robage 1 >
*.trefshoot *.myshoot !=
start
-1 .tieloc store
-9990 .tieval store 
77 .readtie store
100 rnd .aimsx store
stop

'13 Delete ties to conspecs
cond
*.numties 0 >
*.trefshoot *.myshoot =
start
*.tiepres .deltie store
stop

'14 Reproduce
cond
 *.body 200 >
 *.nrg 1000 >
 *.eye5 30 <
start
 50 .repro store
stop

'15 Stop prey dead in thier tracks
cond
 *.eye5 50 >
 *.refshoot *.myshoot !=
 *.reffixed 1 !=
start
  50 .shootval store
 .fixpos .shoot store
stop

'16 Turn attackers against their own by changing
'  their *.myeye to match ours
cond
 *.eye5 30 >
 *.memval 0 !=
 *.refshoot *.myshoot !=
 *.refshoot 0 !=
start
 50 .shootval store
 -3 .shoot store
stop

'17 Make sure we always have venom
cond
 *.venom 100 <
start
 50 .strvenom store
stop

'18 If we get shot, turn to face the enemy
cond
 *.shflav -6 =
 *.shup 0 !=
start
  *.shang 314 add .aimdx store
stop

'19 Store extra energy away
cond
*.nrg 1200 >
start
100 .strbody store
stop

'20 Use stored energy if necessary
cond
*.nrg 1000 <
start
*.body 0 floor .fdbody *.body sgn mult store
stop

'21 Get rid of waste
cond
*.waste 40 >
start
*.backshot inc
-4 .shoot store
*.waste .shootval store
stop

'22 Don't get fixed!
cond
start
.fixpos *.fixed mult dec
stop

cond
*.tiepres 77 !=
*.tiepres 0 >
start
*.tiepres .tienum store
.tieval .tieloc store
1000 .tieval store
stop



end
