Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - bacillus

Pages: 1 2 [3] 4 5 6
31
F2 bots / Vermis Bicerebrus (MB)(F2)(Bacillus)-01.09.08
« on: September 01, 2008, 07:10:30 PM »
Code: [Select]
'Vermis Bicerebrus
 'The two-headed worm
 'A multibot by Bacillus
 'Two heads coordinate themselves so one end pulls stronger than the other and the other
 'co-operates if it feels it is being pulled too much
 'Uses poison and shell
 'Body bits' aim is still a bit odd
 
 'Body vars-tail is obsolete
 def head 0
 def bodyp 5
 def tail 10
 
 'Minimum body level to be sustained
 def blevel 200
 'Maximium velocity
 def maxv 40
 'Velocity to sustain, be it forwards or backwards
 def mvel 42
 
 'INIT-form tie to parent
 '    -conspec
 '    'set sustained velocity
 cond
  *.robage 0 =
 start
  69 .out1 store
  69 .tout1 store
  .tie inc
  .maxv rnd ++ .mvel store
 stop
 
 'Clear worm ID if single cell
 cond
  *.numties 0 =
 start
  .out3 store .tout3 store
 stop
 
 'Set worm ID
 cond
  *.tout3 0 =
  *.numties 0 >
  *.tin3 0 =
 start
  -32000 32000 rnd dup .out3 store .tout3 store
 stop
 
 'Copy worm ID
 cond
  *.tout3 0 =
  *.numties 0 > and
  *.tin3 0 != and
  *.numties 0 >
  *.tin3 *.tout3 > and or
 start
  *.tin3 dup .tout3 store .out3 store
 stop
 
 'Update-Antivirus system
 '      -Anti-manipulations
 '      -Make shell
 '      -Body maintenance
 start
  *.mkvirus .delgene store
  .backshot store
  *.tout2 *.shell sub .mkshell store
  .fixpos store
  .blevel *.totalmyspecies 10 mult add *.body sub dup .strbody store - .fdbody store
 stop
 
 'Less than 2 ties = head
 cond
  *.numties 2 <
 start
  .head dup .out2 store .tout2 store
  *.mvel abs .mvel store
 stop
 
 '2 ties = body part
 cond
  *.numties 2 =
 start
  .bodyp dup .out2 store .tout2 store
 stop
 
 'Too much strain, change direction
 cond
  *.out2 .head =
  *.velup *.mvel sgn mult 0 <=
  *.in1 *.out1 !=
 start
  *.mvel - .mvel store
 stop
 
 'Head Update-Fix eyes
 '           -Move tie out of the way
 '           -Fix shot
 '           -Set speed
 '           -OCULUS II
 cond
  *.out2 .head =
 start
  .eye5dir store
  628 .fixang store
  .aimshoot store
  *.mvel *.eye5 sgn 10 mult add *.velup sub .up store
  -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0    floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub   sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9     *.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
  *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor  mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub   sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6  sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2    *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn     mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0   floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub   sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3    *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
  *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn   mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub     sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5  sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7     *.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn     mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0    floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub     sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4    *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
  *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn     mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub     sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3   sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add .focuseye store
 stop
 
 'Defense Mechanism-Make poison, take shell from others, wriggle around
 cond
  *.shflav -1 =
  *.shflav -6 =
  or
 start
  99 .shareshell store
  25 *.poison sub .mkpoison store
  .shoot .ploc store
  *.velup 1 rnd 2 mult -- mult .dx store
  .shflav store
 stop
 
 'Food sighted
 cond
  *.out2 .head =
  *.in1 *.out1 !=
  *.eyef 0 >
 start
  *.veldx .sx store
  *.refxpos *.refypos angle .setaim store
 stop
 
 'Use radar-eye if body part (Need to fix aimshoot)
 cond
  *.out2 .bodyp =
 start
  .focuseye store
  *.timer 314 mult 628 sub dup .eye5dir store .aimshoot store
  99 .sharewaste store
  25 *.shell sub .mkshell store
  *.trefvelmyup 5 sub floor .up store
 stop
 
 'Nrg sharing
 'In pulses to localize death by lack of nrg
 cond
  *.timer 25 mod 0 =
 start
  50 .sharenrg store
 stop
 
 'Body parts shed waste
 cond
  *.out2 .bodyp =
  *.waste 50 >=
 start
  *.waste .shootval store
  -4 .shoot store
 stop
 
 'Attack food
 cond
  *.in1 *.out1 !=
  *.eyef 30 >
  *.refnrg 0 >
 start
  16 .shootval store
  -1 .shoot store
  *.velup .dn *.out2 .head sub sgn abs -- abs mult store
  *.hitup .fixpos store
 stop
 
 'Make tie between two single cells
 cond
  *.out2 .head =
  *.in2 .head =
  *.in1 *.out1 =
  *.in3 0 =
  *.out3 0 =
 start
  .tie inc
 stop
 
 'Delete excess/foreign ties
 cond
  *.tin1 *.tout1 !=
  *.numties 2 > or
 start
  *.tiepres .deltie store
 stop
 
 'Grow
 cond
  *.nrg *.body 10 mult 5000 floor >
  *.eye5 30 <
  *.out2 .head =
 start
  50 .repro store
 stop

32
Suggestions / Relative Collision Elasticity
« on: May 30, 2008, 12:52:25 AM »
I think that the bounce force of when a bot collides to another bot should be influenced by shell (which makes the bot more bouncy) and slime (which makes the bot sticky).  

33
DNA - General / How does body mass affect the final speed of a bot?
« on: May 27, 2008, 04:06:23 AM »
I'm trying to figure out how to always make a bot go at maximum speed, but do not know how mass affects this, or if it can even be fixed by going beyond terminal velocity (I am assuming .up, .dn, .dx and .sx only supply a force, then f = ma applied, but am not 100% sure.)  

34
Interesting behaviour bots / Gridlock(CB)(bacillus)-27-05-08
« on: May 27, 2008, 03:57:15 AM »
'Gridlock
'A communal bot by Bacillus
'Inspired by Commander Keen's Republican Bee
'Forms a defensive grid in the center of the map
def status 42
def cx 43
def cy 44
def lastx 45
def lasty 46
def temp 47

cond
 *.robage 0 =
start
 1256 .out1 store
 1256 9 div dup dup dup dup dup dup dup dup 30 add .eye6dir store
 2 mult 60 add .eye7dir store
 3 mult 90 add .eye8dir store
 4 mult 130 add .eye9dir store
 -1 mult 30 sub .eye4dir store
 -2 mult 60 sub .eye3dir store
 -3 mult 90 sub .eye2dir store
 -4 mult 130 sub .eye1dir store
 1256 9 div 30 sub dup dup dup dup dup dup dup dup .eye1width store
 .eye2width store
 .eye3width store
 .eye4width store
 .eye5width store
 .eye6width store
 .eye7width store
 .eye8width store
 .eye9width store
 0 .status store
 0 .fixpos store
stop

start
 *.nrg 3 div *.body sub dup .strbody store - .fdbody store

 *.cx .out2 store
 *.cy .out3 store
 *.status .out4 store
 *.cx *.cy dist .out5 store

 10 .up store
 'OCULUS II
 -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult
*.eye1 *.eye7 sub sgn 0 floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1
*.eye5

sub sgn 0 floor mult *.eye1 *.eye4 sub sgn 0 floor mult *.eye1 *.eye3 sub
sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9 *.eye8 sub sgn
0 floor

mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
*.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9
*.eye3 sub sgn 0 floor mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1
sub

sgn ++ sgn mult add -3 *.eye2 *.eye9 sub sgn ++ sgn mult *.eye2 *.eye8 sub
sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6 sub sgn 0
floor

mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult
*.eye2 *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3
*.eye8

*.eye9 sub sgn ++ sgn mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6
sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0 floor mult *.eye8 *.eye4 sub
sgn 0

floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub sgn ++ sgn
mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn
mult

*.eye3 *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3
*.eye6 sub sgn 0 floor mult
*.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3
*.eye2 sub sgn ++ sgn mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7
*.eye9

sub sgn ++ sgn mult *.eye7 *.eye8 sub sgn ++ sgn mult *.eye7 *.eye7 sub sgn
0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5 sub sgn 0
floor

mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult
*.eye7 *.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult
*.eye4

*.eye8 sub sgn ++ sgn mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6
sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0 floor mult *.eye4 *.eye3 sub
sgn ++

sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn mult
add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult
*.eye4

*.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5
sub sgn 0 floor mult
*.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4
*.eye1 sub sgn ++ sgn mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5
*.eye8

