Bots and Simulations > F1 bots

Cheddarmold(F1)(Spork22)9-22-2015

(1/2) > >>

spork22:
Well, I tried to make a bot by scratch (or, well, it had more scratch genes than copied ones  :D )and evaluate it. I became much happier with the evolved version of it, so I think that'll be the official one. Anyways, I did an ant-bot with queens selected through meritocracy. It's simply based upon the amount of kills a bot has:

-If you've killed nobody, find someone who has killed something and stick to them for dear life!

-If you have killed someone, sit there and get nudged about by your little friends.

-If you find someone who has killed the same amount of bots as you, fight to the death.

-If you've killed a bot, but someone else has killed more, sacrifice yourself to the true queen!

The worker bots will cluster around the queen and occasionally look away so that they can spot any threats that are way too close.

The best part is, they don't rely on coordinates, so there's a much higher chance that multiple hives will form.

So far, the only way they search for food is by nudging the hive around or just drifting around.

Let me know what you think, guys.


Edit: Also, give it less energy,  3000 should do the trick.

spike43884:
Use the # icon To put the code into a post!

--- Code: ---LIKE THIS!
--- End code ---

Its quite an interesting behavior though, nice use of killcounting.

If you want to make it so the higher kill counters actually control the movement of the lower kill counters (the workers) then use a couple of genes from this for MB communication and some of the normal movement genes. It basically says, if the queen see's food, follow the queen, otherwise just do your own thing nearby the queen.

--- Code: ---'Russian Babies (F1 League)
'By Spike43884
'Originally All Eyes V1.5
'This bot goes into hibernation whilest waiting
'Should reproduce in the face of danger...or food
'Dev Info:
'Hibernation Sys - TRUE
'Hunting Sys - AllEyes
'Corpsify - UNKNOWN
'Confusion - TRUE
'Retaliation Type - Babies


'Just some free variables
def attack 50
def hibernate 51
def head 52
def maxlen 53
def minlen 54

'Initilisation (TIELENX)
start
500 .maxlen *.maxlen 500 sub sgn 1 add mult store
stop

cond
*.tielenx *.maxlen >
start
*.tinlenx 10 add *.tielenx store
stop

or

def minlen 50
def maxlen 500

cond
*.tielenx .maxlen >
start
*.tielenx 10 sub .tielenx store
stop



'Initialisation (EYES)
cond
*.robage 2 <
start
 135 .eye1width store
 135 .eye2width store
 135 .eye3width store
 135 .eye4width store
 15 .eye5width store
 135 .eye6width store
 135 .eye7width store
 135 .eye8width store
 135 .eye9width store
 410 .eye1dir store
 300 .eye2dir store
 190 .eye3dir store
 80 .eye4dir store
 0 .eye5dir store
 -80 .eye6dir store
 -190 .eye7dir store
 -300 .eye8dir store
 -410 .eye9dir store
 .aimsx .vloc store
 128 .venval store
stop



' Gene 1 Initiate Hibernation (waiting)
cond
*.eye1 0 =
 *.eye2 0 = and
 *.eye3 0 = and
 *.eye4 0 = and
 *.eye5 0 = and
 *.eye6 0 = and
 *.eye7 0 = and
 *.eye8 0 = and
 *.eye9 0 = and
 *.refeye *.myeye = or
 *.nrg 3000 < and
 *.hibernate 0 = and  'KEY
start
 1 .hibernate store
stop

' Gene 1 Search (waiting)
cond
*.eye1 0 =
 *.eye2 0 = and
 *.eye3 0 = and
 *.eye4 0 = and
 *.eye5 0 = and
 *.eye6 0 = and
 *.eye7 0 = and
 *.eye8 0 = and
 *.eye9 0 = and
 *.refeye *.myeye = or
 *.nrg 3000 >= and
start
 10 rnd .aimdx store
stop


'Gene 2 Food Sighted
'*********************
cond
*.refeye *.myeye !=
*.eyef 0 !=
start
1 .attack store
stop

cond
*.refeye *.myeye =
*.eyef 0 = or
start
0 .attack store
stop

cond
*.eye1 0 >
*.attack 0 =
start
550 .aimdx
0 .hibernate store
stop

cond
*.eye2 0 >
*.attack 0 =
start
405 .aimdx
0 .hibernate store
stop

cond
*.eye3 0 >
*.attack 0 =
start
260 .aimdx
0 .hibernate store
stop

