Darwinbots Forum
Bots and Simulations => DNA - General => Tips and Tricks => Topic started 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.
-
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.
cond
*.robage 1 =
*.numties 0 =
'must be first rob
start
your code for the first
stop
-
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)
-
I think I made the distance between robots and the natural length of birth ties the same (they weren't before).
-
How about this?
cond
*.robage 0 =
start
1 55 store
*.thisgene .delgene store
stop
-
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)
-
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
-
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