Bots and Simulations > Tips and Tricks

How to know you're the first

(1/2) > >>

Numsgil:
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.

PurpleYouko:
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: ---cond
*.robage 1 =
*.numties 0 =
'must be first rob
start
your code for the first
stop
--- End code ---

Endy:
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)

Numsgil:
I think I made the distance between robots and the natural length of birth ties the same (they weren't before).

Martian:
How about this?


--- Code: ---
cond
 *.robage 0 =
start
 1 55 store
 *.thisgene .delgene store
stop
--- End code ---

Navigation

[0] Message Index

[#] Next page

Go to full version