sub sgn ++ sgn mult *.eye5 *.eye7 sub sgn ++ sgn mult *.eye5 *.eye6 sub sgn
++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3 sub sgn ++ sgn
mult

*.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add
.focuseye store
stop

cond
 *.body 1000 >
start
 0 .strbody store
 *.body 1000 sub .fdbody store
stop

cond
*.status 0 =
start
 0 0 angle .setaim store
stop

cond
*.cx *.xpos 2 div <
start
 *.xpos 2 div .cx store
stop

cond
 *.cy *.ypos 2 div <
start
 *.ypos 2 div .cy store
stop

cond
 *.in1 *.out1 =
 *.cx *.in2 <
start
 *.in2 .cx store
stop

cond
 *.in1 *.out1 =
 *.cy *.in3 <
start
 *.in3 .cy store
stop

cond
 *.robage 20 >
 *.xpos *.lastx sub abs *.maxvel >
 *.ypos *.lasty sub abs *.maxvel >
 *.status 0 =
start
 .status inc
stop

cond
 *.status 1 =
start
 *.cx *.cy angle .setaim store
 *.velsx .dx store
stop

cond
 *.eyef 0 !=
 *.in1 *.out1 !=
 *.status 2 = or
start
 *.refxpos *.refypos angle .setaim store
 *.velsx .dx store
stop

cond
 *.nrg 5000 >
start
 *.nrg 5000 sub 3 div .mkshell store
stop

cond
 *.nrg 20000 >
start
 5000 .mkslime store
stop

cond
 *.in1 *.out1 !=
 *.refbody 2000 > or
 *.eye5 40 >
start
 -6 .shoot store
stop

cond
 *.in1 *.out1 !=
 *.eye5 0 >
 *.eye5 40 <
 *.status 2 =
 *.timer 10 mod 7 =
start
 -32 .shootval store
 -6 .shoot store
stop

cond
 *.status 1 =
 *.cx *.cy dist 100 <
 *.in1 *.out1 =
 *.in4 2 = and
 *.eyef 2 = and xor
 *.temp 5 <
start
 .temp inc
stop

cond
 *.status 1 = and
 *.cx *.cy dist 100 < and
 *.in1 *.out1 =
 *.in4 2 = and
 *.eyef 2 = and xor not
 *.temp 0 !=
start
 0 .temp store
stop

cond
 *.status 2 =
 *.in4 2 =
 *.in1 *.out1 =
 *.refnrg *.nrg sub 1000 >
 *.timer 10 mod 2 =
start
 -16 .shootval store
 -1 .shoot store
stop

cond
 *.waste 100 >
start
 *.waste .shootval store
 -4 .shoot store
stop

cond
 *.status 1 =
 *.cx *.cy dist 100 <
 *.in1 *.out1 =
 *.in4 2 = and
 *.eyef 2 = and xor
 *.temp 5 =
start
 .status inc
 .fixpos inc
stop

cond
 *.eyef 2 >
 *.in1 *.out1 =
 *.status 1 =
 *.in4 2 =
start
 -12 .up store
 3 .dx store
stop

cond
 *.status 2 =
 *.eyef 2 >
 *.in4 2 =
 *.out5 *.in5 <=
start
 0 .fixpos store
 1 .status store
 -25 .up store
stop

cond
 *.nrg 10000 >
 *.timer 250 mod 7 =
 *.status 2 =
start
 1256 rnd .setaim store
 30 .repro store
stop

start
 *.xpos .lastx store
 *.ypos .lasy store
stop

35
Multi-Bots / BotBot 1.1 (MB)(F2)(Bacillus)-14.05.08
« on: May 15, 2008, 03:42:54 AM »
Ok, I actually put some thought into this version, especially the clear-eye part. Also increased defensive upkeep depending on number of tie attempts, shots impacted.
Code: [Select]
def mode 50
 def minslime 51
 def minshell 52
 def minpoison 53
 
 start
  50 .repro store
  *.thisgene .delgene store
 stop
 
 cond
  *.robage 0 =
 start
  7890 .out10 store
  80 .eye1dir store
  60 .eye2dir store
  40 .eye3dir store
  20 .eye4dir store
  -20 .eye6dir store
  -40 .eye7dir store
  -60 .eye8dir store
  -80 .eye9dir store
  20 .eye1width store
  20 .eye2width store
  20 .eye3width store
  20 .eye4width store
  20 .eye5width store
  20 .eye6width store
  20 .eye7width store
  20 .eye8width store
  20 .eye9width store
 
  50 .minshell store
  150 .minshell store
  10 .minpoison store
 stop
 
 cond
  *.robage 5 <
  *.nrg 1000 <
 start
  180 .dx store
  2 .mode store
 stop
 
 start
  *.body 250 div 2 floor .up store
  0 .fixpos store
  *.mkvirus *.mkvirus sgn .delgene mult store
  *.nrg *.body sub dup .strbody store - .fdbody store
  -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0    
 
 floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub  
 
 sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9    
 
 *.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
  *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor
 
  mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub  
 
  sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6
 
  sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2  
 
  *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn    
 
  mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0  
 
  floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub  
 
  sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3  
 
  *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
  *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn  
 
  mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub    
 
  sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5
 
  sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7    
 
 *.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn    
 
 mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0    
 
 floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub    
 
 sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4    
 
 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
  *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn    
 
  mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub    
 
  sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3  
 
 sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add
 
 .focuseye store
 stop
 
 cond
  *.eyef 0 =
 start
  400 .aimdx store
 stop
 
 cond
  *.eyef 0 =
  *.timer 3 mod 1 =
 start
  20 .up store
 stop
 
 cond
  *.numties 0 >
 start
  *.tiepres .deltie store
  *.minslime 25 add .minslime store
  180 .dx store
 stop
 
 cond
  *.shflav -6 =
 start
  .minshell inc
 stop
 
 cond
  *.shflav -1 =
 start
  *.minpoison inc
 stop
 
 cond
  *.eyef 0 =
  *.hitang 0 !=
 start
  *.hitang .setaim store
 stop
 
 cond
  *.eyef 0 =
  *.shang 0 !=
 start
  *.shang .setaim store
 stop
 
 cond
  *.mode 0 =
 start
  *.minslime *.slime sub .mkslime store
  *.minshell *.shell sub .mkshell store
  *.minpoison *.poison sub .strpoison store
  .shoot .ploc store
 stop
 
 cond
  *.in10 *.out10 !=
 start
  *.refxpos *.refypos angle .setaim store
 stop
 
 cond
  *.mode 0 =
  *.body 30000 >
 start
   .mode inc
 stop
 
 cond
  *.mode 2 =
  *.body 500 >
 start
  0 .mode store
 stop
 
 cond
  *.mode 1 =
  *.nrg 1000 >
 start
  20000 *.nrg div .repro store
  314 rnd .aimdx store
 stop
 
 cond
  *.eye5 40 >
  *.in10 *.out10 !=
 start
  *.mode -- abs 63 mult ++ .shootval store
  -5 *. mode 2 sub sgn abs mult -- .shoot store
 stop
 
 cond
  *.mode 1 =
  *.nrg 500 <
 start
  .mode dec
 stop
 
 cond
  *.waste 150 >
 start
  *.waste .shootval store
  -4 .shoot store
 stop

36
F2 bots / BotBot(F2)(bacillus)15.05.08
« on: May 15, 2008, 03:09:29 AM »
This bot grows large, like its predecessor Colossus, but when it reaches the body threshold, starts reproducing like mad. Each bot may produce hundreds of offspring at a time.

Code: [Select]
def mode 50

cond
 *.robage 0 =
start
 7890 .out10 store
 80 .eye1dir store
 60 .eye2dir store
 40 .eye3dir store
 20 .eye4dir store
 -20 .eye6dir store
 -40 .eye7dir store
 -60 .eye8dir store
 -80 .eye9dir store
 20 .eye1width store
 20 .eye2width store
 20 .eye3width store
 20 .eye4width store
 20 .eye5width store
 20 .eye6width store
 20 .eye7width store
 20 .eye8width store
 20 .eye9width store
stop

cond
 *.robage 5 <
 *.nrg 1000 <
start
 180 .dx store
 2 .mode store
stop

start
 3 .up store
 *.nrg 3 div *.body sub dup .strbody store - .fdbody store
 -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0   

floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub   

sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9     

*.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
 *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor

 mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub 

 sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6

 sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2   

 *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn   

 mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0 

 floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub 

 sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3   

 *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
 *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn 

 mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub   

 sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5

 sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7     

*.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn     

mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0   

floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub     

sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4   

*.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
 *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn   

 mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub   

 sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3   

sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add

.focuseye store
stop

cond
 *.mode 0 =
