.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,
.reprowaits. - 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
stopWith 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:
- The mother supplies everything. The child's energy, body and chloroplasts come from the bot that writes
.sexrepro. The one that shot the sperm only paid for the shot, and doesn't count as a parent. - One sperm, one child. After the birth the fertilization ends and
.fertilizedgoes back to 0. - Relatives, not strangers. If the sperm's DNA is too different (more than 60% differences), there is no child, that sperm is no longer any use, and for about eight cycles the bot doesn't accept new sperm. To try again it needs another one to reach it.
- The mix isn't fixed. Two births with the same sperm give different children, and the child can come out shorter than both parents.
- It goes before the asexual one. As long as the bot is fertilized and has
.sexreprowritten, it only tries the sexual one;.reprowaits even if the sexual one fails.
How the child's DNA is put together is in Reproduction.