cond
*.eye4 0 >
*.attack 0 =
start
115 .aimdx
0 .hibernate store
stop

cond
*.eye6 0 >
*.attack 0 =
start
115 .aimsx
0 .hibernate store
stop

cond
*.eye7 0 >
*.attack 0 =
start
260 .aimsx
0 .hibernate store
stop

cond
*.eye8 0 >
*.attack 0 =
start
405 .aimsx
0 .hibernate store
stop

cond
*.eye9 0 >
*.attack 0 =
start
550 .aimsx
0 .hibernate store
stop
'*********************


' Gene 3 Chase Food
cond
*.eye5 0 >
 *.refeye *.myeye !=
start
 *.refveldx .dx store
 *.refvelup 30 add .up store
stop


' Gene 4 Long Range Food Handling

cond
 *.eye5 50 >
 *.refeye *.myeye !=
 *.refeye 0 >
 *.hibernate 0 =
start
1 rnd 2 mult 3 sub .shoot store
216 .shootval store
stop


'Gene 5 Blind Retaliation
cond
 *.hit 1 =
 *.eye5 40 > or
 *.refeye *.myeye !=
start
*.shang 90 sub .aimdx
10 .repro store
10 .repro store
stop


' Gene 6 Eat Food
cond
 *.eye5 50 >
 *.refeye *.myeye !=
 *.hibernate 0 =
 *.refeye 0 =
 *.robage 0 !=
start
-1 .shoot store
 *.refvelup .up store
stop

' Gene 7 Venom
cond
 *.hibernate 0 =
 *.venom 50 <
start
10 .strvenom store
stop

' Gene 8 Avoiding Family
cond
 *.eye5 0 =
 *.refeye *.myeye = or
 *.hibernate 0 =
start
 314 rnd .aimdx store
stop


' Gene 9 Duplicate
cond
 *.robage 0 !=
 *.numties 0 =
 *.head 0 =
start
 1 .head store
stop


' Gene 10 Reproduce
cond
 *.nrg 15000 >
 *.robage 3 > and
start
 15 .repro store
stop


' Gene 11 Reproduce for MB league
cond
 *.numties 0 =
 *.robage 0 !=
start
 10 .repro store
stop


'*-*-*-*-*-*-*-*-*-*-*-*


' Core Fat Functions
body
cond
*.nrg 1200 >
*.nrg *.body 100 add >
start
100 .strbody store
stop

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


' tie to parent
cond
*.robage 0 =
start
.tie inc
stop


' If MB Stuff
cond
 *.multi 1 = or
 *.hibernate 0 =
start
 50 .sharenrg store
 500 .maxlen store
 60 .stifftie store
stop

'Gene 13 MB communication
cond
 *.eye5 0 !=
 *.head 1 =
start
 *.eye5 .tout1 store
 *.aimdx .tout2 store
stop

cond
 *.tin1 0 !=
 *.head 0 =
start
*.tin2 .aimdx store
stop


'Finale Waste Disposal
cond
*.waste 100 >
*.refeye 0 =
*.reftie 0 =
start
*.waste .shootval store
-4 .shoot store
stop

end


--- End code ---

spork22:
Thanks, i'll try it out, but, what gene in all of those genes of RB are you talking about?

spork22:
I believe I did this correctly. I might have to make the workers go forward when the queen sees something, though.




--- Code: ---
def head 52


cond
*.eye5 0 =
start
314 rnd .aimdx store
stop


' Gene 9 Duplicate
cond
 *.robage 0 !=
 *.numties 0 =
 *.head 0 =
*.kills *.refkills >
start
 1 .head store
stop


'Gene 13 MB communication
cond
 *.eye5 0 !=
 *.head 1 =
start
 *.eye5 .out2 store
 *.aimdx .out3 store
stop

cond
 *.in2 0 !=
 *.head 0 =
start
*.in3 .aimdx store
stop




'/*****proper reproduction 1

cond
  *.nrg
  20000
  >
start
  50
  .repro
  store
  'if time to reproduce store it
  1
  972
  store
stop

cond
  '/after robot reproduces it reproduces more until energy less then 3000
  *972
  1
  =
start
  50
  .repro
  store
stop

'***** 2

cond
  *.nrg
  3000
  <
start
  0
  972
  store
stop


cond
*.eye5 50 >
*.refeye *.myeye !=
start
-1 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
stop


cond
*.refkills *.kills >
*.refeye *.myeye =
start
*.refxpos *.refypos angle .setaim store
1 .up store
stop


