Play n Tools

Free tools & games for everyone

Free · No sign-up · No accounts

Natural selection lab

See evolution at work: allele frequencies under selection, mutation and drift (Hardy-Weinberg, Wright-Fisher), and moths that adapt their camouflage to the bark.

How to use

  1. Alleles over generations: pick a preset or type your own numbers. A gene has two versions, A and a. Fitness is how many offspring each genotype leaves compared with the others (1 = normal, 0.9 = 10 % fewer).
  2. Press Run. The thick navy line is what happens in a very large population. The thin lines are small populations, where chance (genetic drift) also matters: some lose A, some keep only A.
  3. The table shows the predicted frequency, the genotype shares under random mating (Hardy-Weinberg) and how many drift lines ended fixed or lost.
  4. Camouflage: moths rest on bark. Birds catch the ones whose shade stands out. The survivors breed, and each child's shade is close to its parents' average. Set the bark to change part-way and press Run.

Keyboard and touch

TabMove between tabs, boxes and buttons
Enter in a boxRun the model
Arrow keys in a number boxChange the value by one step

Tips

  • Compare a helpful dominant allele with a helpful recessive one: the recessive one creeps up slowly at first, because while it is rare it hides in Aa carriers that selection cannot see.
  • With heterozygote advantage, both alleles stay: the frequency settles where both pay off equally (0.5 when AA and aa are equally fit).
  • Choose "drift only" with a population of 20 and then 2,000. Small populations lose or fix alleles quickly by chance alone.
  • Mutation in both directions keeps some of each allele around even when selection is against it.
  • In the moth model, set bird hunting to 0: the shade wanders a little but no longer follows the bark.

About this lab

The allele tab uses the standard one-locus model of population genetics. With frequency p of A and q = 1 − p, random mating gives genotype shares p², 2pq and q² (Hardy-Weinberg). After selection the new frequency is p' = (p² wAA + p q wAa) / w̄, where w̄ = p² wAA + 2pq wAa + q² waa is the mean fitness; then a share u of A mutates to a and v of a to A. The drift lines follow the Wright-Fisher model: the next generation's 2N gene copies are drawn at random using that frequency.

The moth tab is inspired by the peppered moth of industrial Britain, whose dark form became common on soot-darkened trees and rare again after clean-air laws. Here a moth is eaten with a chance of hunting × the difference between its shade and the bark's, survivors pair at random, and a child's shade is the parents' average plus a normal random change. Because a child's shade is the parents' average, variety would shrink every generation without the random change; that change stands in for mutation and the mixing of many genes. It is a simple teaching model of selection on a trait, not a model of real moth genetics. Runs are seeded, so the same settings and seed give the same result. Everything runs in your browser.

See you tomorrow!

A fresh daily puzzle every morning, and new tools added every month.

Browse every product