DarwinBotsManual
Open the app EspañolES

.genes

How many genes the bot's DNA has; it changes if it mutates, if a gene is deleted or if a virus inserts one.

Facts

Address
339
Name
.genes
Kind
Internal: the engine rewrites it; writing it has no lasting effect
Group
DNA and viruses
Written by
The engine, every cycle in the movement phase, and also when the bot is loaded, at birth, on mutation, when a gene is deleted or when a virus is received.
Cleared
No: the engine rewrites it every cycle, so writing to it is pointless.
Range
0 to 32000.
Mutations
picked as a read (*)

The engine counts the genes in the DNA with the same rule it uses to number them (see Genes: cond, start, else and stop) and publishes the total here. Unlike .nrg or .body, it is already published from the first cycle, because it is computed when the bot is loaded and when it is born.

It changes when the DNA changes: a gene deleted with .delgene, a virus that inserted itself (see DNA and viruses) or a mutation. That makes it useful for noticing that something from outside touched your DNA:

' At birth, note how many genes it has
cond
 *.robage 0 =
start
 *.genes 60 store
stop
' If it now has more, a virus got in: note it in cell 61
cond
 *.genes *60 >
start
 1 61 store
stop

Knowing which gene is the intruder is another matter: a virus enters at a random place, so the numbers of your own genes can shift. Writing to .genes is useless: the engine rewrites it every cycle. The length in words is in .dnalen.