Author Topic: Republican Bee (F2)(Commander Keen)(25-05-2008)  (Read 5137 times)

Offline Commander Keen

  • Bot Builder
  • **
  • Posts: 91
    • View Profile
Republican Bee (F2)(Commander Keen)(25-05-2008)
« on: May 24, 2008, 09:24:46 PM »
Updated Version
Code: [Select]
' It's a Republican Bee!
' Named after the Republican Bees in Discworld
' Swarm 1Beta
' By Commander Keen
' 23rd September 2008
'
' Good points:
' Takes control of the center of the map
' Shooting based on shell/poison
' Can spin while moving
'
' Bad points:
' Only reproduces in center
' Doesn't use all eyes all the time
' Doesn't use slime (shouldn't need it too much for F2 anyway, could implement in next version)
'
' Updated Conspec

def cx 971
def cy 972
def feeding 50
def badarea 51
def enemy 55

cond
*.cx 0 =
*.cy 0 =
start
4619 .cx store
3464 .cy store
.delgene inc
stop

cond
*.robage 0 =
start
140 .eye6width store
280 .eye7width store
280 .eye8width store
280 .eye9width store
-68 .eye1dir store
-68 .eye2dir store
-68 .eye3dir store
-68 .eye4dir store
-68 .eye5dir store
-140 .eye6dir store
317 .eye7dir store
634 .eye8dir store
970 .eye9dir store
-2 .focuseye store
.shoot .ploc store
.tie inc
stop

cond
1 1 =
start
*.nrg 10 div *.body add *.poison sub 0 floor .strpoison store
500 *.shell sub 0 floor .mkshell store
*.nrg *.body 10 mult add 20 div *.body sub 1 floor .strbody store
*.body *.nrg *.body 10 mult add 20 div sub 0 floor 30000 *.nrg sub 10 div ceil  .fdbody store
*.tiepres .deltie store
*.pleas *.feeding add dup 10 div sub 1 sub 0 floor .feeding store
*.xpos 2 div *.cx >
*.xpos 2 div .cx store
clearbool
*.ypos 2 div *.cy >
*.ypos 2 div .cy store
clearbool
*.refshoot *.myshoot sub *.refaimdx *.myaimdx sub *.refaimsx *.myaimsx sub *.refeye *.myeye sub *.refup *.myup sub *.refdn *.mydn sub *.refsx *.mysx sub *.refdx *.mydx sub abs add abs add abs add abs add abs add abs add abs add abs .enemy store
*.enemy 1 =
0 .enemy store
clearbool
stop

cond
*.eye1 *.eye2 *.eye3 *.eye4 *.eye5 *.eye6 *.eye7 *.eye8 *.eye9 add add add add add add add add 0 =
*.enemy 0 = or
*.badarea 16 >=
start
1 *.timer 8 mod sgn sub 10 mult .up store
1 *.timer 2 add 8 mod sgn sub 10 mult .dx store
1 *.timer 4 add 8 mod sgn sub 10 mult .dn store
1 *.timer 6 add 8 mod sgn sub 10 mult .sx store
stop

cond
*.eye1 *.eye2 *.eye3 *.eye4 *.eye5 add add add add 0 =
*.enemy 0 = or
start
157 .aimdx store
.badarea inc
stop

cond
*.eye3 0 =
*.eye4 0 !=
start
34 .aimdx store
stop
cond
*.eye3 0 =
*.eye2 0 !=
start
-34 .aimdx store
stop
cond
*.eye3 0 =
*.eye5 0 !=
start
68 .aimdx store
stop
cond
*.eye3 0 =
*.eye1 0 !=
start
-68 .aimdx store
stop

cond
*.eyef 0 !=
*.enemy 0 !=
start
'1 *.refshell sgn sub -5 mult 1 sub .shoot store
-6 5 *.refshell sgn mult add *.refshell *.refpoison mult sgn 5 mult sub .shoot store
*.velsx .dx store
128 *.eyef sub *.velup sub *.veldn 2 div floor *.refvelup add .up store
*.refxpos *.refypos angle .setaim store
0 .badarea store
stop

cond
*.xpos *.cx %=
*.ypos *.cy %=
*.nrg *.body 10 mult add 10000 >
start
50 .repro store
stop

cond
*.nrg *.body 10 mult add *.totalmyspecies 1000 mult 10000 add 1000 100 mult ceil >
*.pleas 0 floor 0 =
*.feeding 0 =
start
0 .aimdx store
*.cx *.cy angle 628 add 1256 mod .setaim store
'0 *.maxvel *.veldn sub *.cx *.cy dist *.veldn sub ceil sub .up store
0 *.maxvel *.veldn sub sub .up store
*.velsx .dx store
0 .shoot store
stop

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

cond
*.nrg *.body 10 mult add *.totalmyspecies 1000 mult 10000 add 1000 100 mult ceil <
*.badarea 64 >=
start
*.timer 4 add 8 mod 0 =
*.maxvel *.veldn sub .dn store
*.timer 8 mod 0 =
0 *.maxvel *.velup sub sub .dn store
clearbool
stop
Old Version:
[div class=\'codetop\']CODE[div class=\'codemain\' style=\'height:200px;white-space:pre;overflow:auto\']' It's a Republican Bee!
' Named after the Republican Bees in Discworld
' Swarm 1Alpha
' By Commander Keen
' 22nd May 2008
'
' Good points:
' Takes control of the center of the map
' Shooting based on shell/poison
' Can spin while moving
'
' Bad points:
' Only reproduces in center
' Doesn't use all eyes all the time
' Doesn't use slime (shouldn't need it too much for F2 anyway, could implement in next version)
' Conspec pretty easy to fool

def cx 971
def cy 972
def feeding 50
def badarea 51

cond
*.cx 0 =
*.cy 0 =
start
4619 .cx store
3464 .cy store
.delgene inc
stop

cond
*.robage 0 =
start
140 .eye6width store
280 .eye7width store
280 .eye8width store
280 .eye9width store
-68 .eye1dir store
-68 .eye2dir store
-68 .eye3dir store
-68 .eye4dir store
-68 .eye5dir store
-140 .eye6dir store
317 .eye7dir store
634 .eye8dir store
970 .eye9dir store
-2 .focuseye store
.shoot .ploc store
.tie inc
stop

cond
1 1 =
start
*.nrg 10 div *.body add *.poison sub 0 floor .strpoison store
500 *.shell sub 0 floor .mkshell store
*.nrg *.body 10 mult add 20 div *.body sub 1 floor .strbody store
*.body *.nrg *.body 10 mult add 20 div sub 0 floor 30000 *.nrg sub 10 div ceil  .fdbody store
*.tiepres .deltie store
*.pleas *.feeding add dup 10 div sub 1 sub 0 floor .feeding store
*.xpos 2 div *.cx >
*.xpos 2 div .cx store
clearbool
*.ypos 2 div *.cy >
*.ypos 2 div .cy store
clearbool
stop

cond
*.eye1 *.eye2 *.eye3 *.eye4 *.eye5 *.eye6 *.eye7 *.eye8 *.eye9 add add add add add add add add 0 =
*.myaimdx *.refaimdx = or
*.badarea 16 >=
start
1 *.timer 8 mod sgn sub 10 mult .up store
1 *.timer 2 add 8 mod sgn sub 10 mult .dx store
1 *.timer 4 add 8 mod sgn sub 10 mult .dn store
1 *.timer 6 add 8 mod sgn sub 10 mult .sx store
stop

cond
*.eye1 *.eye2 *.eye3 *.eye4 *.eye5 add add add add 0 =
*.myaimdx *.refaimdx = or
start
157 .aimdx store
.badarea inc
stop

cond
*.eye3 0 =
*.eye4 0 !=
start
34 .aimdx store
stop
cond
*.eye3 0 =
*.eye2 0 !=
start
-34 .aimdx store
stop
cond
*.eye3 0 =
*.eye5 0 !=
start
68 .aimdx store
stop
cond
*.eye3 0 =
*.eye1 0 !=
start
-68 .aimdx store
stop

cond
*.eyef 0 !=
*.myaimdx *.refaimdx !=
start
'1 *.refshell sgn sub -5 mult 1 sub .shoot store
-6 5 *.refshell sgn mult add *.refshell *.refpoison mult sgn 5 mult sub .shoot store
*.velsx .dx store
128 *.eyef sub *.velup sub *.veldn 2 div floor *.refvelup add .up store
*.refxpos *.refypos angle .setaim store
0 .badarea store
stop

cond
*.xpos *.cx %=
*.ypos *.cy %=
*.nrg *.body 10 mult add 10000 >
start
50 .repro store
stop

cond
*.nrg *.body 10 mult add *.totalmyspecies 1000 mult 10000 add 1000 100 mult ceil >
*.pleas 0 floor 0 =
*.feeding 0 =
start
0 .aimdx store
*.cx *.cy angle 628 add 1256 mod .setaim store
'0 *.maxvel *.veldn sub *.cx *.cy dist *.veldn sub ceil sub .up store
0 *.maxvel *.veldn sub sub .up store
*.velsx .dx store
0 .shoot store
stop

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

cond
*.nrg *.body 10 mult add *.totalmyspecies 1000 mult 10000 add 1000 100 mult ceil <
*.badarea 64 >=
start
*.timer 4 add 8 mod 0 =
*.maxvel *.veldn sub .dn store
*.timer 8 mod 0 =
0 *.maxvel *.velup sub sub .dn store
clearbool
stop
« Last Edit: May 27, 2011, 07:21:32 PM by Panda »

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #1 on: May 25, 2008, 12:31:40 AM »
Very nice bot! I put it in with eveything I had, plankton kinetic was the veggie and it had no problems. Nice work.

Offline Commander Keen

  • Bot Builder
  • **
  • Posts: 91
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #2 on: May 25, 2008, 05:43:28 PM »
It's quite good on massive field sizes as well, even with only a few veggies. Wouldn't be any good in IM though, since it uses field sizes. It would be really handy if field dimensions could be accessed in sysvars...

Offline gymsum

  • Bot Destroyer
  • ***
  • Posts: 215
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #3 on: May 25, 2008, 08:18:55 PM »
I ran the bot for 7 continuous hours; the charts showed your bot went to 10 bots and stayed there for whatever reason, then mass produced into a giant swarm and went from 1500 to 0 in 135 cycles; at the same time the raper bot finally shot from 245 to 2300. It was ran with mutations but at very very low rates, also only point mutation and insertion. According to the chart scale it happened within the last 30 minutes of simulation; nice bot.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #4 on: May 26, 2008, 07:40:24 PM »
Quote from: Commander Keen
It's quite good on massive field sizes as well, even with only a few veggies. Wouldn't be any good in IM though, since it uses field sizes. It would be really handy if field dimensions could be accessed in sysvars...
It should be possible for a smart bot to determine the field size for fields larger than size 4 by thrusting horizontally a specific amount and measuring the resultant change in xpos...

I could easily add the appropriate fieldsize sysvars, but it would go against the principle of locality.  I.e. that bots should only have access to local information and that if they want to know global sim settings, they need to figure them out for themselves.  We do have maxvel though although it should not be hard for a bot to determime that for itself as well.  Personally I'd like to do away with it.  That would leave only xpos, ypos and the asscoiated refvars in violation.  I can kind of justify xpos, ypos as a substitute for long-range vision e.g. seeing mountains in the distance, etc.  Call it a poor man's way for bots to rendevuez.  But I wouldn't miss them if they went away.

The refxpos, refypos and trefvars don't bother me so much since they can only be accessed when close.  Said another way, we could make them relative to the viewing/tied bot instead of absolute without any real loss of capability.  They onyl violate the principle in that they help the bot figure out it's own absolute position.   Angle and dist would still work just fine if we made them relative.  Since maxvel can be easily calculated by the bot itself, it's really only xpos and ypos that violate the principle of locality.  Do away with them and make the refvars relative and we woudl be clean...



Many beers....

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #5 on: May 27, 2008, 03:51:18 AM »
Interesting... a colony should ideally form in center to avoid unwanted wraparounds...  
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Trafalgar

  • Bot Destroyer
  • ***
  • Posts: 122
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #6 on: May 27, 2008, 12:27:58 PM »
Quote from: EricL
It should be possible for a smart bot to determine the field size for fields larger than size 4 by thrusting horizontally a specific amount and measuring the resultant change in xpos...

It'd be easier and probably smarter to just check something like dist(xpos+1000, ypos) and see what comes out. Since the return value of dist is scaled down when the field size is larger than 4, you can easily enough determine the scaling factor, and from that, knowing the size of a size 4 field, determine the actual size of the current field.

Offline EricL

  • Administrator
  • Bot God
  • *****
  • Posts: 2266
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #7 on: May 27, 2008, 12:32:20 PM »
Quote from: Trafalgar
It'd be easier and probably smarter to just check something like dist(xpos+1000, ypos) and see what comes out.

Ooh, yes.  Very smart.
Many beers....

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #8 on: May 28, 2008, 01:06:34 AM »
I  move to (0,0) and measure once the bot jerks more than is possible.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Commander Keen

  • Bot Builder
  • **
  • Posts: 91
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #9 on: May 28, 2008, 04:18:27 AM »
That doesn't work on non-wraparound sims, and it also means bots waste time heading to 0,0.

Next step: make a bot that hides in the corners and runs off to the other side of the map to escape...

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #10 on: May 29, 2008, 12:49:43 AM »
Good point, but I have found no other way so far.
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline bacillus

  • Bot Overlord
  • ****
  • Posts: 907
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #11 on: July 22, 2008, 08:25:17 AM »
Fort Zero-Zero, the corner squatter, now there's a bot pointless enough for me to make!
"They laughed at Columbus, they laughed at Fulton, they laughed at the Wright brothers. But they also laughed at Bozo the Clown."
- Carl Sagan

Offline Commander Keen

  • Bot Builder
  • **
  • Posts: 91
    • View Profile
Republican Bee (F2)(Commander Keen)
« Reply #12 on: September 22, 2008, 09:18:40 PM »
Very minor update, just adjusted the conspec.

Also note that for some reason it doesn't always work out and produce a 0 for conspecs, which is why there's the line which sets it to 0 if it is 1. Might be a bug somewhere causing this, might not.