Darwinbots Forum

Bots and Simulations => DNA - General => The Gene depository => Topic started by: Elite on February 21, 2006, 05:42:35 AM

Title: Battery Gene MkII
Post by: Elite on February 21, 2006, 05:42:35 AM
A bot with this gene will grab any veg that comes in range and store it in a special 'battery sac'. The bot can collect up to four vegetables in this way.

The gene will then siphon off the vegetables' energy for your own use  :D

Code: [Select]
cond
start
*.tiepres .readtie *.numties sgn mult store
.tiepres .memloc *.robage -1 mult 1 add sgn mult store
.numties .tmemloc *.robage -1 mult 1 add sgn mult store
55 10 rnd add .tie *.refeye sgn -1 mult 1 add sgn mult *.eye5 45 sub sgn mult *.memval sgn -1 mult 1 add sgn mult *.robage sgn mult store
628 .fixang *.numties sgn mult store
200 .fixlen *.numties sgn mult store
*.tiepres .tienum *.numties sgn mult store
*.tiepres .readtie *.numties sgn mult store
.fixpos .tieloc *.numties sgn mult *.treffixed mult store
0 .tieval *.numties sgn mult *.treffixed mult store
80 .sharenrg *.multi mult store
*.tiepres .deltie *.tmemval 1 sub sgn mult store
*.tiepres .deltie *.myeye *.trefeye sub sgn abs -1 mult 1 add mult store
stop

The only problems you may have are:
- The bots may attack each other's vegs (and occasionally their own)
- This gene will interfere with tie-feeders
- This gene sets .memloc and .tmemloc and needs these values set to function

You can solve the first problem by having bots not attack if *.memval equals 55-65
Title: Battery Gene MkII
Post by: MrMound on February 23, 2006, 06:19:29 PM
I am using this gene on a bot I am making.  lets say with this bot robot A ties onto a veggie. I f robot B came along and teid onto the same veggie is there a way it could tell the veggie was already tied onto by another robot?
Title: Battery Gene MkII
Post by: Endy on February 23, 2006, 10:17:58 PM
Mostly yes, initially no. By checking .numties with .memloc/.memval or .tmemloc/.tmemval, they can find out if the bot is tied to by another already. Then they can try to find another bot to feed from. Unfortunatly there's still bound to be errors just because of the 1 cycle delay in information transfer.

Probably the best way to deal with this would be to use in/out set to the tier's age to tell younger bots they need to untie.
Title: Battery Gene MkII
Post by: MrMound on February 23, 2006, 11:43:01 PM
how do you use the in/out comands.  I'v never really heard of them before
Title: Battery Gene MkII
Post by: Endy on February 23, 2006, 11:55:36 PM
The value stored into .out1 or .out2 can be seen by other bots with *.in1 or *.in2 respectivly. You can essentially use them like a sign to other bots. Another bot seeing a veggie with this sign will know not to feed from it, without having to use .memloc/.memval to find out number of ties.

Heres some info from the wiki if you're still curious:

In and Out (http://www.darwinbots.com/WikiManual/index.php?title=In_and_Out)
Title: Battery Gene MkII
Post by: Elite on February 24, 2006, 06:30:50 AM
Oops, forgot a line of code  :redface:

Need to put this into the gene:

Code: [Select]
*.tiepres .readtie *.numties sgn mult store
I was wondering why it was deleting its ties so often

It should work much better now  :)