Reproduction
The orders for having children, alone or with a partner, and the sense that tells you the bot has been fertilized.
| Address | Sysvar | Kind | Summary |
|---|---|---|---|
| 300 | .repro | Command | Orders an asexual reproduction: the number is the percentage of energy, body and chloroplasts that the child takes. |
| 301 | .mrepro | Command | Like .repro, but the child is born with a much higher chance of mutating: reproduction to explore. |
| 302 | .sexrepro | Command | Orders a sexual reproduction: it only works if the bot has been fertilized, and the child mixes its DNA with the sperm's. |
| 303 | .fertilized | Sense | Signals that the bot received sperm: greater than 0 while the fertilization is in effect, counting down from 9. |
A bot has children by writing a percentage: the share of its resources that it passes to the child. 50 .repro store splits it into two halves; 10 .repro store has a small child and keeps almost everything. The child takes that percentage of the energy, of the body, of the chloroplasts and of the waste, and is born stuck to its parent, joined to it by a birth tie.
There are three ways:
.repro: asexual. The child is a copy of the parent, with the normal mutations..mrepro: asexual, but the child mutates much more. Useful for exploring..sexrepro: sexual. It requires being fertilized (as.fertilizedtells you) by the sperm of another bot, and the child's DNA mixes the DNA of both.
All three share three rules worth keeping in mind:
- The percentage is taken modulo 100.
100 .repro storeis 0 and never produces a child;150is equivalent to 50. - The order stays written until it works. If the birth fails (there is no free spot in front of the bot, which is where the child appears, too little body, no energy), the engine does not clear it and it is retried automatically every cycle. To cancel it, write 0.
- It has a cost. A little energy is lost in the handover and, depending on the configuration, the birth also charges for the length of the DNA copied (DNA copy).
The child is born with its memory at 0, except for the .timer and the genetic memory (see Free and epigenetic memory). In its first cycle it already reads its .nrg, but .body and .robage give it 0. The whole process is in Reproduction.
An idea for using it: reproduce when you have energy to spare, with a percentage that leaves the parent able to carry on.
' When it gathers energy, it has a child with a third
cond
*.nrg 6000 >
*.body 500 >
start
33 .repro store
stop