start
 150 *.slime sub .mkslime store
 50 *.shell sub .mkshell store
 20 *.poison sub .strpoison store
 .shoot .ploc store
stop

cond
 *.in10 *.out10 !=
start
 *.refxpos *.refypos angle .setaim store
stop

cond
 *.mode 0 =
 *.body 30000 >
start
  .mode inc
stop

cond
 *.mode 2 =
 *.body 500 >
start
 0 .mode store
stop

cond
 *.mode 1 =
 *.nrg 1000 >
start
 32000 *.nrg div .repro store
 314 rnd .aimdx store
stop

cond
 *.eye5 40 >
 *.in10 *.out10 !=
start
 *.mode -- abs 15 mult ++ .shootval store
 -5 *. mode 2 sub sgn abs mult -- .shoot store
stop

cond
 *.mode 1 =
 *.nrg 500 <
start
 .mode dec
stop

37
Short bots / Singula Haloculus v2.1 (SB)(bacillus)5-12-2008
« on: May 12, 2008, 02:24:13 AM »
Code: [Select]
cond
start
-32000 .shootval *.eye5 40 sub sgn 0 floor mult *.memval *999 sub sgn abs mult store
.shootval .shoot *.eye5 40 sub sgn 0 floor mult *.memval *999 sub sgn abs mult store
3 .up store
3 .sx store
24 999 store
*.nrg 3 div *.body sub dup .strbody store - .fdbody store
*.memval 24 sub sgn abs 41 add .tie store
*.eye5 sgn -- abs 1216 rnd mult .aimdx store
99 .sharenrg store
1 .sharewaste store
41 .deltie store
-6 .tieloc store
-1000 .tieval store
100 .shareshell store
100 .shareslime store
*.nrg 200 sub sgn ++ sgn 50 mult .repro store
999 .memloc store
1 rnd ++ 2 mult 3 sub *.thisgene add .delgene store
stop

38
Untagged bots / Collosus v1.1
« on: May 10, 2008, 08:17:13 PM »
start
 *.body 10 div *.shell sub  .mkshell store
 *.body 10 div *.slime sub .mkslime store
 *.body 10 div *.poison sub .strpoison store
 .shoot .ploc store
 10000 .out4 store
 *.body 250 div 2 floor .up store
 100 *.body 250 div add *.eyef sgn -- abs *.aim 100 sub abs 100 ceil 100 sub sgn abs mult .up mult store
 *.nrg *.body sub dup .strbody store - .fdbody store
 *.nrg 10 div *.eye5 31999 sub sgn 0 floor .shootval mult *.in4 *.out4 sub sgn abs mult store
 -6 *.eye5 40 sub sgn 0 floor .shoot mult *.in4 *.out4 sub sgn abs mult store
 -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0    floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub   sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9     *.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
 *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor  mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub   sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6  sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2    *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn     mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0   floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub   sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3    *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
 *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn   mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub     sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5  sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7     *.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn     mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0    floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub     sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4    *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
 *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn     mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub     sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3   sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add .focuseye store
 *.refxpos *.refypos angle .setaim *.eyef sgn mult *.out4 *.in4 sub sgn abs mult store
 *.waste *.waste 250 sub sgn 0 floor .shootval mult store
 -4 *.waste 250 sub sgn 0 floor .shoot mult store
 100 .dx *.eyef 20 sub sgn 0 floor mult *.out4 *.in4 sub sgn abs -- abs mult store
 400 .aimdx  *.eye5 sgn -- abs mult *.eye1 sgn -- abs mult *.eye2 sgn -- abs mult *.eye3 sgn -- abs   mult *.eye4 sgn -- abs mult *.eye6 sgn -- abs mult *.eye7 sgn -- abs mult *.eye8 sgn -- abs mult   *.eye9 sgn -- abs mult store
 3 *.body 31900 sub sgn 0 floor .repro mult store
 *.tiepres .deltie store
 *.thisgene 1 rnd 2 mult -- add .delgene store
stop

39
Interesting behaviour bots / Antbot v1.5 beta
« on: May 09, 2008, 03:17:52 AM »
In this version, workers remember a path where nothing is sighted, then when no food is available, patrol the path.
Note that the bot doesn't seek the nearest waypoint because 80 variables is a lot to go through, and it might go right through something you wanted to avoid. eg. an enemy colony.

Code: [Select]
'Antbot v1.5 beta
''A hivebot by Bacillus

'''''''''''''''''''''''''''''
'I/O CHANNELS
'''''''''''''''''''''''''''''
''I/O 1-species conspec
''I/O 2-type recognition
''I/O 3-status report and queen communication channel
''I/O 4-hive conspec
''I/O 5-andrenaline level
''I/O 6-food timer-measures time elapsed since worker last saw food
''I/O 7-X coordinate of last food sighting
''I/O 8-Y coordinate of last food sighting
''I/O 9-status timer-shows how long a decision by the queen lasts
''I/O 10-Hostility-Factor on which queen decides to attack or not

'''''''''''
'VARS
'''''''''''
''Young Queen-collects energy to form her own colony. Chance-1 in 1000
''Queen-spawns smaller ants
''Drone-Poisons enemies, collects nrg from workers & other species,
''relays back to queen. Chance-1 in 5
''Worker-Finds food, brings it back to queen, and shares location
''of food with other workers. Chance-1 in 2
''Scout-Moves quickly to pull in veggies. Chance-1 in 5
''Guard-Protects the queen and reports enemy raids. Chance-1 in 10

def youngqueen 0
def queen 1
def drone 2
def worker 3
def scout 4
def guard 5

''Default-Ants act normally
''Raid-Ants attempt to steal food from other hives
''Attack-Ants will attack other hives
''Report-A guard stus of going back to the queen and reporting a theft

def default 0
def raid 10
def attack 20
def report 30

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'CUSTOM MEMORY LOCATIONS
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''Status-Influences behaviour of ants
''Hostility-How angry a hive is
''Temp-initialization purposes
''Type-The Ant's job in the colony
''Queenxpos and Queenypos-Queen's coordinates
''Dumpdist-The distance from the queen at which a scout should dump a veggie
''Hiveid-The id of the hive this ant belongs to
''Andrenaline-The amount of andrenaline a drone has
''Memtimer-The time elapsed since worker last saw food
''Foodxpos and Foodypos-the coordinates of the last seen food
def statustimer 987
def status 988
def hostility 989
def temp 990
def type 991
def queenxpos 992
def queenypos 993
def dumpdist 994
def hiveid 995
def andrenaline 996
def memtimer 997
def foodxpos 998
def foodypos 999

''Path tracker custom memlocs
def minxpos 20
def minypos 60
def count 100
def bearing 101
def mindist 350
def distance 102

'Initialization
''What type of ant am I?
''Set eyes and conspec
cond
*.robage 0 =
start
1000 rnd .temp store
.youngqueen *.temp sgn -- abs .type mult store
.drone *.temp sgn .type mult store
.scout *.temp 200 sub sgn 0 floor .type mult store
.guard *.temp 400 sub sgn 0 floor .type mult store
.worker *.temp 500 sub sgn 0 floor .type mult store

1235 .out1 store

-436 .eye9dir store
-327 .eye8dir store
-218 .eye7dir store
-109 .eye6dir store
109 .eye4dir store
218 .eye3dir store
327 .eye2dir store
436 .eye1dir store
105 .eye1width store
105 .eye2width store
105 .eye3width store
105 .eye4width store
105 .eye5width store
105 .eye6width store
105 .eye7width store
105 .eye8width store
105 .eye9width store
stop

'First generation is always a queen
start
.youngqueen .type store
*.thisgene .delgene store
stop

'OCULUS
'Update bot
cond
start
*.hiveid .out4 store
*.andrenaline .out5 store
*.type .out2 store
*.memtimer .out6 store
*.foodxpos .out7 store
*.foodypos .out8 store
*.status .out3 store
*.statustimer .out9 store
*.hostility .out10 store
*.nrg 3 div *.body sub dup .strbody store - .fdbody store
-4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0

floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub

sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9

*.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
*.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor

mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub

sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6

sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2

*.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn

mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0

floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub

sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3

*.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
*.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn

mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub

sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5

sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7

*.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn

mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0

floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub

sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4

*.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
*.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn

mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub

sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3

sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add

.focuseye store

12 *.type .scout sub sgn abs -- abs 3 mult ++ mult *.vel sub .up store
*.type .queen sub sgn abs -- abs .fixpos store
*.tiepres .tienum store
500 rnd 1500 add .dumpdist *.type .scout sub sgn abs -- abs mult store
*.andrenaline *.venom sub .strvenom store
.andrenaline *.andrenaline sgn mult dec
.memtimer *.memtimer sgn mult dec
.statustimer *.statustimer sgn mult dec
-2 .venval store
.shoot .vloc store
.paralyzed .memloc store
40 .stifftie store
.minxpos *.count add * .minypos *.count add * dist .distance store
stop

