Darwinbots Forum

Bots and Simulations => DNA - General => Tips and Tricks => Topic started by: Numsgil on April 08, 2005, 07:06:46 AM

Title: How to know you're the first
Post by: Numsgil on April 08, 2005, 07:06:46 AM
So you're programming along and you decide you want the first bots that are created to do something no other bots do.

For instance, store a value to a memory location that then transfers to the young through racial memory.

How do you do it?

cond
*.eye5 0 =
*.age 0 =
start
'your code for the first
stop

This is a good way, but it won't work 100% of the time.

cond
*.eye5 77 < 'I think that's the right number.  Test it out
*.age 0 =
start
'your code for the first
stop

This is getting there, but it's still not 100%.  This is as far as I've come.  This should work most of the time.  You won't get any new babies thinking they're the first, but you may get some firsts thinking they're new babies.  But that would only happen if the bot spawns very close and facing another bot.
Title: How to know you're the first
Post by: PurpleYouko on April 08, 2005, 08:52:31 AM
How about adding a second gene to make sure?

Activate it when robage = 1 and check for ties. The first rob will have none but babies always will. This should catch 100% of the first robs in combination with the other gene or even on its own.
Only the first rob can ever have no tie at age 1

Try this.

Code: [Select]
cond
*.robage 1 =
*.numties 0 =
'must be first rob
start
your code for the first
stop
Title: How to know you're the first
Post by: Endy on April 09, 2005, 08:00:30 PM
Checked eyes and it looks like 74 is the new closest value. Not sure which of the many changes is responsible. Not too much difference just need to change the code.

Endy B)
Title: How to know you're the first
Post by: Numsgil on April 09, 2005, 11:08:49 PM
I think I made the distance between robots and the natural length of birth ties the same (they weren't before).
Title: How to know you're the first
Post by: Martian on August 06, 2007, 02:03:08 PM
How about this?

Code: [Select]

cond
 *.robage 0 =
start
 1 55 store
 *.thisgene .delgene store
stop
Title: How to know you're the first
Post by: Trafalgar on August 06, 2007, 04:09:05 PM
Quote from: Martian
How about this?

I use something like that on my shepherds, except I omit the condition on the gene (as far as I know, the gene should be deleted after the DNA runs, before the next cycle starts)
Title: How to know you're the first
Post by: googlyeyesultra on August 06, 2007, 04:29:55 PM
Racial memory is wonderful. It does require, however, that you delay severing the birthtie a bit.

cond
*.robage 3 =
start
971 inc
stop

cond
971 1 =
start
'whatever you want the firsts to do
stop

cond
971 1 >
start
'whatever you want anything that's not a first to do
stop
Title: How to know you're the first
Post by: EricL on August 06, 2007, 08:02:36 PM
Quote from: googlyeyesultra
Racial memory is wonderful. It does require, however, that you delay severing the birthtie a bit.


Note that locations 971-975 get passed on instantly in 2.43.   This was a much discussed feature request.  The Wiki is out of date...

    'First 5 genetic memory locations happen instantly
     For I = 0 To 4
        rob(nuovo).mem(971 + I) = rob(n).mem(971 + I)
     Next I