Darwinbots Forum

Bots and Simulations => DNA - General => The Gene depository => Topic started by: Ispettore on October 24, 2007, 12:43:06 PM

Title: carnivore gene
Post by: Ispettore on October 24, 2007, 12:43:06 PM
Hello... I don't know if I can post here this request...
I'd like just to have a carnivore gene... so that the bot with it can't eat veggies... and I also would like to have the gente from T preseverant that avoid killing veggies... can you help me?
Title: carnivore gene
Post by: MacadamiaNuts on October 24, 2007, 01:27:21 PM
The old and most common way of checking if a target is a veggie is checking its number of eyes. Veggies usually doesn't have them:

*.eye5 0 >
*.refeye 0 =

Then you use that condition (or negate it *.refeye 0 !=) in the targetting and hunting eyes to avoid them.

To avoid killing the target, check it's energy, like:

*.refnrg 500 >
Title: carnivore gene
Post by: Ispettore on October 25, 2007, 12:15:45 PM
could you please make me an example of where should I put it in the eat gene? I'm not very good ad bot programming  
Title: carnivore gene
Post by: Peter on October 25, 2007, 01:04:00 PM
For example in the shooting gene.

Quote
cond
*.eye5 25 >
*.refeye 0 !=
start
-1 .shoot store
stop

explanation

cond:             start gene
*.eye5 25 >    check oponent close
*.refeye 0 !=   check is it a veggy if not go thru
start                go if conditions are true
-1 .shoot store  :shoot
stop                   :end gene


for just changing a bot behaviour to herbovore
put this in the shooting gene.Between cond and start.
Quote
*.refeye 0 !=

Hope this helps.
Title: carnivore gene
Post by: Peter on October 25, 2007, 01:11:13 PM
for the T-preservants
the gene

  *.refnrg  500  >

This one checks if the veggie has enough energy to survive. And this condition(between cond and start)
has then to be put in every shooting gene.
Just as the carnivoures gene.

The complete gene

cond
  *.eye5  49  >
  *.refdn  20  <
  *.refnrg  500  >(.......<---------the one it's about.)
  *.refshoot  0  =
start
  -1  .shoot  store
stop