''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'BEGIN WORKER PATH CODE
''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'If I reached the end/beginning of my path, I turn around and start again
cond
 *.type .worker =
 *.count 0 =
start
 1 .bearing store
stop

cond
 *.type .worker =
 *.count 39 =
start
 -1 .bearing store
stop

'I see nothing and my timer's gone off, I'll remember this place.
cond
 *.type .worker =
 *.eyef 0 =
 *.count .minxpos add * 0 =
 *.count .minypos add * 0 =
 *.timer 250 mod 1 =
start
 *.xpos *.count .minxpos add store
 *.ypos *.count .minypos add store
 *.count *.bearing add .count store
stop

'I see nothing, so I'll follow where I last left the highway.
cond
 *.type .worker =
 *.eyef 0 =
 .minxpos *.count add * 0 !=
 .minypos *.count add * 0 !=
start
 .minxpos *.count add * .minypos *.count add * angle *.veldx 2 div sub .setaim store
stop

'I've reached my marker, so I'll go to the next.
cond
 *.type .worker =
 .minxpos *.count add * 0 !=
 .minypos *.count add * 0 !=
 *.distance .mindist <
start
 *.count *.bearing add .count store
stop

'''''''''''''''''''''
'END WORKER PATH CODE
'''''''''''''''''''''

'I'm too small!!
cond
*.body 150 <
start
175 *.body sub .strbody store
stop

'Some idiot has tied to me!!
cond
*.numties 0 !=
*.type .scout !=
start
*.tiepres .deltie store
stop

'I am a guard and should only turn towards enemy conspecs
cond
 *.type .guard =
 *.eyef 0 !=
 *.refnrg 0 >
 *.in1 *.out1 =
 *.in4 *.hiveid != and
 *.in1 *.out1 !=
 *.nrg 1000 < and or
start
 *.refxpos *.refypos angle .setaim store
stop

'I am a drone and should turn towards workers and queens as well as ants of other hives
cond
*.eyef 0 !=
*.type .drone =
*.nrg 15000 <
*.in2 .scout !=
*.in1 *.out1 = and
*.in2 .youngqueen !=
*.in1 *.out1 = and and
*.in2 .drone !=
*.in1 *.out1 = and and
*.refnrg 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I'm a worker/young queen, no point turning towards conspecs
cond
*.eyef 0 !=
*.type .worker =
*.body 1000 < and
*.type .youngqueen = or
*.out1 *.in1 !=
*.refnrg 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I am a young queen and am big and fat, so I mature
cond
*.type .youngqueen =
*.body 10000 >
start
.fixpos inc
.queen .type store
*.xpos .queenxpos store
*.ypos .queenypos store
32000 rnd .hiveid store
stop

'I have no hive and you are a queen, I'll join yours
cond
*.queenxpos 0 =
*.queenypos 0 =
*.type .queen !=
*.type .youngqueen !=
*.in2 .queen =
start
*.refxpos .queenxpos store
*.refypos .queenypos store
*.in4 .hiveid store
stop

'Queen update cycle
''Turn so I can make more ants
''Make some shell so I don't die easily
''Randomly decide to raid another hive
cond
*.type .queen =
start
20 .aimdx store
*.nrg 20000 sub sgn 0 floor 5 mult .mkshell store
10000 rnd dup sgn -- abs .raid mult .status store .statustimer store
stop

''If another hive has stolen more than 10 times, attack.
''Attacks can last for up to 2500 cycles.
cond
 *.type .queen =
 *.hostility 10 >
start
 .attack .status store
 2500 rnd .statustimer store
stop

'Read instructions from the queen
cond
 *.in1 *.out1 =
 *.in4 *.hiveid =
 *.in2 .queen =
 *.type .queen !=
 *.type .youngqueen !=
start
 *.in3 .status store
 *.in9 .statustimer store
stop

'Passive Drones and workers feed the queen
cond
*.in1 *.out1 =
*.in4 *.hiveid =
*.type .drone =
*.status .attack != and
*.type .worker = or
*.in2 .queen =
*.nrg 500 >
*.eye5 40 >
start
 .fixpos inc
*.nrg 1500 sub 1000 ceil .shootval store
-2 .shoot store
*.refxpos .queenxpos store
*.refypos .queenypos store
stop

'The queen is dead, I am a huge drone sitting in her place, I think I'll become the new queen.
cond
*.type .drone =
*.queenxpos *.queenypos dist 15 <
*.in2 .queen !=
*.nrg 30000 >=
start
.fixpos inc
.queen .type store
stop

'Drones harvest food from workers to bring to the queen so workers can keep harvesting.
cond
*.hiveid *.in4 =
*.type .drone =
*.in2 .worker =
*.eye5 40 >
*.refnrg 1000 >
start
-1 .shoot store
stop

'I am a drone near a queen, but have no food, so I'll move away.
cond
*.in1 *.out1 =
*.in2 .queen =
*.type .drone =
*.nrg 500 <=
start
*.maxvel *.velup add .dn store
stop

'I am a huge Drone/Worker, better go and give some of that food I harvested to the Queen.
cond
*.type .drone =
*.nrg 15000 > and
*.type .worker =
*.body 2500 > and or
start
*.queenxpos *.queenypos angle .setaim store
stop

'Oooh, lots of food, let's share!
cond
*.type .worker =
*.in1 *.out1 !=
*.refnrg 20000 >
*.reffixed 0 =
start
10 .memtimer store
*.refxpos .foodxpos store
*.refypos .foodypos store
stop

'You know where food is, I'll remember where.
cond
*.type .worker =
*.in1 *.out1 =
*.in2 .worker =
*.in6 *.memtimer >
start
*.in6 .memtimer store
*.in7 .foodxpos store
*.in8 .foodypos store
stop

'Forget it.
cond
*.type .worker =
*.memtimer 0 =
*.foodxpos 0 !=
*.foodypos 0 !=
start
628 .aimdx store
*.maxvel *.veldn add .up store
0 .foodxpos store
0 .foodypos store
stop

'I see no food, but know where some is, so I'll go find it.
cond
*.type .worker =
*.memtimer 0 >
*.in1 *.out1 =
*.eyef 0 = or
start
*.foodxpos *.foodypos angle .setaim store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more.
''It's fixed, so it won't run away.
cond
*.type .scout =
*.numties 1 =
*.treffixed 0 !=
start
*.tiepres .deltie store
314 .aimdx store
20 .up store
stop

'I am a scout without cargo and see food, let's get it!
cond
*.type .scout =
*.numties 0 =
*.in1 *.out1 !=
*.reffixed 0 =
*.refnrg 0 >
*.eyef 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I am a scout without cargo and am close to food, so I'll tie to it.
''Only steal fixed food if I was told to raid.
cond
*.type .scout =
*.in1 *.out1 !=
*.nrg 0 >
*.eye5 40 >
*.reffixed 0 =
*.reffixed 0 !=
*.in4 *.hiveid != and
*.status .raid = and or
*.refshoot 0 =
*.numties 0 =
start
.tie inc
stop

'I am a scout with cargo, better bring it back so the others can eat it.
''Might as well take some of the spoils myself so the load isn't as heavy.
''I'll mark this food as our own and unfix it.
cond
*.type .scout =
*.numties 1 =
start
*.queenxpos *.queenypos angle .setaim store
40 .sharenrg store
1 .sharewaste store
.out4 *.timer 2 mod mult *.timer 2 mod -- abs .fixpos mult add .tieloc store
*.hiveid *.timer 2 mod mult .tieval store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more.
''Let's fix it in place so it doesn't run away.
cond
*.type .scout =
*.numties 1 =
*.queenxpos *.queenypos dist *.dumpdist <
start
.fixpos .tieloc store
.tieval inc
stop

'I'm not a scout and I see food, let's eat it!
''If the veggie is part of out garden eg a scout pulled it in, to not kill it.
''If it's an enemy, I am a drone, and we were told to attack, do so.
cond
*.eye5 40 >
*.out1 *.in1 !=
*.out1 *.in1 =
*.in4 *.hiveid != and
*.type .drone = and
*.status .attack = and or
*.type .scout !=
*.reffixed 0 =
*.refnrg 0 > and
*.reffixed 0 >
*.refbody 1000 > and or
start
*.velsx .dx store
-6 .shoot store
stop

''If it's part of our garden, and it's small, eat its nrg instead.
cond
 *.eye5 40 >
 *.out1 *.in1 !=
 *.in4 *.hiveid =
 *.type .scout !=
 *.reffixed 0 !=
 *.body 1000 <=
 *.nrg 10000 >
