This model simulates the genetics of a single locus in a finite-size population of diploid individuals.
There are two alleles: R codes for red pigment and B codes for blue pigment.
Individuals are either red (genotype RR), purple (genotype RB), or blue (genotype BB).
The simulation is initialized with a population (N) initially set to 20. The user can specify any value.
The initial proportion of red alleles is set by a slider.
The 'Steps per turn' slider controls how many steps are simuated at a time.
Once the user has chosen their parameter values, they can press the 'Reset simulation' button to initialize a new simulation.
During each round of the simulation, each individual contributes two gametes which correspond to the two alleles present in its genotype.
The gametes of all individuals all go into a large gamete pool.
To produce an offspring for the next round, two gametes are selected at random from the gamete pool with replacement.
This is repeated until N individuals have been generated.