This applet processes using the state machine below:
Red arrows mean a death occurred.
The starting population is half male half female, and their genomes are selected randomly.
Each year all the people grouped into each state are allocated to a different thread, and each thread processes each of the groups of people to determine the outcome of that year for them.
Death can occur within any state, but the chance of death goes up linearly with age, and the chance of a person drowning is modified depending on the number of favoured alleles in that person's genome. People who die do not get put into a state for the next year, and if they were part of a group the group may also be affected (e.g. if a partner dies the other partner goes back to being single, if the Mother in a MotherFatherChild dies the Father becomes single and the Child also dies, etc).
There is a global birth rate which varies depending on the current population, which works to keep
the population steady. The higher the birth rate the more likely each set of Partners are to give birth.
When a birth occurs each position in the child's genome has a 50% chance of being taken from the father, and a 50% chance of being taken from the mother. The child's survival bonus is then calculated based on its genome.
New singles are partnered immidiately if one is available, but other than that only one state change can occur per year
Juveniles are created a specified number of years after birth, and result in the MotherChild becoming a Juvenile & Single, or the MotherFatherChild becoming a Juvenile & Partners
Juveniles become single, and are given a sex (50/50 chance of becoming either) once they reach sexual maturity after a set number of years
Once everyone is processed the groups which have changed state are moved into the new state, ready to be processed again in the next year.
The model is crude and doesn't take any shortcuts, but this is by choice to stop the model becoming too abstract