start
 -1 .shoot store
stop

'I am a scout/guard, but am too close to the queen, so I'll move away
cond
*.type .scout =
*.type .guard =
*.status .report != and or
*.queenxpos *.queenypos dist 500 <
*.queenxpos *.queenypos angle *.aim %=
start
*.maxvel *.velsx add .dx store
stop

'I am a guard, but am too far away from the hive, I'll turn so I stay within the boundary
cond
 *.type .guard =
 *.queenxpos *.queenypos dist 5000 >
start
 *.queenxpos *.queenypos angle 50 rnd 175 add add .setaim store
stop

'Timer runs out, time to forget what the queen told us.
cond
 *.statustimer 0 =
 *.status .attack =
 *.status .raid = or
start
 .default .status store
stop

'I am a guard and someone's stealing our food, I'll report it to the queen
cond
 *.type .guard =
 *.in1 *.out1 =
 *.in4 *.hiveid !=
 *.in3 .raid =
start
 .report .status store
stop

'I'm reporting a theft
''Step 1-go to the queen
cond
 *.type .guard =
 *.status .report =
start
 *.queenxpos *.queenypos angle .setaim store
 25 .up store
stop

'I'm reporting a theft
''Step 2-tell the queen
cond
 *.type .guard =
 *.status .report =
 *.eyef 40 >
 *.in1 *.out1 =
 *.in4 *.hiveid =
 *.in2 .queen =
start
 *.in10 ++ .shootval store
 .hostility .shoot store
 .default .status store
stop

'I am a drone under attack, take countermeasures
''Part 1:If attacked, make andrenaline.
cond
*.type .drone =
*.shflav -1 =
*.shflav -6 = or
start
*.andrenaline 5 add .andrenaline store
*.shang .setaim store
0 .shflav store
stop

''Part 2:If venom is stored due to andrenaline, spit it at the enemy.
cond
*.eye5 40 >
*.out1 *.in1 !=
*.type .drone =
*.refshoot 0 >
*.venom 0 >
*.memval 0 !=
start
*.venom .shootval store
-3 .shoot store
stop

''Part 3:You're angry, so I'll be as angry as you.
cond
*.in1 *.out1 =
*.in2 .drone =
*.type .drone =
*.in5 *.andrenaline >
start
*.in5 .andrenaline store
stop

'I should really evolve a toilet...
cond
*.waste 200 >
start
*.waste .shootval store
-4 .shoot store
stop

'I am a Queen, so I should really make a colony
cond
*.type .queen =
*.nrg 5000 >
start
5 .repro store
stop

40
Off Topic / DarwinBot Awards
« on: May 08, 2008, 03:31:58 AM »
I thought about nominations for DarwinBot Awards. A bot elegible for a "DarwinBot Award" must show a basic form of the original Darwin Award golden rule, eg. it must remove itself from the gene pool in the most stupid fashion possible. This either means being unable to reproduce or to die. Contenders would be things such as bots who themselves are the only ones really affected by their virus, using veggies to channel power shots only to die themselves etc. This could be a fun idea. If you want to post your contender (please only post really good ones eg. not only push 50 .repro store every cycle), post it in the form of Simulation, .txt file or image, whatever reflects the behaviour the best.

41
DNA - General / Tie-Feeding
« on: May 05, 2008, 01:38:45 AM »
I found this out while playing around with Singula Haloculus yesterday. Just like -1 shots can be used to feed off nrg and -6 shots to feed off body, the same can be done with putting -6 into .tieloc. I'm not sure it's more efficient, but they had no other way of getting nrg and were doing quite well.

42
Interesting behaviour bots / Antbot v1.4
« on: May 01, 2008, 07:48:05 PM »
This version really had a lot of changes implemented. The idea originally came from Numsgil.
Guards are now active; they patrol the edge of the hive, and tell the queen when an enemy scout is trying to steal food.
The queen organizes raids and attacks against other hives.
If the queen is angry, she sends the drones to attack other hives.
I am now using every single I/O channel (I might need more)    

'Antbot v1.4
''A hivebot by Bacillus

'''''''''''''
'I/O CHANNELS
'''''''''''''
''I/O 1-species conspec
''I/O 2-type recognition
''I/O 3-status report and queen communication channel
''I/O 4-hive conspec
''I/O 5-andrenaline level
''I/O 6-food timer-measures time elapsed since worker last saw food
''I/O 7-X coordinate of last food sighting
''I/O 8-Y coordinate of last food sighting
''I/O 9-status timer-shows how long a decision by the queen lasts
''I/O 10-Hostility-Factor on which queen decides to attack or not

'''''
'VARS
'''''
''Young Queen-collects energy to form her own colony. Chance-1 in 1000
''Queen-spawns smaller ants
''Drone-Poisons enemies, collects nrg from workers & other species,
''relays back to queen. Chance-1 in 5
''Worker-Finds food, brings it back to queen, and shares location
''of food with other workers. Chance-1 in 2
''Scout-Moves quickly to pull in veggies. Chance-1 in 5
''Guard-Protects the queen and reports enemy raids. Chance-1 in 10

def youngqueen 0
def queen 1
def drone 2
def worker 3
def scout 4
def guard 5

''Default-Ants act normally
''Raid-Ants attempt to steal food from other hives
''Attack-Ants will attack other hives
''Report-A guard status of going back to the queen and reporting a theft

def default 0
def raid 10
def attack 20
def report 30

''''''''''''''''''''''''
'CUSTOM MEMORY LOCATIONS
''''''''''''''''''''''''
''Status-Influences behaviour of ants
''Hostility-How angry a hive is
''Temp-initialization purposes
''Type-The Ant's job in the colony
''Queenxpos and Queenypos-Queen's coordinates
''Dumpdist-The distance from the queen at which a scout should dump a veggie
''Hiveid-The id of the hive this ant belongs to
''Andrenaline-The amount of andrenaline a drone has
''Memtimer-The time elapsed since worker last saw food
''Foodxpos and Foodypos-the coordinates of the last seen food
def statustimer 987
def status 988
def hostility 989
def temp 990
def type 991
def queenxpos 992
def queenypos 993
def dumpdist 994
def hiveid 995
def andrenaline 996
def memtimer 997
def foodxpos 998
def foodypos 999

'Initialization
''What type of ant am I?
''Set eyes and conspec
cond
*.robage 0 =
start
1000 rnd .temp store
.youngqueen *.temp sgn -- abs .type mult store
.drone *.temp sgn .type mult store
.scout *.temp 200 sub sgn 0 floor .type mult store
.guard *.temp 400 sub sgn 0 floor .type mult store
.worker *.temp 500 sub sgn 0 floor .type mult store

1235 .out1 store

-436 .eye9dir store
-327 .eye8dir store
-218 .eye7dir store
-109 .eye6dir store
109 .eye4dir store
218 .eye3dir store
327 .eye2dir store
436 .eye1dir store
105 .eye1width store
105 .eye2width store
105 .eye3width store
105 .eye4width store
105 .eye5width store
105 .eye6width store
105 .eye7width store
105 .eye8width store
105 .eye9width store
stop

'First generation is always a queen
start
.youngqueen .type store
*.thisgene .delgene store
stop

'OCULUS
'Update bot
cond
start
*.hiveid .out4 store
*.andrenaline .out5 store
*.type .out2 store
*.memtimer .out6 store
*.foodxpos .out7 store
*.foodypos .out8 store
*.status .out3 store
*.statustimer .out9 store
*.hostility .out10 store
*.nrg 3 div *.body sub dup .strbody store - .fdbody store
-4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0

floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub

sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9

*.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
*.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor

mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub

sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6

sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2

*.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn

mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0

floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub

sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3

*.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
*.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn

mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub

sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5

sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7

*.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn

mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0

floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub

sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4

*.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
*.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn

mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub

sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3

sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add

.focuseye store

12 *.type .scout sub sgn abs -- abs 3 mult ++ mult *.vel sub .up store
*.type .queen sub sgn abs -- abs .fixpos store
*.tiepres .tienum store
500 rnd 1500 add .dumpdist *.type .scout sub sgn abs -- abs mult store
*.andrenaline *.venom sub .strvenom store
.andrenaline *.andrenaline sgn mult dec
.memtimer *.memtimer sgn mult dec
.statustimer *.statustimer sgn mult dec
-2 .venval store
.shoot .vloc store
.paralyzed .memloc store
stop

'I'm too small!!
cond
*.body 150 <
start
175 *.body sub .strbody store
stop

'Some idiot has tied to me!!
cond
*.numties 0 !=
*.type .scout !=
start
*.tiepres .deltie store
stop

