DarwinBotsManual
Open the app EspañolES

.sexrepro

Orders a sexual reproduction: it only works if the bot has been fertilized, and the child mixes its DNA with the sperm's.

Facts

Address
302
Name
.sexrepro
Kind
Command: the bot writes it and the engine reads it and usually consumes it
Group
Reproduction
Written by
Your DNA.
Read by
The engine, in the actions phase, if it is greater than 0 and the bot is fertilized: requests a sexual child with that percentage. That cycle, .repro waits.
Cleared
The engine, only when the child is born. If the birth fails, it stays written.
Range
−32000 to 32000; the remainder of dividing by 100 is used.
Mutations
picked as a store target

Sexual reproduction has two roles. The one acting as the father doesn't have children: it shoots sperm at another bot with -8 .shoot store (see .shoot). The one that receives it is fertilized for about ten cycles (.fertilized tells it so), and if within that window it writes a percentage to .sexrepro, it has a child whose DNA mixes its own with the sperm's.

' It turns until it sees something and shoots it with sperm
cond
 *.eye5 0 =
start
 25 .aimdx store
stop
cond
 *.eye5 0 >
start
 -8 .shoot store
stop
' If it gets fertilized, it has a child with half of what it has
cond
 *.fertilized 0 >
start
 50 .sexrepro store
stop

With two of these bots in a small field, it is normal for a child to be born within a few dozen cycles. The child appears in front of the mother, in the direction she is pointing: if there is another bot or a wall there, the birth waits. The percentage works as in .repro: modulo 100, and the order stays written until the birth succeeds.

What changes compared with the asexual one:

How the child's DNA is put together is in Reproduction.