Biology · Simulator 031
A population of moths comes in light and dark forms. Predators spot moths that stand out against the bark. Change the bark colour, predation strength and starting mix, and watch the frequency of the dark allele change over generations.
Class 11–12Class 12 Biology: Evolution
Each moth has two copies (alleles) of a colour gene: dark D (dominant) or light d. DD and Dd moths are dark; dd moths are light. Each generation:
The simulation tracks real individuals with a seeded random generator, so small populations also show chance effects (genetic drift). The dashed line is the deterministic expectation for an infinite population, using the standard one-locus selection recursion.
This is the classic peppered moth story: soot-darkened trees in industrial England favoured dark moths, and clean-air laws reversed the trend.
Simplified single-gene model with complete dominance, random mating and non-overlapping generations. Real moth colour genetics and predation are more complex.
On dark bark with strong selection, why does the light allele (d) never quite disappear, even after many generations?
When d is rare it is almost always in Dd moths, which look dark and are not selected against. Only dd moths are exposed, at frequency q². That shrinks very fast as q falls, so selection slows dramatically. Mutation also keeps reintroducing d at a low rate. The deterministic curve flattens near zero for the same reason.
Start: dark allele D at 5% (q = 0.95 for light d), selection s = 0.3 against conspicuous light moths on dark bark.
Before predators: DD 0.25%, Dd 9.5%, dd 90.25% (Hardy–Weinberg: p², 2pq, q²). So 9.75% of moths are dark.
Survival: dark moths all survive, light ones 70%. Survivors: 0.0975 + 0.9025 × 0.7 ≈ 0.729 of the population.
New allele frequency: d = (0.095 / 2 + 0.632) / 0.729 ≈ 0.931, so D rises from 5% to about 6.9% in one generation, and dark moths from 9.8% to about 13.2%.
Each generation the rise speeds up while D is rare. Run the dark-bark experiment and compare its first generation with these numbers.
Individuals with traits that help them survive and reproduce leave more offspring, so the alleles behind those traits become more common over generations.
When soot darkened tree bark, dark moths were hidden from birds and became common in industrial areas. When the air was cleaned, light moths returned. The trait followed the environment.
Once it is rare, most copies sit in carriers who look normal, so selection cannot see them. That is why the light allele lingers hidden in Dd moths.