DarwinBotsManual
Open the app EspañolES

.dnalen

The length of the bot's DNA in words, counting the final end; upkeep and the cost of copying it depend on it.

Facts

Address
336
Name
.dnalen
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
1 to 32001: the DNA words plus the final end.
Mutations
picked as a read (*)

It counts the words of the DNA, including the end that closes every DNA: a bot cond start 1 50 store stop has 6 words and .dnalen is 7. def lines and comments don't count (see Variables with def). Like .genes, it is already published from the first cycle.

It matters because of energy. Depending on the configuration, the bot pays every cycle for the length of its DNA, whether it runs or not (DNA per cycle), and when reproducing it pays for copying it (DNA copy); see Execution and costs. A DNA that has grown through mutations or viruses becomes expensive.

It changes when the DNA changes: mutations, genes deleted with .delgene or viruses inserted. Writing to .dnalen has no effect: the engine rewrites it every cycle.

' If the DNA has grown a lot (for example, from a virus), cancel
' any reproduction request: it goes after the gene that makes it
cond
 *.dnalen 200 >
start
 0 .repro store
stop