'I am a guard and should only turn towards enemy conspecs
cond
 *.type .guard =
 *.eyef 0 !=
 *.refnrg 0 >
 *.in1 *.out1 =
 *.in4 *.hiveid != and
 *.in1 *.out1 !=
 *.nrg 1000 < and or
start
 *.refxpos *.refypos angle .setaim store
stop

'I am a drone and should turn towards workers and queens as well as ants of other hives
cond
*.eyef 0 !=
*.type .drone =
*.nrg 15000 <
*.in2 .scout !=
*.in1 *.out1 = and
*.in2 .youngqueen !=
*.in1 *.out1 = and and
*.in2 .drone !=
*.in1 *.out1 = and and
*.refnrg 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I'm a worker/young queen, no point turning towards conspecs
cond
*.eyef 0 !=
*.type .worker =
*.body 1000 < and
*.type .youngqueen = or
*.out1 *.in1 !=
*.refnrg 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I am a young queen and are big and fat, so I mature
cond
*.type .youngqueen =
*.body 10000 >
start
.fixpos inc
.queen .type store
*.xpos .queenxpos store
*.ypos .queenypos store
32000 rnd .hiveid store
stop

'I have no hive and you are a queen, I'll join yours
cond
*.queenxpos 0 =
*.queenypos 0 =
*.type .queen !=
*.type .youngqueen !=
*.in2 .queen =
start
*.refxpos .queenxpos store
*.refypos .queenypos store
*.in4 .hiveid store
stop

'Queen update cycle
''Turn so I can make more ants
''Make some shell so I don't die easily
''Randomly decide to raid another hive
cond
*.type .queen =
start
20 .aimdx store
*.nrg 20000 sub sgn 0 floor 5 mult .mkshell store
10000 rnd dup sgn -- abs .raid mult .status store .statustimer store
stop

''If another hive has stolen more than 10 times, attack.
''Attacks can last for up to 2500 cycles.
cond
 *.type .queen =
 *.hostility 10 >
start
 0 .hostility store
 .attack .status store
 2500 rnd .statustimer store
stop

'Read instructions from the queen
cond
 *.in1 *.out1 =
 *.in4 *.hiveid =
 *.in2 .queen =
 *.type .queen !=
 *.type .youngqueen !=
start
 *.in3 .status store
 *.in9 .statustimer store
stop

'Passive Drones and workers feed the queen
cond
*.in1 *.out1 =
*.in4 *.hiveid =
*.type .drone =
*.status .attack != and
*.type .worker = or
*.in2 .queen =
*.nrg 500 >
*.eye5 40 >
start
*.nrg 1500 sub 1000 ceil .shootval store
-2 .shoot store
*.refxpos .queenxpos store
*.refypos .queenypos store
stop

'The queen is dead, I am a huge drone sitting in her place, I think I'll become the new queen.
cond
*.type .drone =
*.queenxpos *.queenypos dist 15 <
*.in2 .queen !=
*.nrg 30000 >=
start
.fixpos inc
.queen .type store
stop

'Drones harvest food from workers to bring to the queen so workers can keep harvesting.
cond
*.hiveid *.in4 =
*.type .drone =
*.in2 .worker =
*.eye5 40 >
*.refnrg 1000 >
start
-1 .shoot store
stop

'I am a drone near a queen, but have no food, so I'll move away.
cond
*.in1 *.out1 =
*.in2 .queen =
*.type .drone =
*.nrg 500 <=
start
*.maxvel *.velup add .dn store
stop

'I am a huge Drone/Worker, better go and give some of that food I harvested to the Queen.
cond
*.type .drone =
*.nrg 15000 > and
*.type .worker =
*.body 2500 > and or
start
*.queenxpos *.queenypos angle .setaim store
stop

'Oooh, lots of food, let's share!
cond
*.type .worker =
*.in1 *.out1 !=
*.refnrg 20000 >
*.reffixed 0 =
start
10 .memtimer store
*.refxpos .foodxpos store
*.refypos .foodypos store
stop

'You know where food is, I'll remember where.
cond
*.type .worker =
*.in1 *.out1 =
*.in2 .worker =
*.in6 *.memtimer >
start
*.in6 .memtimer store
*.in7 .foodxpos store
*.in8 .foodypos store
stop

'Forget it.
cond
*.type .worker =
*.memtimer 0 =
*.foodxpos 0 !=
*.foodypos 0 !=
start
628 .aimdx store
*.maxvel *.veldn add .up store
0 .foodxpos store
0 .foodypos store
stop

'I see no food, but know where some is, so I'll go find it.
cond
*.type .worker =
*.memtimer 0 >
*.in1 *.out1 =
*.eyef 0 = or
start
*.foodxpos *.foodypos angle .setaim store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more.
''It's fixed, so it won't run away.
cond
*.type .scout =
*.numties 1 =
*.treffixed 0 !=
start
*.tiepres .deltie store
314 .aimdx store
20 .up store
stop

'I am a scout without cargo and see food, let's get it!
cond
*.type .scout =
*.numties 0 =
*.in1 *.out1 !=
*.reffixed 0 =
*.refnrg 0 >
*.eyef 0 >
start
*.refxpos *.refypos angle .setaim store
stop

'I am a scout without cargo and am close to food, so I'll tie to it.
''Only steal fixed food if I was told to raid.
cond
*.type .scout =
*.in1 *.out1 !=
*.nrg 0 >
*.eye5 40 >
*.reffixed 0 =
*.reffixed 0 !=
*.in4 *.hiveid != and
*.status .raid = and or
*.refshoot 0 =
*.numties 0 =
start
.tie inc
stop

'I am a scout with cargo, better bring it back so the others can eat it.
''Might as well take some of the spoils myself so the load isn't as heavy.
''I'll mark this food as our own.
cond
*.type .scout =
*.numties 1 =
start
*.queenxpos *.queenypos angle .setaim store
40 .sharenrg store
1 .sharewaste store
.out4 .tieloc store
*.hiveid .tieval store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more.
''Let's fix it in place so it doesn't run away.
cond
*.type .scout =
*.numties 1 =
*.queenxpos *.queenypos dist *.dumpdist <
start
.fixpos .tieloc store
.tieval inc
stop

'I'm not a scout and I see food, let's eat it!
''If the veggie is part of out garden eg a scout pulled it in, to not kill it.
''If it's an enemy, I am a drone, and we were told to attack, do so.
cond
*.eye5 40 >
*.out1 *.in1 !=
*.out1 *.in1 =
*.in4 *.hiveid != and
*.type .drone = and
*.status .attack = and or
*.type .scout !=
*.reffixed 0 =
*.refnrg 0 > and
*.reffixed 0 >
*.refbody 1000 > and or
start
-6 .shoot store
stop

cond
 *.eye5 40 >
 *.out1 *.in1 !=
 *.type .scout !=
 *.reffixed 0 !=
 *.body 1000 <=
 *.nrg 10000 >
start
 -1 .shoot store
stop

'I am a scout/guard, but am too close to the queen, so I'll move away
cond
*.type .scout =
*.type .guard =
*.status .report != and or
*.queenxpos *.queenypos dist 500 <
*.queenxpos *.queenypos angle *.aim %=
start
*.maxvel *.velsx add .dx store
stop

'I am a guard, but am too far away from the hive, I'll turn so I stay within the boundary
cond
 *.type .guard =
 *.queenxpos *.queenypos dist 2000 >
start
 *.queenxpos *.queenypos angle 50 rnd 175 add add .setaim store
stop

'Timer runs out, time to forget what the queen told us.
cond
 *.statustimer 0 =
 *.status .attack =
 *.status .raid = or
start
 .default .status store
stop

'I am a guard and someone's stealing our food, I'll report it to the queen
cond
 *.type .guard =
 *.in1 *.out1 =
 *.in4 *.hiveid !=
 *.in3 .raid =
start
 .report .status store
stop

'I'm reporting a theft
''Step 1-go to the queen
cond
 *.type .guard =
 *.status .report =
start
 *.queenxpos *.queenypos angle .setaim store
 25 .up store
stop

'I'm reporting a theft
''Step 2-tell the queen
cond
 *.type .guard =
 *.status .report =
 *.eyef 40 >
 *.in1 *.out1 =
 *.in4 *.hiveid =
 *.in2 .queen =
start
 *.in10 ++ .shootval store
 .hostility .shoot store
 .default .status store
stop

'I am a drone under attack, take countermeasures
''Part 1:If attacked, make andrenaline.
cond
*.type .drone =
*.shflav -1 =
*.shflav -6 = or
start
*.andrenaline 5 add .andrenaline store
*.shang .setaim store
0 .shflav store
stop

