creatur-3.0.0: Framework for artificial life experiments.

Safe HaskellNone



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.



class Reproductive a whereSource

A species that reproduces, transmitting genetic information to its offspring. Minimal complete definition: all except mate.

Associated Types

type Base a Source

A sequence of hereditary information for an agent. The type signature for the agent's genome is (Base a, Base a).


produceGamete :: RandomGen r => a -> Rand r (Base 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 -> (Base a, Base a) -> Maybe aSource

Builds an agent based on the genome provided, if it is possible to do so.

makeOffspring :: RandomGen r => a -> a -> AgentId -> Rand r (Maybe a)Source

makeOffspring (parent1, parent2) name uses the genetic information from parent1 and parent2 to produce a child with the agent ID name. The default implementation:

  1. Calls produceGamete to produce a single strand of genetic information from each parent.
  2. Pairs the two strands to create a genome for the child.
  3. Calls build construct a child with this genome.