cond
*.refkills *.kills >
*.refeye *.myeye =
*.hit 0 >
start
1 .fixpos store
stop


cond
*.robage 5 mod 0 =
*.kills 0 >
start
1 .fixpos store
stop


cond
*.robage 5 mod 0 =
*.kills 0 =
start
0 .fixpos store
stop


cond
*.kills *.refkills >
*.refeye *.myeye =
start
1 .fixpos store
stop


cond
*.reffixed 0 >
*.refeye *.myeye =
start
1 .out1 store
stop


cond
*.kills *.refkills >
*.refeye *.myeye =
*.in1 1 =
start
0 .fixpos store
stop


def nrgratio 100

cond
*.kills 0 >
start

10 dup *.nrgratio sub sgn abs .nrgratio mult store

100 .strbody *.nrg *.body 10 div *.nrgratio ++ mult       sub sgn 0 floor mult store
100 .fdbody        *.body 10 div *.nrgratio    mult *.nrg sub sgn 0 floor mult *.body 100 sub sgn 0 floor mult store

stop

cond
*.robage 25 mod 0 =
*.kills 0 =
start
628 .aimdx store
stop


cond
*.refkills *.kills >
*.kills 0 >
start
-2 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
0 .fixpos store
stop


cond
*.refkills *.kills =
*.kills 0 >
start
-1 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
0 .fixpos store
stop

end





--- End code ---

spike43884:

--- Quote from: spork22 on July 23, 2015, 09:00:17 AM ---I believe I did this correctly. I might have to make the workers go forward when the queen sees something, though.




--- Code: ---
def head 52


cond
*.eye5 0 =
start
314 rnd .aimdx store
stop


' Gene 9 Duplicate
cond
 *.robage 0 !=
 *.numties 0 =
 *.head 0 =
*.kills *.refkills >
start
 1 .head store
stop


'Gene 13 MB communication
cond
 *.eye5 0 !=
 *.head 1 =
start
 *.eye5 .out2 store
 *.aimdx .out3 store
stop

cond
 *.in2 0 !=
 *.head 0 =
start
*.in3 .aimdx store
stop




'/*****proper reproduction 1

cond
  *.nrg
  20000
  >
start
  50
  .repro
  store
  'if time to reproduce store it
  1
  972
  store
stop

cond
  '/after robot reproduces it reproduces more until energy less then 3000
  *972
  1
  =
start
  50
  .repro
  store
stop

'***** 2

cond
  *.nrg
  3000
  <
start
  0
  972
  store
stop


cond
*.eye5 50 >
*.refeye *.myeye !=
start
-1 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
stop


cond
*.refkills *.kills >
*.refeye *.myeye =
start
*.refxpos *.refypos angle .setaim store
1 .up store
stop


cond
*.refkills *.kills >
*.refeye *.myeye =
*.hit 0 >
start
1 .fixpos store
stop


cond
*.robage 5 mod 0 =
*.kills 0 >
start
1 .fixpos store
stop


cond
*.robage 5 mod 0 =
*.kills 0 =
start
0 .fixpos store
stop


cond
*.kills *.refkills >
*.refeye *.myeye =
start
1 .fixpos store
stop


cond
*.reffixed 0 >
*.refeye *.myeye =
start
1 .out1 store
stop


cond
*.kills *.refkills >
*.refeye *.myeye =
*.in1 1 =
start
0 .fixpos store
stop


def nrgratio 100

cond
*.kills 0 >
start

10 dup *.nrgratio sub sgn abs .nrgratio mult store

100 .strbody *.nrg *.body 10 div *.nrgratio ++ mult       sub sgn 0 floor mult store
100 .fdbody        *.body 10 div *.nrgratio    mult *.nrg sub sgn 0 floor mult *.body 100 sub sgn 0 floor mult store

stop

cond
*.robage 25 mod 0 =
*.kills 0 =
start
628 .aimdx store
stop


cond
*.refkills *.kills >
*.kills 0 >
start
-2 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
0 .fixpos store
stop


cond
*.refkills *.kills =
*.kills 0 >
start
-1 .shoot store
1 .up store
*.refxpos *.refypos angle .setaim store
0 .fixpos store
stop

end





--- End code ---

--- End quote ---
You foudn the right gene, it was MB communication yes. remember to let them move if queeny see's nothign.

Navigation

[0] Message Index

[#] Next page

Go to full version