.timer
A clock that adds 1 per cycle, that you can write to and that the child inherits from the parent: useful for synchronizing a lineage.
Facts
- Address
- 12
- Name
.timer- Kind
- Input and output: both the bot and the engine write it
- Group
- Body, energy and state
- Written by
- The engine adds 1 to it in the actions phase; after 32000 it continues at −32000. Your DNA can write it too. On load it starts at random and the child inherits it.
- Cleared
- No: the engine never sets it to 0.
- Range
- −32000 to 32000.
- Mutations
- picked as a read (
*)
The engine adds 1 at the end of each cycle to whatever is in .timer. Unlike .robage, the value is yours: if you write 0, the next cycle you read 1, and it keeps counting from there. When it goes past 32000 it jumps to −32000 and keeps rising.
Two details about where it starts:
- A bot loaded at the start of the simulation gets a random value.
- A child is born with the value its parent had (or its mother, in sexual reproduction) and keeps the same count. Along with the genetic memory, it is the only thing in memory that is inherited (see Free and epigenetic memory).
That is why it is the tool for making a whole lineage act at once: the descendants of the same founder share the clock without talking to each other.
' Every 100 clock cycles, a half turn
cond
*.timer 100 mod 0 =
start
628 .aimdx store
stopAll of this bot's children turn on the same cycles as it does. If you prefer to count from each one's birth, set the clock to 0 at birth with 0 .timer store inside a gene with *.robage 0 =.
Watch out for mod and negative numbers: with the clock at −250, 100 mod gives −50, not 50. Comparing with 0 works the same.