Bots and Simulations > Bot Tavern

trying to make a bot

(1/3) > >>

Testlund:
I can't get this bot to stop shooting at its conspecifics.

Could someone tell me what I'm doing wrong. I tried following the bot tutorial but it doesn't work.

Maybe I've put some things in the wrong order. Here is the code:

' Cyanobacterium nostoc

'Gene 1. Photosynthesis
cond
  *.nrg
  5000
  >
start
  50
  .repro
  store
  15
  .aimdx
  store
stop

'Gene 2. Form colonies
cond
 *.robage 0 =
start
 .tie inc
stop

'Gene 3. Simple search pattern 1
cond
 *.eye3 *.eye5 >
start
 -25 .aimdx store
stop

'Gene 4. Simple search pattern 2
cond
 *eye7 *eye5 >
start
 25 .aimdx store
stop

'Gene 5. Feeding
cond
 *.eye5 40 > *.nrg 5000 <
start -1 .shoot store
stop

'Gene 6. Avoid conspecifics
cond
 *eye5 0 >
 *.refeye 6=
start
 180 .aimdx store
stop

'gene 7. Spread out
cond
 *.nrg 1000 >
start
 .delti inc
stop

cond
 *robage 0 =
start .shoot .ploc store
stop

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

end

Elite:
Aaaaaargh - the formating!  :wacko:

I
hate
code
like
this
it's
so
hard
to
read

The reason you're bot is killing conspecs is gene 5


--- Code: ---cond
*.eye5 40 > *.nrg 5000 <
start -1 .shoot store
stop
--- End code ---

^  <_<


--- Code: ---cond
*.eye5 40 >
*.nrg 5000 <
start
 -1 .shoot store
stop
--- End code ---

^ Ah, Much better  :P

Add this condition to the gene:
*.refeye *.myeye !=

to get:


--- Code: ---cond
*.eye5 40 >
*.nrg 5000 <
*.refeye *.myeye !=
start
 -1 .shoot store
stop
--- End code ---

They should then stop killing conspecs  :D

Oh yeah, and it's .deltie, not .delti. Maybe why the bots are 'blobbing' into huge tied masses. There are a few more tiny errors too. To save you the bother, here's the corrected version:


--- Code: ---'Gene 1. Reproduction
cond
*.nrg 5000 >
start
50 .repro store
15 .aimdx store
stop

'Gene 2. Attach to parent
cond
*.robage 0 =
start
.tie inc
.shoot .ploc store
stop

'Gene 3. Simple search pattern 1
cond
*.eye3 *.eye5 >
start
-25 .aimdx store
stop

'Gene 4. Simple search pattern 2
cond
*eye7 *eye5 >
start
25 .aimdx store
stop

'Gene 5. Feeding
cond
*.eye5 40 >
*.nrg 5000 <
*.refeye *.myeye !=
start
-1 .shoot store
stop

'Gene 6. Avoid conspecifics
cond
*eye5 0 >
*.refeye 6 =
start
180 .aimdx store
stop

'Gene 7. Spread out
cond
*.nrg 1000 >
start
.deltie inc
stop

'Gene 8. Store poison

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

end
--- End code ---

 :D

Testlund:
Thanks for helping me with that. I was wondering about another thing. When I run a sim with this bot together with Animal Minimalis they don't shoot one another. They only shoot other bots. Could it be that something in the code make them think they are the same species?

Numsgil:
They might have the same number of eye statements.  Since the conspec recognition is based on number of eye statements, it's not that hard for bots to get confused.  Hence why it's the more basic of conspec recognition types.

To fix the problem, add *.eye5 at the bottom of your code.  Doesn't need to be in a gene or anything (assuming you're running 2.4X).

Testlund:
Ok, I took the liberty of posting this bot in the Bestiary.

Navigation

[0] Message Index

[#] Next page

Go to full version