''Part 2:If venom is stored due to andrenaline, spit it at the enemy.
cond
*.eye5 40 >
*.out1 *.in1 !=
*.type .drone =
*.refshoot 0 >
*.venom 0 >
*.memval 0 !=
start
*.venom .shootval store
-3 .shoot store
stop

''Part 3:You're angry, so I'll be as angry as you.
cond
*.in1 *.out1 =
*.in2 .drone =
*.type .drone =
*.in5 *.andrenaline >
start
*.in5 .andrenaline store
stop

'I should really evolve a toilet...
cond
*.waste 200 >
start
*.waste .shootval store
-4 .shoot store
stop

'I am a Queen, so I should really make a colony
cond
*.type .queen =
*.nrg 5000 >
start
5 .repro store
stop

43
Evolution and Internet Sharing Sims / Controlled Evolution
« on: April 30, 2008, 08:29:49 PM »
I had an interesting idea today: Given lots of variables that are randomly stored at birth, could you make a bot that forcibly evolves itself without resulting in useless/detrimental mutations? The trick would somehow be to slow down mutation once ideal conditions have been reached.

44
Bot Tavern / The amazing Antbot
« on: April 30, 2008, 08:05:52 PM »
Recently I've been working on a bot that acts like a colony of ants. In the beginning, a single young queen gathers food, until she is large and bloated. Then, she sits down and starts producing offspring. The offspring can either be another young queen or one of the following servants:
  • Scout-A scout looks for veggies, then ties to them and drags them in. Once near the queen, the veggie is tied in place.
  • Worker-A worker communicates with other workers to find food sources, which are relayed back to the queen.
  • Drone-The real muscle of the hive. They collect food from workers and nearby food sources, and relay nrg back to the queen. As well as that, they produce adrenaline when attacked, which is converted to venom, and spat out at enemy bots.
Here are some cool features that have been implemented in the bot:
  • Gardening-A veggie dragged in by a scout is harvested, but not killed. This ensures a steady food supply for when food is hard to come by.
  • Workers remember when they see food, and tell other workers about it.
  • Drones tell other drones when an enemy is nearby by sharing adrenaline levels.
  • The queen has fertility cycles eg. the body has to be greater than *.timer in order to reproduce
  • Drones don't interfer with bots from a different hive.

I still have a communication channel open that I'm dying to use. I really need some help to figure out what to do with it.

45
Interesting behaviour bots / Antbot v1.3
« on: April 30, 2008, 07:33:48 PM »
This version is mainly tweaking of core functions, especially the problem that the hive is overcrowded and the queen can't reproduce. The veggies dragged in by the scouts are not killed, but cultivated eg. only attacked if body > 1000.

'Antbot v1.3
''A hivebot by Bacillus

'''''''''''''
'I/O CHANNELS
'''''''''''''
''I/O 1-species conspec
''I/O 2-type recognition
''I/O 3-reserved for communication
''I/O 4-hive conspec
''I/O 5-andrenaline level
''I/O 6-food timer-measures time elapsed since worker last saw food
''I/O 7-X coordinate of last food sighting
''I/O 8-Y coordinate of last food sighting

'''''
'VARS
'''''
''Young Queen-collects energy to form her own colony
''Queen-spawns smaller ants
''Drone-Poisons enemies, collects nrg from workers & other species,
''relays back to queen
''Worker-Finds food, brings it back to queen, and shares location
''of food with other workers
''Scout-Moves quickly to pull in veggies

def youngqueen 0
def queen 1
def drone 2
def worker 3
def scout 4

''''''''''''''''''''''''
'CUSTOM MEMORY LOCATIONS
''''''''''''''''''''''''
''Temp-initialization purposes
''Type-The Ant's job in the colony
''Queenxpos and Queenypos-Queen's coordinates
''Dumpdist-The distance from the queen at which a scout should dump a veggie
''Hiveid-The id of the hive this ant belongs to
''Andrenaline-The amount of andrenaline a drone has
''Memtimer-The time elapsed since worker last saw food
''Foodxpos and Foodypos-the coordinates of the last seen food
def temp 990
def type 991
def queenxpos 992
def queenypos 993
def dumpdist 994
def hiveid 995
def andrenaline 996
def memtimer 997
def foodxpos 998
def foodypos 999

'Initialization
''What type of ant am I?
''Set eyes and conspec
cond
 *.robage 0 =
start
 1000 rnd .temp store
 .youngqueen *.temp sgn -- abs .type mult store
 .drone *.temp sgn .type mult store
 .scout *.temp 200 sub sgn 0 floor .type mult store
 .worker *.temp 300 sub sgn 0 floor .type mult store

 1235 .out1 store

 -436 .eye9dir store
 -327 .eye8dir store
 -218 .eye7dir store
 -109 .eye6dir store
  109 .eye4dir store
  218 .eye3dir store
  327 .eye2dir store
  436 .eye1dir store
 105 .eye1width store
 105 .eye2width store
 105 .eye3width store
 105 .eye4width store
 105 .eye5width store
 105 .eye6width store
 105 .eye7width store
 105 .eye8width store
 105 .eye9width store
stop

'First generation is always a queen
start
 *.thisgene .delgene store
 .youngqueen .type store
stop

'OCULUS
'Update bot
cond
start
 *.hiveid .out4 store
 *.andrenaline .out5 store
 *.type .out2 store
 *.memtimer .out6 store
 *.foodxpos .out7 store
 *.foodypos .out8 store
 *.nrg 3 div *.body sub dup .strbody store - .fdbody store
 -4 *.eye1 *.eye9 sub sgn 0 floor mult *.eye1 *.eye8 sub sgn 0 floor mult *.eye1 *.eye7 sub sgn 0    

floor mult *.eye1 *.eye6 sub sgn 0 floor mult *.eye1 *.eye5 sub sgn 0 floor mult *.eye1 *.eye4 sub  

sgn 0 floor mult *.eye1 *.eye3 sub sgn 0 floor mult *.eye1 *.eye2 sub sgn 0 floor mult 4 *.eye9    

*.eye8 sub sgn 0 floor mult *.eye9 *.eye7 sub sgn 0 floor mult *.eye9 *.eye6 sub sgn 0 floor mult
 *.eye9 *.eye5 sub sgn 0 floor mult *.eye9 *.eye4 sub sgn 0 floor mult *.eye9 *.eye3 sub sgn 0 floor

 mult *.eye9 *.eye2 sub sgn 0 floor mult *.eye9 *.eye1 sub sgn ++ sgn mult add -3 *.eye2 *.eye9 sub  

 sgn ++ sgn mult *.eye2 *.eye8 sub sgn 0 floor mult *.eye2 *.eye7 sub sgn 0 floor mult *.eye2 *.eye6

 sub sgn 0 floor mult *.eye2 *.eye5 sub sgn 0 floor mult *.eye2 *.eye4 sub sgn 0 floor mult *.eye2  

 *.eye3 sub sgn 0 floor mult *.eye2 *.eye1 sub sgn ++ sgn mult add 3 *.eye8 *.eye9 sub sgn ++ sgn    

 mult *.eye8 *.eye7 sub sgn 0 floor mult *.eye8 *.eye6 sub sgn 0 floor mult *.eye8 *.eye5 sub sgn 0  

 floor mult *.eye8 *.eye4 sub sgn 0 floor mult *.eye8 *.eye3 sub sgn 0 floor mult *.eye8 *.eye2 sub  

 sgn ++ sgn mult *.eye8 *.eye1 sub sgn ++ sgn mult add -2 *.eye3 *.eye9 sub sgn ++ sgn mult *.eye3  

 *.eye8 sub sgn ++ sgn mult *.eye3 *.eye7 sub sgn 0 floor mult *.eye3 *.eye6 sub sgn 0 floor mult
 *.eye3 *.eye5 sub sgn 0 floor mult *.eye3 *.eye4 sub sgn 0 floor mult *.eye3 *.eye2 sub sgn ++ sgn  

 mult *.eye3 *.eye1 sub sgn ++ sgn mult add 2 *.eye7 *.eye9 sub sgn ++ sgn mult *.eye7 *.eye8 sub    

 sgn ++ sgn mult *.eye7 *.eye7 sub sgn 0 floor mult *.eye7 *.eye6 sub sgn 0 floor mult *.eye7 *.eye5

 sub sgn 0 floor mult *.eye7 *.eye4 sub sgn ++ sgn mult *.eye7 *.eye2 sub sgn ++ sgn mult *.eye7    

*.eye1 sub sgn ++ sgn mult add -1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn    

mult *.eye4 *.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn 0 floor mult *.eye4 *.eye5 sub sgn 0    

floor mult *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub    

