Copyright | (c) 2012-2021 Amy de Buitléir |
---|---|
License | BSD-style |
Maintainer | amy@nualeargais.ie |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
A reproduction method for artificial lifeforms where:
- Each agent has two strands of genetic information.
- Each child has two parents.
- Each parent contributes approximately half of its genetic information to the offspring.
Documentation
class Reproductive a where Source #
A species that reproduces, transmitting genetic information to
its offspring. Minimal complete definition: all except mate
.
A sequence of hereditary information for an agent. The type signature for the agent's genome is (Strand a, Strand a).
produceGamete :: RandomGen r => a -> Rand r (Strand a) Source #
From the two strands of the genetic information from this agent, creates a single strand that will contribute to the child's genome. (This is analogous to creating either a single sperm or ova.)
build :: AgentId -> (Strand a, Strand a) -> Either [String] a Source #
Builds an agent based on the genome provided, if it is possible to do so.
makeOffspring :: RandomGen r => a -> a -> AgentId -> Rand r (Either [String] a) Source #
uses the genetic
information from makeOffspring
(parent1, parent2) nameparent1
and parent2
to produce a child with
the agent ID name
. The default implementation:
- Calls
to produce a single strand of genetic information from each parent.produceGamete
- Pairs the two strands to create a genome for the child.
- Calls
construct a child with this genome.build