Darwinbots Forum
Bots and Simulations => Bot Tavern => Topic started by: Testlund on December 17, 2009, 05:20:34 PM
-
I have this bot here that uses touch senses and will attack any bot that touches it, but I want it to leave it's conspecies alone.
The DNA:
cond
*.refxpos 0 >
start
*.refxpos *.refypos angle .setaim store
-1 .shoot store
stop
cond
*.nrg
16000
>
start
10 .strbody store
stop
cond
*.body 15999 >
start
50
.repro
store
15
.aimdx
store
stop
end
I don't know if it's possible with species recognition through touch senses.
-
Perhaps communication through ties?
tie_to_bot
bot = result_of_communications
if bot == myspecies
lalala
else
KILL IT!
-
I have this bot here that uses touch senses and will attack any bot that touches it, but I want it to leave it's conspecies alone.
The DNA:
cond
*.refxpos 0 >
start
*.refxpos *.refypos angle .setaim store
-1 .shoot store
stop
cond
*.nrg
16000
>
start
10 .strbody store
stop
cond
*.body 15999 >
start
50
.repro
store
15
.aimdx
store
stop
end
I don't know if it's possible with species recognition through touch senses.
You should have full access to the refvars through the touch sense, I think (it's been a while, and Eric did most of the work IIRC). So you can do the ol' *.refeye *.myeye != to check for non conspecs, assuming your predators use eyes. If not, you can still check *.refdx, *.refup, etc.
-
But I don't know how to wire it to touch. Sorry, I'm a lousy bot maker. I can only try and mofify existing code.
Here 0 means recognise conspecs:
*.eye5 0 >
*.refeye *.myeye !=
Here 0 means I'm just touching a bot:
*.refxpos 0 >
*.refxpos *.refypos angle .setaim store
I figured .myxpos != would make sense here but that sysvar don't seem to exist.
-
It's just .xpos and .ypos (or .depth)...
All the sysvars are explained here :
http://www.darwinbots.com/WikiManual/index.php?title=Sysvars (http://www.darwinbots.com/WikiManual/index.php?title=Sysvars)
Not sure what you mean by "0 means recognise conspecs"...
This :
*.eye5 0 >
*.refeye *.myeye !=
means :
If I can see something with eye5
And the amount of eyecommands in what I see is not the same amount as my own.
This :
*.refxpos 0 >
*.refxpos *.refypos angle .setaim store
means :
If the x coordinate of what I see is larger than 0
Adjust my aim to the exact position of what I'm looking at. (I think the refvars may actuay show what position the bot will have the next cycle, to make tracking easier).
.hit will say if you've been hit, and .hitsx (or dx/up/dn) will tell if you've been hit from that direction.
Other than that I don't know how to set the refvars to show what you just hit.
I think it's hard to have a conspec without eyes.
-
*.eye5 0 > means that you see something.
*.refxpos 0 > means that I sense another bot.
*.refeye *.myeye != is the actual conspec check.
*.refxpos *.refypos angle .setaim store is the reaction.
So what you want is something like:
*.refxpos 0 >
*.refeye *.myeye != and
*.refxpos *.refypos angle .setaim store
That will only work, though, if your enemise have *.eye statements in their DNA. If they don't, you'll need to use some of the other conspec sysvars (refup, etc.)