sgn ++ sgn mult add 1 *.eye4 *.eye9 sub sgn ++ sgn mult *.eye4 *.eye8 sub sgn ++ sgn mult *.eye4    

*.eye7 sub sgn ++ sgn mult *.eye4 *.eye6 sub sgn ++ sgn mult *.eye4 *.eye5 sub sgn 0 floor mult
 *.eye4 *.eye3 sub sgn ++ sgn mult *.eye4 *.eye2 sub sgn ++ sgn mult *.eye4 *.eye1 sub sgn ++ sgn    

 mult add 0 *.eye5 *.eye9 sub sgn ++ sgn mult *.eye5 *.eye8 sub sgn ++ sgn mult *.eye5 *.eye7 sub    

 sgn ++ sgn mult *.eye5 *.eye6 sub sgn ++ sgn mult *.eye5 *.eye4 sub sgn ++ sgn mult *.eye5 *.eye3  

sub sgn ++ sgn mult *.eye5 *.eye2 sub sgn ++ sgn mult *.eye5 *.eye1 sub sgn ++ sgn mult add

.focuseye store

 12 *.type .scout sub sgn abs -- abs 3 mult ++ mult *.vel sub .up store
 *.type .queen sub sgn abs -- abs .fixpos store
 *.tiepres .tienum store
 500 rnd 1500 add .dumpdist *.type .scout sub sgn abs -- abs mult store
 *.andrenaline *.venom sub .strvenom store
 .andrenaline *.andrenaline sgn mult dec
 .memtimer *.memtimer sgn mult dec
 -2 .venval store
 .shoot .vloc store
 .paralyzed .memloc store
stop

'I'm too small!!
cond
 *.body 150 <
start
 175 *.body sub .strbody store
stop

'Some idiot has tied to me!!
cond
 *.numties 0 !=
 *.type .scout !=
start
 *.tiepres .deltie store
stop

'I am a drone and should turn towards workers and queens
cond
 *.eyef 0 !=
 *.type .drone =
 *.nrg 15000 <
 *.in2 .scout !=
 *.in2 .youngqueen !=
 *.in1 *.out1 = and
 *.in2 .drone !=
start
 *.refxpos *.refypos angle .setaim store
stop

'I'm a worker/young queen, no point turning towards conspecs
cond
 *.eyef 0 !=
 *.type .worker =
 *.body 1000 < and
 *.type .youngqueen = or
 *.out1 *.in1 !=
start
 *.refxpos *.refypos angle .setaim store
stop

'I am a young queen and are big and fat, so I mature
cond
 *.type .youngqueen =
 *.body 10000 >
start
 .fixpos inc
 .queen .type store
 *.xpos .queenxpos store
 *.ypos .queenypos store
 32000 rnd .hiveid store
stop

'I have no hive and you are a queen, I'll join yours
cond
 *.queenxpos 0 =
 *.queenypos 0 =
 *.type .queen !=
 *.type .youngqueen !=
 *.in2 .queen =
start
 *.refxpos .queenxpos store
 *.refypos .queenypos store
 *.in4 .hiveid store
stop

'Mature queens turn so there's enough reproduction space.
cond
 *.type .queen =
start
 20 .aimdx store
 50 *.shell sub .mkshell store
stop

'Drones and workers feed the queen
cond
 *.in1 *.out1 =
 *.in4 *.hiveid =
 *.type .drone =
 *.type .worker = or
 *.in2 .queen =
 *.nrg 500 >
 *.eye5 40 >
start
 *.nrg 1500 sub 1000 ceil .shootval store
 -2 .shoot store
stop

'The queen is dead, I am a huge drone sitting in her place, I think I'll become the new queen.
cond
 *.type .drone =
 *.queenxpos *.queenypos dist 15 <
 *.in2 .queen !=
 *.nrg 30000 >=
start
 .fixpos inc
 .queen .type store
stop

'Drones harvest food from workers to bring to the queen so workers can keep harvesting.
cond
 *.hiveid *.in4 =
 *.type .drone =
 *.in2 .worker =
 *.eye5 40 >
 *.refnrg 1000 >
start
 -1 .shoot store
stop

'I am a drone near a queen, but have no food, so I'll move away.
cond
 *.in1 *.out1 =
 *.in2 .queen =
 *.type .drone =
 *.nrg 500 <=
start
 *.maxvel *.velup add .dn store
stop

'I am a huge Drone/Worker, better go and give some of that food I harvested to the Queen.
cond
 *.type .drone =
 *.nrg 15000 > and
 *.type .worker =
 *.body 2500 > and or
start
 *.queenxpos *.queenypos angle .setaim store
stop

'Oooh, lots of food, let's share!
cond
 *.type .worker =
 *.in1 *.out1 !=
 *.refnrg 20000 >
 *.reffixed 0 =
start
 10 .memtimer store
 *.refxpos .foodxpos store
 *.refypos .foodypos store
stop

'You know where food is, I'll remember where.
cond
 *.type .worker =
 *.in1 *.out1 =
 *.in2 .worker =
 *.in6 *.memtimer >
start
 *.in6 .memtimer store
 *.in7 .foodxpos store
 *.in8 .foodypos store
stop

'Forget it.
cond
 *.type .worker =
 *.memtimer 0 =
 *.foodxpos 0 !=
 *.foodypos 0 !=
start
 628 .aimdx store
 *.maxvel *.veldn add .up store
 0 .foodxpos store
 0 .foodypos store
stop

'I see no food, but know where some is, so I'll go find it.
cond
 *.type .worker =
 *.memtimer 0 >
 *.in1 *.out1 =
 *.eyef 0 = or
start
 *.foodxpos *.foodypos angle .setaim store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more.
''It's fixed, so it won't run away.
cond
 *.type .scout =
 *.numties 1 =
 *.treffixed 0 !=
start
 *.tiepres .deltie store
 314 .aimdx store
 20 .up store
stop

'I am a scout without cargo and see food, let's get it!
cond
 *.type .scout =
 *.numties 0 =
 *.in1 *.out1 !=
 *.reffixed 0 =
 *.nrg 0 >
 *.eyef 0 >
start
 *.refxpos *.refypos angle .setaim store
stop

'I am a scout without cargo and am close to food, so I'll tie to it.
cond
 *.type .scout =
 *.in1 *.out1 !=
 *.nrg 0 >
 *.eye5 40 >
 *.reffixed 0 =
 *.refshoot 0 =
 *.numties 0 =
start
 .tie inc
stop

'I am a scout with cargo, better bring it back so the others can eat it.
''Might as well take some of the spoils myself so the load isn't as heavy.
cond
 *.type .scout =
 *.numties 1 =
start
 *.queenxpos *.queenypos angle .setaim store
 40 .sharenrg store
 1 .sharewaste store
stop

'I am a scout and my cargo is near the queen, I'll dump it and go find some more
''Let's fix it in place so it doesn't run away.
cond
 *.type .scout =
 *.numties 1 =
 *.queenxpos *.queenypos dist *.dumpdist <
start
 .fixpos .tieloc store
 .tieval inc
stop

'I'm not a scout and I see food, let's eat it!
''If the veggie is part of out garden eg a scout pulled it in, to not kill it
cond
 *.eye5 40 >
 *.out1 *.in1 !=
 *.type .scout !=
 *.reffixed 0 =
 *.reffixed 0 >
 *.refbody 1000 > and or
start
 -6 .shoot store
stop

'I am a scout, but am too close to the queen, so I'll move away
cond
 *.type .scout =
 *.queenxpos *.queenypos dist 500 <
 *.queenxpos *.queenypos angle *.aim %=
start
 *.maxvel *.velsx add .dx store
stop

'I am a drone under attack, take countermeasures
''Part 1:If attacked, make andrenaline.
cond
 *.type .drone =
 *.shflav -1 =
 *.shflav -6 = or
start
 *.andrenaline 5 add .andrenaline store
 *.shang .setaim store
 0 .shflav store
stop

''Part 2:If venom is stored due to andrenaline, spit it at the enemy.
cond
 *.eye5 40 >
 *.out1 *.in1 !=
 *.type .drone =
 *.refshoot 0 >
 *.venom 0 >
 *.memval 0 !=
start
 *.venom .shootval store
 -3 .shoot store
stop

''Part 3:You're angry, so I'll be as angry as you.
cond
 *.in1 *.out1 =
 *.in2 .drone =
 *.type .drone =
 *.in5 *.andrenaline >
start
 *.in5 .andrenaline store
stop

'I should really evolve a toilet...
cond
 *.waste 200 >
start
 *.waste .shootval store
 -4 .shoot store
stop

'I am a Queen, so I should really make a colony
cond
 *.type .queen =
 *.nrg 5000 >
start
 5 .repro store
stop

Pages: 1 2 [3] 4 5 6