Evolutionary Laboratories
Welcome — start here.
Welcome to the Evolutionary Laboratories. On these pages you can use interactive simulations to explore evolutionary mechanisms and processes in an intuitive, hands-on way.
How to use the rooms
Every room follows the same pattern: set the parameters with the sliders and buttons at the top, press Run (or Start), and read the panels that fill in below. Nothing is precomputed — each run is a fresh simulation, so running the same settings twice will not give the same result: these are random processes, and the parameters set tendencies, never outcomes.
Two features are worth knowing about before you start:
- The History Scrubber beneath the simulation in the Copying, Branching, Drift, Selection, Migration, Adaptation and Speciation rooms lets you drag back through a finished run and replay any generation. Nothing is lost when a run ends.
- The small red ? buttons beside a control or a panel explain what it does, what the numbers mean, and what to look for. If something on screen is unclear, there is usually a ? next to it.
Words worth pinning down
These twenty-one come up again and again. Each is underlined wherever it first appears — click it, anywhere in the tool, for a short explanation. They are gathered here too:
- Chromosome — a long molecule of DNA carrying many genes in a fixed order.
- Gene — a stretch of DNA that does a job; the unit itself.
- Locus (plural loci) — the gene's position on the chromosome, its address.
- Allele — one of the alternative versions that can sit at a locus. Written A₁ and A₂ throughout, and wherever a room says p it means the frequency of A₁.
- Selection — some alleles leave more descendants, consistently, because of what they do.
- Drift — allele frequencies changing by pure chance, strongest in small populations.
- Mutation — a copying error in DNA — the only source of genuinely new alleles.
- Migration (or gene flow) — individuals moving between populations and breeding there; the one force that acts between populations rather than within one.
- Population — a group that interbreeds; the level at which evolution actually happens.
- Generation — one complete round of reproduction, and the unit evolutionary time is measured in.
- Neutral — having no effect on fitness, so drift alone decides its fate.
- Habitat — the surroundings that decide which variants do well — fitness is always fitness somewhere.
- Gamete — an egg or a sperm, carrying one copy of each chromosome instead of two.
- Genotype — the pair of alleles an individual carries at a locus — the two homozygotes and the heterozygote.
- Phenotype — what the alleles build: here the drawing itself, and in the Speciation Room the physiology too.
- Heterozygote (and homozygote) — the two alleles at a locus differing, or matching. A rare allele is nearly always in a heterozygote.
- Recombination — the swap between paired chromosomes during meiosis, which is what makes sex more than averaging.
- Fitness — how well a variant does at getting into the next generation, always relative to the alternatives.
- Epistasis — an allele’s effect depending on which alleles sit at other loci. Left out of these rooms on purpose.
- Fixation — an allele reaching frequency 1, so that every individual carries it; loss is the same story at frequency 0. Both are the end of the road: with one allele left there is nothing for drift or selection to act on.
- Speciation — one population becoming two that no longer exchange genes, by pre- or post-zygotic barriers.
The twelve rooms fall into four parts, and they build on each other in that order. Part I asks what a mutation is: copying is imperfect, so differences pile up — and they pile up in no particular direction. Part II follows a single one of those errors: a mutation begins in exactly one individual, so what are the chances it ever amounts to anything? Part III lets some mutations matter — one allele now carries a real advantage — draws the line selection cannot cross (it governs a mutation's fate, never whether it appears), adds the last of the four forces by letting two populations trade migrants, and ends by asking what all of this adds up to once they stop. Part IV is the machinery underneath: how gametes are made, how genotype frequencies follow from allele frequencies, and what changes once you follow two loci instead of one. The first three parts run from start to finish without it, so treat it as a reference shelf — dip in when a room sends you there, or read it straight through if you want the mechanism behind the bookkeeping.
Working through the rooms in order is recommended, but each one stands on its own.
One word to watch: in the first two rooms a single lineage simply changes as copying errors pile up. From the Fate Room on, genetic drift means something more precise — the random change, from one generation to the next, in how common an allele is across a whole population.
Part I — What a mutation is
Copying is imperfect, and nothing is steering it.
01The Copying Room
Mutation & accumulated change
One figure is copied over and over, and every copy carries a small random error. Nothing is steering anything — yet the shapes still change, and they change in different directions.
02The Branching Room
Divergence & speciation
The same copying, but now lineages split. This is how one species becomes several, and why reconstructing who is related to whom, from appearances alone, so often goes wrong.
Part II — What becomes of one mutation
A mutation starts in a single individual. Almost all of them vanish.
03The Fate Room
The fate of a single new mutation
One mutation, in one individual, in a population of N. Two populations run it forward to the end — and a tally that says how rarely the ending you are shown actually happens.
04The Drift Room
The Wright–Fisher model
A finite population, sampled anew each generation. Nobody has any advantage, and yet the allele frequency wanders — and eventually one allele is all that is left.
Part III — Neutral or selected
Now some mutations matter — selection still has no say in which ones appear — the four forces that move a frequency are all on the table, and two populations that stop trading genes end up as two species.
05The Selection Room
Wright–Fisher + selection
The same sampling machinery, but now allele A₁ carries a real advantage. Watch selection and drift compete, and see which one wins at different population sizes.
06The Mutation Room
Mutation is random with respect to fitness
Where do the alleles come from in the first place? Four wheels make a mutant, and no amount of selection can change the size of a single slice.
07The Migration Room
Gene flow against drift
Two populations drifting apart, and a slider that moves individuals between them. Somewhere around one migrant a generation the two stop behaving like two — and what decides it is the number of migrants, not the fraction of the population they are.
08The Adaptation Room
Multi-trait selection vs. drift
Everything combined: related founders, five traits, three habitats — and a Neutral lineage alongside each one, so you can see exactly what selection contributes.
09The Speciation Room
Divergence in isolation
One polymorphic population in a lake, split in two, with nothing passing between them ever again. Half of it moves away — to another lake, or to a stream. The same variation, sorted two different ways — until at some point they are no longer one species.
Part IV — The machinery underneath
How the copying is actually done. The first three parts run without these; dip in when a room sends you here.
10The Reproduction Room
Two ways to make the next generation
Two founders reproduce side by side for four generations: one asexually, one sexually. Numbers on one side, variety on the other.
11The Hardy–Weinberg Room
From alleles to genotypes
Under random mating, the frequency of one allele fixes the frequencies of all three genotypes. This is the bookkeeping the rest of the tool leans on.
→ Open the Hardy–Weinberg Room
12The Linkage Room
Two loci at once
Follow two loci instead of one and the tidy single-locus picture breaks: an association between them decays only as fast as recombination breaks it up.
What these models assume
Every room here is a model, which means every room is wrong on purpose. A model earns its keep by leaving out enough of the world that what remains can be watched, and the things it leaves out are not hidden: each room carries a What this model assumes panel, just above What to notice, listing what binds in that room and naming the room that lifts it where there is one. Reading those panels is how you tell the model from nature, which is the one habit this whole set is trying to build.
A few assumptions run through nearly all of it, and are worth having in mind from the start:
- Populations are closed and constant in size. No migration in or out, and N fixed for the whole run. Real populations grow, crash and exchange migrants, and even a trickle of migration between two populations is enough to hold them together — which is what the is for.
- Generations are discrete, mating is random, and every individual has an equal chance of being a parent before selection is applied. Real generations overlap and real mating is choosy — so the N in these rooms is better read as an effective population size than as a head count.
- Loci are independent. No linkage and no epistasis: the fish rooms treat each trait as its own locus, inherited separately and acting on its own. The is where that assumption is taken apart, and it is worth going back to the earlier rooms afterwards.
- Mutation is random with respect to fitness, and in the drift and selection demonstrations there is no recurrent mutation unless you ask for it: the Drift and Migration rooms carry an optional mutation slider, off by default, and with it off the alleles present at the start are the only ones there will ever be. The , the and the are the ones where new alleles keep arriving throughout a run.
- The environment never changes, and neither does a fitness effect once it is set. No seasons, no droughts, no arriving competitors, no frequency- or density-dependent selection — the advantage an allele has in the first generation is the advantage it has in the last.
- The phenotype is the drawing. A polygon, a fish or a flower here is a list of shape parameters; it has no physiology, behaviour or life history, except for one axis of physiology in the . Everything the habitats care about, they care about because the model says so.
None of this makes the results less real. Each room runs the actual mathematics of the process it names, with no scripted outcomes, and the behaviour you see is what those assumptions genuinely produce. The assumptions are what tell you how far the answer travels.
A note on this beta
This is a beta version and may still contain bugs — we're continually working to improve each room. If you run into problems, have questions, or have suggestions, please get in touch with Lino Ometto at lino.ometto@unipv.it.
Acknowledgements
These laboratories were conceived and directed by Lino Ometto, who set the scientific content, the pedagogical design, the user interface design, and the choices behind every model. The simulation code, its implementation, and the explanatory texts were written collaboratively with Claude, Anthropic's AI assistant, using Claude Code.
Cookies
These laboratories count visits with Google Analytics, which stores a cookie in your browser — but only if you have accepted, either here or anywhere on the lab site, which shares your answer. Nothing is stored and nothing is sent until you do, and every room works the same either way. .
Questi laboratori contano le visite con Google Analytics, che salva un cookie nel tuo browser — ma solo se hai acconsentito, qui o in qualunque pagina del sito del laboratorio, che condivide la tua risposta. Finché non acconsenti non viene salvato né inviato nulla, e ogni stanza funziona allo stesso modo in entrambi i casi.
The Copying Room
Descent with modification – Copy a shape, copy the copy, and watch the small errors add up.
Start here
What it shows. A single starting figure is copied over and over. Every copy introduces a small random error — no error is large, and none of them is aimed at anything. You can run up to 50 lineages side by side, all starting from the same figure.
Try this. Press Start copying and watch a single lineage drift away from the shape it began as. Then switch to 3 lineages and run it again: all three start out identical, and all three end up different from one another. Set the mutation size to its smallest value and run it for many generations. Finally, switch to 50 lineages to see the whole cloud of possibilities at once.
Press Start copying to watch generation 0 begin its journey. Each lineage starts from the exact same figure — any difference you see later came from nowhere but accumulated copying error.
What this model assumes
- No population. One figure copies itself, and that is all. Nothing is born, nothing dies and nothing competes, so nothing here can be selected for or against — every change you see is copying error and nothing else.
- Traits mutate independently, inside fixed bounds. Each feature takes its own step, and the drawing holds every one inside a range so that a fish stays a fish and a flower a flower. Real traits are tied to one another by development, and real limits are pressures, not walls.
- Mutation is unbiased. A step up is exactly as likely as a step down, and the size of a step never depends on whether it would help.
- Nothing about the world changes. That holds in every room here: there is no season, no drought and no arriving competitor.
- The phenotype is the drawing. A shape in these laboratories — polygon, fish or flower — is a list of parameters, with no physiology, no behaviour, no life history. Physiology first appears in the .
What to notice
There is no selection here and no goal — yet the shapes still change, and they change in different directions. The divergence readout (Δ) climbs steadily. This is the base fact all the other rooms build on: copying is imperfect, it introduces mutations, which are not bad or good per se.
Where this goes next. The lets these lineages split, which is how one species becomes several. The picks a single one of these copying errors and follows it, in a whole population, to the end — and the zooms in on where such an error comes from in the first place.
Exactly what this room simulates
One lineage — or 3, or 50, every one of them started from the identical figure — copied for up to 400 generations, with no population, no death and nothing competing. A shape is a list of independent parameters: 18 for the polygon, 26 for the fish, 11 for the flower, counting the colours and the stroke width as well as the geometry. Each generation every parameter takes its own Gaussian step of standard deviation σ and is then clipped to the range that keeps the figure drawable, the Mutation size slider setting σ as a fraction of that range — about 0.017 at setting 1, 0.041 at 3, 0.065 at 5. The Δ on each card and the pairwise Δ under the stage are one and the same measure, a root-mean-square over the K parameters:
Δ = √[(1/K)·Σ(δk/rangek)²]Δ = 0.10 means the traits differ by a tenth of their range on average — normalising by the range is what makes the number comparable between a polygon, a fish and a flower, which have neither the same parameters nor the same units
Every parameter is therefore an unbiased random walk, and everything the room shows falls out of that one fact.
x(t) − x(0) ~ Normal(0, σ²t)no step is aimed at anything, so the cloud of 50 lineages spreads without travelling: the variance grows with time, the average does not move
E[Δ²] = σ²t, so Δ ≈ σ√tthe "Δ from origin" on each card — divergence grows with the square root of elapsed time, so twice as different takes four times as long
for two lineages, E[Δ²] = 2σ²t, so Δpair ≈ √2·Δorigintwo independent walks instead of one: the divergence line under the stage should read about 1.41 times the figure on the cards, and over 500 simulated runs it comes out at 1.40–1.43
Both laws hold until the walks start meeting the bounds, and then they stop, because the parameters are clipped rather than reflected: Δ bends away from σ√t and flattens towards a ceiling a little under 0.5. At the middle Mutation size the fit is good to a few per cent for the first 25 generations and about a quarter low by generation 100; at the smallest setting it holds out to roughly 100. That ceiling is the same wall the meets from the other side — two lineages that have both saturated are as different as this model can make them, and more time will not separate them further.
The Branching Room
Divergence & speciation – One lineage becomes many, and every new branch drifts off on its own.
Start here
Coming from the , where one lineage simply accumulated copying errors.
What it shows. The same copying process, but now lineages split. One ancestor becomes two independent lineages, each of which keeps drifting on its own and may split again. You choose when the splits happen by dragging the marks on the little tree diagram.
Try this. Run it once with the default splits. When it finishes, scroll to the Tanglegram at the bottom: on the left is the true history you just watched, on the right is the family tree an algorithm reconstructs using only the final shapes. Compare them. Then drag the splits so they all happen close together and run it again.
What this model assumes
- Lineages split and never meet again. No hybridisation and no gene flow, from the moment of a split. What it would take for that to be a real species boundary — speciation proper — is the .
- The splits are yours, not the model's. When a lineage divides is a setting; nothing in the simulation decides it.
- The same copy machine as before. Independent traits, unbiased mutation, no selection, no population and a constant world.
- Every lineage mutates at the same rate. No lineage-specific clock, so a branch's length is elapsed time and nothing else — which is why the tree here can be read straight off the drawings.
What to notice
The reconstructed tree often disagrees with the real one. Lineages that happened to drift very little can look like close relatives even when they separated long ago, and a fast-changing lineage can look like an outsider. This is the central problem of real phylogenetics: similarity is not the same thing as ancestry.
Where this goes next. The builds its founders with a small phylogeny just like this one, then shows the opposite trap: unrelated lineages that come to look alike because they live in the same place.
Exactly what this room simulates
Ancestor A splits into B and C at generation 0; where the other three splits fall — B→D,E · E→F,G · F→H,I — is yours to set. The five surviving lineages (C, D, G, H, I) then mutate independently until generation N, every one at the same rate. The step is smaller than in the Copying Room, by design: σ is about 0.007 at Mutation size 1, 0.012 at 3 and 0.017 at 5, against 0.017, 0.041 and 0.065 there — two to four times gentler. A run here is five times as long by default, and at the Copying Room's step the shapes would reach the bounds of their traits, and stop recording anything about the tree, well before the last split.
Why the reconstruction goes wrong. Each trait is an independent random walk — one Gaussian step per generation, of a standard deviation σ that the Mutation size slider sets — so two lineages that parted t generations ago have each taken t steps away from their common ancestor.
E[(x₁ − x₂)²] = 2σ²tfor one trait measured in two lineages, x₁ and x₂, that split t generations ago: the distance between them grows as √t, so it is proportional to elapsed time only under the square root
The expectation is proportional to time since the split; any one pair of lineages is a single draw from a distribution whose spread is as large as its mean. That gap between expectation and draw is the whole of the discrepancy between the true tree and the reconstructed one. Traits are also bounded, so a lineage that has wandered as far as the shape allows stops getting more different, and a very deep split ends up looking no older than a moderately deep one.
The Fate Room
What becomes of one new mutation – One mutant among N, and usually that is the end of it.
Start here
What it shows. The Copying Room let errors pile up along a single line of descent. Here we follow just one of those errors, in a whole population. A shape is copied once and comes out different — that copy is a mutation, and at the moment it appears it exists in exactly one individual out of N. Two populations then run forward in time until the mutation has either vanished or replaced every other copy. The gene for the shape now comes in two alleles — ancestral and mutant — and the graph tracks how common the mutant one is.
Try this. Press Mutate and look at the third panel, where the parent shape sits faded behind its copy. Then press Simulate evolution through time and read the tally above the two populations before watching them: it says how many populations had to be run to find one where the mutation survived at all. Do that again at N = 100 and watch that number grow. Notice how fast the losing population finishes compared with the winning one.
Step 1 — a mutation appears
Press Mutate to copy this shape once, with one random error.
Step 2 — one mutant in a population of N
The mutant is a single individual among N. Everyone reproduces on equal terms — this mutation is neutral, so it brings neither an advantage nor a handicap. The gold ring marks who carries it.
One gene, two alleles. At 0 the population carries only the ancestral form; at 1 only the mutant is left, and the mutation has become the new normal — it is fixed. Everything in between is a population carrying both.
Every allele in every population began as a single mutation in a single individual. This room follows one of them from the moment it appears.
What this model assumes
- The mutation is strictly neutral. Its fate is decided by sampling alone. A mutation with a fitness advantage is the .
- One locus, and nothing else happening in the genome. No second mutation arrives while the run lasts, and there is nothing for this one to be linked to.
- A closed population of constant size. No migration in or out, N fixed for the whole run, generations discrete and non-overlapping, and every individual equally likely to be a parent.
- Haploid. N gene copies, no genotypes and no dominance — so nothing can hide in a heterozygote here.
What to notice
Nothing in this room favours the mutation or works against it, and yet the two populations end in opposite places. The mutation is not lost because it was bad, and it does not take over because it was good — the difference is entirely chance, acting through who happened to leave offspring.
The tally is the part worth remembering. A brand-new neutral mutation survives with probability 1/N, so in a population of 20 it is lost about 19 times out of 20. Almost everything mutation produces disappears within a few generations, which is why the losing population finishes almost immediately while the winning one grinds on for roughly 2N generations.
Where this goes next. The is this same process, named and measured: it starts from a frequency you choose rather than from 1/N, and shows how population size governs the whole thing. The then gives the mutation an advantage and asks how much difference that makes — the answer, at small N, is less than you would expect. The comes at it from the other end: not what happens to a mutation, but which mutations happen in the first place.
Exactly what this room simulates
Haploid Wright–Fisher: each generation is N individuals drawn with replacement from the one before it, so a mutation at frequency p is passed on a binomial(N, p) number of times. Every trajectory drawn here is a real run of that model — none is scripted — and the batch behind the tally is re-run each time you press Simulate, which is why the numbers move a little from press to press.
What the theory predicts. The mutation starts at p₀ = 1/N, and for this model the diffusion approximation gives three results the room can be checked against.
u(p₀) = p₀ = 1/Nprobability of fixation — a neutral allele takes over exactly as often as it is already common, so roughly one population in N
E[Tfix | it fixes] ≈ 2N generationshow long the rare winner takes to get from one copy to every copy
E[Tloss | it is lost] ≈ 2·ln N generationshow long the usual loser lasts
At N = 100 those last two are about 200 generations against about 9 — which is why the losing population is finished while the winner has barely started, and why the batch behind the tally has to run on the order of N populations before it finds a winner to show you.
The Drift Room
Wright–Fisher model – A finite population resampled every generation, so allele frequencies wander by drift alone.
Start here
The followed one new mutation from a frequency of 1/N to its end. This room is the same process, named and measured: it starts from any frequency you choose, and asks what population size does to the whole thing.
What it shows. This is where the real population genetics starts. Imagine the copying errors of the first two rooms have already happened, so a population of N individuals now carries two versions of a locus — two alleles, A₁ and A₂. This room asks what becomes of that existing variation. How much of each there is, is written p: p is always the frequency of A₁ — the share of the population carrying it — so p = 0.5 is an even split, p = 0 means A₁ is gone and p = 1 means it is all that is left. That convention holds in every room from here on. Each generation is built by randomly sampling the previous one — the spinning wheel makes a single draw of one allele, and a full generation means one draw per gene copy. No allele has an advantage over the other; the only force at work is chance.
Try this. Run the default settings and watch the first two generations sample one individual at a time. Then set N = 10 and run, and afterwards set N = 200 and run again with everything else unchanged. Finally press Run 10 Simulations to see ten independent populations at once.
What this model assumes
- A closed population, and — unless you say otherwise — a closed supply of alleles. No migration in or out. With μ left at 0 there is no new mutation either, so the two alleles present are the only ones there will ever be, and that is why every run ends at 0 or 1 and stays there. Raise μ and that last part stops being true; two of these populations trading individuals is the .
- No selection. The two alleles are identical in every respect except their label. Give one of them an advantage in the .
- Wright–Fisher bookkeeping. N constant, generations discrete and non-overlapping, mating at random, and every individual with an equal chance of leaving offspring. Real populations do none of these exactly, which is why the N here is better read as an effective population size than as a head count.
- One locus, alone. Nothing is linked to it and nothing interacts with it. Two loci travelling together is the .
- In Diploid mode, genotypes are in Hardy–Weinberg proportions. The model draws 2N gametes and pairs them at random rather than tracking who mated with whom. Why that is allowed is the .
What to notice
Small populations lurch around and quickly end up with only one allele left; large populations barely move, but will eventually also fix an allele, although after more generations. In fact, one important point to note is that in evolution time is measured in generations, not years. Once an allele reaches 0 or 1 it can never come back — drift permanently destroys variation. And across ten identical runs the outcomes differ wildly, which is why a single run can never tell you what a random process "does".
Press Run 10 Simulations and look at the second chart, not the first. Read those ten runs as ten loci in one population rather than as ten populations — unlinked loci drift independently of each other, so it is the same arithmetic either way — and their average heterozygosity is that population's genetic diversity. The ten trajectories above disagree about everything that looks important: which allele wins, when, whether anything is settled by the end. The single diversity curve below them does not. It follows the dashed line, which is not fitted to anything — it is computed in advance from N and the ploidy alone.
That is the real content of this room, and it is why nobody measures diversity at one locus. Drift is unpredictable about which variation it removes and highly predictable about how much: the rate depends on the number of gene copies and on nothing else whatever — not on the starting frequency, not on which allele happens to be ahead. One locus is noise. The average over many is a number you can reason about, and it is the number a real study reports.
Then put the mutation slider up and run it again. Everything above was about a population with no new alleles arriving, and all of it was true of that population: variation only ever goes down, 0 and 1 are the end, every run finishes there. With μ above 0 none of it holds. An allele at 0 comes back, because mutation keeps remaking it; runs no longer end; and the heterozygosity curve, instead of decaying to nothing, flattens out at the level drift pulling down and mutation pushing up settle on between them (and the summary line reports where it landed against where the arithmetic says it should). At N = 50 and μ = 0.005 that balance sits near H = 0.25 — half of the most that two alleles can give you. Real populations live at a balance of this kind. The run that ends at 0 or 1 is what you get by leaving the supply of new variation out of the model.
Where this goes next. The keeps this machinery and gives one allele an advantage, so you can watch selection and drift compete. The asks where the two alleles came from to begin with, and the runs two of these populations side by side with a few individuals crossing between them.
Exactly what this room simulates
The first two generations are sampled one individual at a time on the wheel, in real time, so you can see where a frequency actually comes from. After that each generation is drawn in one go, without the wheel, and the run moves on at about five generations a second: fast enough to watch, slow enough to follow. Nothing is replayed from a script — each frequency is the outcome of its own binomial draw.
The three results the panels are drawing. Write M for the gene copies sampled each generation: M = N under haploidy, M = 2N under diploidy.
Var(Δp) = p(1 − p)/Mhow far one generation of sampling can move the frequency: largest at p = 0.5, and smaller in every larger population — this is the curve the variance panel plots
u(p) = pprobability of fixation: with nothing favoured, an allele's chance of ending up as the only one is simply how common it is now
H(t) = H₀(1 − 1/M)t ≈ H₀e−t/Mheterozygosity — the variation still left — decays by a factor 1/M per generation, so half of it is gone after about 0.69M. This is the dashed line on the Run 10 Simulations heterozygosity chart
E[Tfix] ≈ 2M generationshow long an allele that does fix takes to get there — 4N under diploidy, 2N under haploidy
Read together they say that fixation is not a special event but the end every run has: drift removes variation at a rate set by M and nothing else, and a locus started at p = 0.5 reaches one edge or the other after about 1.4M generations on average.
What the mutation slider does. Each gene copy has a probability μ of turning into the other allele as it is passed on, the same rate in both directions — so mutation on its own pulls the frequency towards 0.5 rather than towards either allele. It is applied to the frequency the next generation is drawn from, after the wheel has been sized, which is why the wheel grows a small tick at the un-mutated frequency once μ is above 0: the gap between tick and slice is what mutation did. Two things follow. Sampling is now from p′ rather than p, which is what the binomial panel's label changes to say; and 0 and 1 stop being absorbing, so a run does not end when it reaches one.
Composing mutation with sampling gives one exact recursion for the expected heterozygosity, and it is what the dashed line is drawn from at every setting:
E[Ht+1] = (1 − 1/M)·[(1 − 2μ)²Ht + 2μ(1 − μ)]at μ = 0 this is the decay above; above 0 it climbs or falls to a balance instead of to zero. At M = 50 and μ = 0.005 the balance works out at H = 0.247, and 4,000 simulated runs put it at 0.249
Where the default G comes from. The generations slider opens at 1.5 × E[Tfix], which is 3M, so a run at the default settings has room to finish instead of stopping part-way through the wander. It follows N and the ploidy as you change them, and stops following the moment you move the slider yourself. It is a generous figure at p = 0.5: 2M is the time for an allele starting from a single copy, and one starting at half takes closer to 1.4M, so most default runs reach an edge with generations to spare.
The Selection Room
Wright–Fisher model + selection – The same sampling, but now selection pushes one allele — and drift pushes back.
Start here
The let chance alone decide. Now one allele is genuinely better — and chance is still in the room.
What it shows. Exactly the same sampling machinery as the Drift Room, with one addition: allele A₁ now carries a fitness advantage s. Before each generation is drawn, the frequency is reweighted by fitness — so selection tilts the odds, and then ordinary random sampling does the drawing. Under diploid settings you can also set dominance h.
Try this. Run with s = 0.1 at N = 200, and notice how closely the real trajectory tracks the dashed line (which is what selection would do with no randomness at all). Then run the same s = 0.1 at N = 10. Finally switch to Diploid, set s = 0.2, and compare h = 1 against h = 0.
What this model assumes
- Fitness is constant. s does not change with time, with frequency, or with anything the population does. No fluctuating selection, no frequency dependence, no density dependence — the advantage you set on generation 1 is the advantage on generation 900.
- A closed population, and no new mutation. The favoured allele has to be present at the start; nothing arrives from elsewhere and nothing new appears. A single new copy, and what usually becomes of it, is the .
- One locus, alone. No linked loci, so a favoured allele is never dragged down by a bad one beside it and never carries a good one to fixation with it. That interference is the .
- Wright–Fisher bookkeeping. Constant N, discrete generations, random mating, selection acting through the chance of being drawn as a parent rather than through survival or mating at any particular moment.
What to notice
What matters is not s by itself but N·s — the product of population size and advantage. Treat that as a rule of thumb rather than a law: the size that belongs in it is the effective population size, and where exactly the balance tips also depends on ploidy, on dominance and on the details of the life cycle. In this room all of those are pinned down, which is why the plain N on the slider will serve — Wright–Fisher sampling is the very thing effective size is measured against. In a small population, drift regularly overwhelms a genuine fitness advantage and loses it. And a recessive advantageous allele (h = 0) is nearly invisible to selection while it is rare, because it is hiding inside heterozygotes, so it too can be lost like a neutral allele.
Where this goes next. The shows the half of the story this room cannot tell: selection decides a mutation's fate, but has no say in whether it appears. The then runs selection and drift on five traits at once.
Exactly what this room simulates
Each generation the raw frequency p is reweighted to p′ = p(1+s) / (p(1+s) + (1−p)) before the usual binomial sampling — so p′, not p, is what the wheel spins on and what the binomial panel draws from. In Diploid mode the weights are genotypic — w(A₁A₁) = 1+s, w(A₁A₂) = 1+h·s, w(A₂A₂) = 1 — and p′ is the allele frequency computed from those weighted genotypes. The dashed line on the chart is the path that same reweighting would take with no sampling noise at all.
Where that leads. Without sampling, the haploid recursion has a closed form — the allele's odds multiply by (1 + s) every generation:
pt/(1 − pt) = [p₀/(1 − p₀)]·(1 + s)tthe dashed line: an S-shaped sweep, slow while the allele is rare and slow again while the last few of the other allele are mopped up
Sampling turns that certainty into a bet. The fixation probability from frequency p, for the haploid model, is Kimura's diffusion result:
u(p) = (1 − e−2Nsp)/(1 − e−2Ns)for one new copy, p = 1/N, this is about 2s whenever Ns ≫ 1 — an allele with a 10% advantage is still lost about four times in five
How long that sweep takes, once it is under way, is the other figure the room uses:
E[Tfix] ≈ (2/s)·ln M generationswith M the gene copies — (2/s)·ln 2N under diploidy — so a strong advantage sweeps in a few dozen generations and a weak one takes thousands
Where the default G comes from. The generations slider opens at 1.5 × that, and follows N, the ploidy and s until you move it yourself. It is capped at the neutral 3M, because (2/s)·ln M runs away as s approaches zero while the truth does not: with s that small it is drift that decides the outcome, on drift's timescale. That cap is also what the slider does at s = 0, where the room is the Drift Room with an extra control.
Two limits are worth setting the sliders to. When |Ns| is around 1 or less the exponentials nearly cancel and u(p) → p, the neutral answer: the advantage is real, but the population is too small for it to be the thing that decides. When Ns ≫ 1 the runs hug the dashed line. In Diploid mode the same approximation for a new mutation is 2hs rather than 2s, which is why lowering h towards 0 makes a genuinely advantageous allele so easy to lose: while it is rare it is almost only ever in heterozygotes, and a recessive advantage is invisible there.
The Mutation Room
Mutation is random with respect to fitness – Four wheels of possible changes, and no amount of selection resizes a slice.
Start here
The decided which of two alleles won. This room asks where they came from in the first place.
What it shows. The Selection Room let selection decide which of two alleles won. This room asks the prior question: where did those alleles come from, and does selection have any say in that? Four spinning wheels, one per character — body shape, body colour, tail size and fin size. Each wheel's slices are the possible derived states, deliberately different sizes: some mutations are simply more likely than others. Spin, and the four results become a new mutant fish. Each derived state is then an independent allele: a panel plays out all four frequencies in a population of N over G generations, and a final panel shows the population's fish at the end.
Try this. Press Spin and watch the four alleles enter the population as single copies and drift — usually to loss. Then switch Fate of the alleles from Neutral to Selection — the same selection coefficient s you set in the Selection Room, here shared by all four characters: the stream favours a slender body, blue colour, a long tail and short fins (marked ★). Raise s and watch two things at once — the wheels, and the allele-frequency lines.
In nature the mutation rate — the chance that a character changes from its ancestral state to a derived one — is extremely low, on the order of one error per hundred million sites per generation in many cellular organisms, ourselves among them — though it is not one figure for all of life, and RNA viruses run orders of magnitude higher. Here we set that aside and simply assume a mutation occurs in each of four characters, then ask which derived state appears.
This fish lives in a fast-flowing stream. The current favours a slender body, blue colouring, a long tail and short fins — fish carrying those states survive and reproduce more.
Set a single selection coefficient s — the same s as the Selection Room, here shared by all four characters. Two places to watch: the wheels (the favoured slices, marked ★, never change size) and the Derived alleles panel (where the favoured alleles now climb and the rest are pushed down).
What this model assumes
- Mutation probabilities are stipulated, and never depend on fitness. Some derived states are far easier to reach than others — that asymmetry is the point of the wheels — but no slice is larger because the state it leads to would be useful.
- Four independent loci. No linkage between them and no epistasis: a mutation's effect does not depend on what the other three are doing.
- One copy, once. Each new allele enters at frequency 1/N and no second mutation ever arrives at the same locus, so nothing here is rescued by a repeat attempt.
- A closed population of constant size, with no migration, and a fitness effect that stays what it was when the mutation arose.
What to notice
Selection bends the frequency lines — favoured alleles climb, the rest are pushed down — and reshapes the fish after G generations. But however hard you push, the ★ wheel slices never change size. That is the whole point, and it is the half of the story the Selection Room could not tell: selection governs a mutation's fate, never its origin. Mutation proposes, blindly; selection disposes.
Where this goes next. The puts the two halves together: mutation keeps proposing, blindly, and selection keeps disposing — across five traits and three habitats.
Exactly what this room simulates
One spin makes four derived alleles at four independent loci, each entering a population of N as a single copy at frequency 1/N. Every run tracks at least G = 2.5·N generations and extends automatically until all four have fixed or been lost, which is when the four lines come to share one axis. With selection on, each allele is reweighted by its fitness exactly as in the Selection Room — and no value of s ever resizes a wheel slice.
What the four lines should do. Each allele enters a haploid population at p₀ = 1/N, so with selection off:
u = 1/N for each · E[number of the four that fix] = 4/Nat N = 50 that is 0.08 alleles per spin, so most spins end with all four lines on the floor
E[Tfix | it fixes] ≈ 2N generationswhere the 2.5·N default for G comes from: long enough for a typical winner to finish, short enough that the chart is not mostly flat line
Switching selection on replaces the first of those with u(1/N) = (1 − e−2s)/(1 − e−2Ns) ≈ 2s for a beneficial allele — a different number, arrived at without touching a single wheel. That is the room's whole point written as two equations: the wheel sets how often a variant is made, s sets what becomes of it afterwards, and they are separate parameters of the same run.
The Migration Room
Two populations, one exchange – Drift pulls two populations apart; a handful of migrants a generation holds them together.
Start here
The ran one population until its variation was gone. Run two of them side by side and something a single population cannot show you appears: they lose their variation in different directions, and end up fixed for different alleles. This room puts back the one thing that stops that happening — a few individuals a generation moving between them.
What it shows. Two populations, A and B, each of N individuals, each carrying the same two alleles, A₁ and A₂ — the letters name the populations, the digits name the alleles. Every generation happens in two steps, in this order. First each population samples its own next generation, exactly as in the Drift Room: that is drift, and it is what pulls them apart. Then M individuals cross in each direction: that is gene flow, and it is what pulls them back together. The whole room is those two forces running against each other, and the question is how much gene flow it takes to win.
Why the slider counts individuals rather than setting a rate. The classic result is about a number of migrants, so that is what the control gives you: M, the individuals that cross each way each generation, a number you can count on the screen. Beside it the deck reports the same setting in the two forms the literature writes it in — the migration rate m = M/N, and the product Nm, which here is just M back again. Hold M at 1 and drag N from 20 up to 200: m falls by a factor of ten while the two populations go on behaving the same way. That is the surprise this room is built around. What holds two populations together is the number of migrants they exchange, not the fraction of each that migrates — so a trickle that is negligible as a rate is not negligible at all.
Try this. Press Run on the defaults: A starts at p = 0.90, B at p = 0.10, and one individual crosses each way. Watch B climb to meet A — and notice how the run ends. The two do not drift apart and stay apart; they come together and then lose the last of their variation as a pair, usually within the first couple of hundred generations. Now set the migrants to 0 and run again: nothing pulls B up, and a good half of these runs end with the two populations fixed for different alleles instead. Then set both starting frequencies to p = 0.50 and press Run 20 Replicates, first at 0 migrants and then at 1 — around thirteen runs in twenty become strongly differentiated at some point without migrants, and around five with one. Finally press Run the sweep. Runs vary enormously, so nothing above can be seen from any single one of them.
What this model assumes
- Two populations, not many. The rule of thumb is usually quoted for an island model — many populations all exchanging with a common pool. With two, the qualitative result is the same and the arithmetic behind it is not: the same Nm buys more cohesion between two populations than between twenty, because each one's migrants all come from the only other place there is.
- Migration is symmetric, and neither population changes size. The same M crosses each way, so N is the same at the end of a generation as at the start. Real gene flow is usually lopsided — one population a source, the other a sink — and that asymmetry is exactly what decides which of the two ends up carrying the other's alleles.
- Migrants are a random sample of where they came from. Nothing about an individual's genotype makes it more or less likely to leave, and a migrant breeds on arrival like anyone else. Real dispersers are frequently not a random sample of their population.
- Haploid, one locus, and no mutation unless you ask for it. One locus with two alleles and no linkage. Ploidy is a setting in the ; two loci at once are the . With μ left at 0 nothing replaces the variation drift removes, so the pair does eventually fix for one allele between them however much they exchange, and what this room measures is the differentiation that builds up before that — which is what the rule of thumb is about. Raise μ and the variation stops running out, but note what that does and does not buy you: with only two alleles, mutation pulls both populations towards p = 0.5, so it reduces differentiation rather than preserving it.
- Selection, when you switch it on, is exactly opposite in the two populations and constant throughout. That is the cleanest case and not a typical one: real habitats differ by degree, not by sign. Selection against an unchanging habitat is the .
What to notice
With no migrants the two populations are simply two Drift Rooms, and they end up wherever chance sends them — often at opposite edges, which is as different as two populations can be. One migrant a generation changes that: the two lines stay within sight of each other, and the pair behaves far more like a single population of 2N than like two populations of N.
The sweep is where that claim gets tested, and it comes back with two different answers. Mean FST — the quantity actually reported in papers — slides down steadily as migrants are added and falls off nothing in particular. The share of runs that ever become strongly differentiated does fall off a cliff, and the cliff is at one migrant a generation: without migrants about two runs in three get there, at half a migrant about one in two, at one migrant about one in four, and at two migrants almost none. The rule of thumb was never a claim about the average. It is a claim about preventing complete differentiation, and it is right about that.
Then notice what the cliff is measured against. It is Nm — a number — and not m. Ten migrants into a population of a thousand is a migration rate of 1%, and it keeps that population welded to its neighbour; one migrant into a population of ten is a rate of 10%, ten times larger, and does less. This is why "these populations exchange less than one percent of their individuals" is not, on its own, an argument that they are diverging.
One thing the equilibrium does not tell you is how long it takes to get there. Raise N with M held at 1 and the two populations end up just as tightly bound — but they take proportionally longer to arrive, because everything about drift is slower in a big population. The end state depends only on the product; the time to reach it depends on N.
With local adaptation switched on the same contest is run against selection instead of drift, and the answer changes shape: what matters is now the comparison between m and s. When migration is the weaker of the two each population keeps its own favoured allele and a stable difference between them survives indefinitely; when it is the stronger, gene flow swamps local adaptation and both populations end up carrying the same allele, whichever one the exchange happens to favour. A population can be prevented from adapting to where it lives by immigrants from somewhere else.
Where this goes next. The sets the migrants to zero permanently and asks what accumulates over a thousand generations of that. This room is why it has to: with even a trickle of gene flow, almost none of it would.
Exactly what this room simulates
One generation, in order. Each population independently draws N individuals from its own current gene pool — a binomial draw at its own frequency, the Drift Room's recursion run twice — and only then are the migrants exchanged. So the frequencies the chart plots are post-migration frequencies, and the drift that happened in a generation is always drift within a population, never drift on a pool the two share.
Fractional migrants. Settings below one migrant are real settings, not rounded ones: at M = 0.3 a single individual crosses in three generations out of ten, chosen at random, and none in the other seven. The number that crosses in a given generation is shown on the panel, so a reader can see that "0.3 migrants" is a statement about the long run and never about a generation.
What the exchange actually does. M individuals are picked at random from A and M from B, and they swap places. Both populations therefore stay at exactly N, and the expected change in A's frequency in one exchange is
E[ΔpA] = m(pB − pA), with m = M/Ngene flow always pulls a population towards the other one, by a fraction m of the gap between them — so it can close a difference but never create one
How differentiation is measured. FST compares the variation within the two populations against the variation in the two taken together. Writing p̄ for the average of pA and pB:
HS = ½[2pA(1−pA) + 2pB(1−pB)] · HT = 2p̄(1−p̄) · FST = 1 − HS/HT0 when the two populations have the same frequency, 1 when each is fixed for a different allele, and undefined once neither carries any variation at all
What the sweep measures, and why no curve is drawn over it. Each point is a hundred runs at that setting. The teal series is the mean of each run's own mean FST; the gold series is the share of those hundred runs in which FST reached 0.5 at any point, which is this room's operational reading of "completely differentiated".
Every sweep run starts at p = 0.5 in both populations, whatever the deck says, and that is not a detail. The sweep asks how much differentiation drift manages to build against a given amount of gene flow, which can only be measured from populations that begin with none. Started at the default p = 0.90 and p = 0.10 the two are already past the 0.5 mark before the first generation is drawn, and the panel would report every setting as complete differentiation and mean nothing by it.
The result every textbook quotes is FST ≈ 1/(1 + 4Nm), and it does not describe this room directly. It is the many-island result, and with two populations the coefficient is about four times larger — closer to 1/(1 + 16Nm) — because each population's immigrants all come from the only other place there is. It is also an equilibrium between migration and mutation, and with the mutation slider at its default of 0 — which is where every figure below was measured — nothing here replaces what drift takes away.
Given both of those, the measured means come out closer to the two-population formula than you might expect. At N = 50 they run about 0.31, 0.20, 0.15, 0.09, 0.05 and 0.03 as Nm goes 0.1, 0.3, 0.5, 1, 2, 4, against 0.38, 0.17, 0.11, 0.06, 0.03 and 0.015 from 1/(1 + 16Nm). The same shape throughout, crossing from a little below the formula where migration is weakest to about double it where migration is strong — the excess a pair of populations on their way to losing all their variation would be expected to carry. The room plots what it measured and leaves the formula in this paragraph, where its assumptions can be stated alongside it, rather than drawing it across the panel as though it were the answer.
Turning the mutation slider up does not close that gap — it opens a different one, and the reason is worth having. Mutation does the job it was added for: the variation stops running out, so a run can be carried as long as you like and FST settles at a value rather than being a quantity measured on the way to nothing. But it does not push the numbers up towards the formula. Over a thousand runs the no-migration end falls — mean FST of 0.44, 0.32 and 0.24 at μ = 0, 0.002 and 0.005 — and carried all the way to stationarity it falls further still. The reason is that this room has two alleles, and symmetric mutation between two alleles pulls both populations towards p = 0.5. It is a homogenising force in its own right: a second thing making the two more alike, working alongside the migrants. The formula assumes the opposite arrangement — infinitely many alleles, so mutation only ever makes variants that are new, adding diversity inside a population without making two populations any more similar to each other. What survives is the part that matters: the share of runs reaching 0.5 at Nm = 1 is 27%, 25% and 24% across those same three settings. Gene flow's cliff does not move.
Where the default G comes from. 200 generations is 4N at the default N = 50 — long enough for a run with no migration to reach an edge, and for a run with migration to settle and stay settled long enough to be worth averaging. Like the Drift Room, it follows N until you move it yourself.
The Adaptation Room
Multi-trait selection vs. drift – Five traits, three habitats: selection and drift pulling together.
Start here
Everything so far, combined.
What it shows. Everything so far, combined. Three founder fish — Gigi, Mario and Nani — are produced first by a small branching phylogeny, as in the Branching Room: one ancestor, three splits, and an outgroup alongside the three founders. Each founder then splits into two lineages: a Neutral one where nothing is selected, and a Habitat one assigned to a Stream, Pond or River. Five traits (shape, colour, eye size, fin size, tail size) each behave as an independent locus, mutating and then running a full Wright–Fisher trajectory exactly as in the Selection Room. Each habitat favours a different combination of traits.
Try this. Press Run and watch the two lineages of each founder evolve side by side from the same ancestor. When it finishes, read the table under Each lineage against its own founder: a row for Neutral and one for Habitat, a column per founder, and the mean of each row at the end. Then take the three preset tasks in turn — each sets the controls and runs, and the status line tells you what to look for: same habitat, different founders for convergence, turn selection off as a control, and small vs large population for what population size does to both.
More parameters (mutation size, selection & mutation rate per trait, population size)
Final divergence matrix (Δ, 0.00 = identical): generation-0 founder (rows) vs. each lineage's final consensus fish (columns).
Each lineage against its own founder:
Tanglegram Comparison:
Left: the actual lineage history — one ancestor split three times before the run began, producing an outgroup and the three founders, each of which then divided into a Neutral and a Habitat lineage. Right: the tree inferred using only the seven lineages' final observable shapes, drawn in its own order. A dotted line joins each final shape to its place in the inferred tree; where lines cross, the reconstruction has moved those lineages. The true branching order is there to be recovered — does the reconstruction find it?
What this model assumes
- One trait, one locus. Five traits, five independent loci of large effect. Real morphology is polygenic, with many loci of small effect per trait, and this room would look very different if it were.
- No linkage and no epistasis. The five loci are inherited independently and never interact: no combination is worth more or less than its parts. Two loci that travel together is the .
- The habitat never changes. The Stream does not dry, the Pond does not silt up, and every selection coefficient holds for all G generations.
- What each habitat favours is stipulated. It is a rule the room applies, not something derived from the physics of swimming or the behaviour of predators. The direction is a claim about biology; the number attached to it is a setting.
- The lineages never exchange genes, and each is a closed population of constant size with the Wright–Fisher bookkeeping of the earlier rooms.
What to notice
The Habitat lineages travel much further from their ancestor than the Neutral ones — that gap is what selection contributes on top of drift. Two unrelated founders placed in the same habitat tend to converge on a similar look, which is convergent evolution. And in the trait tables, notice that new mutations keep arising in both lineages at much the same rate — mutation is blind to habitat. What selection changes is not how many mutations appear but the probability that they change in frequency compared to a neutral one: it turns far more of them into fixed substitutions.
Where this goes next. One question is still open. These lineages diverged, but they never stopped being able to interbreed — nothing here would prevent a Neutral fish and a Habitat fish from producing offspring. The takes two populations that genuinely cannot exchange genes and asks at what point they stop being one species.
Looking back. Every thread meets here: copying error from the , splitting lineages from the , blind mutation from the , and the tug-of-war between drift and selection from the and the .
Exactly what this room simulates
Each of the five traits is its own independent locus. While it is monomorphic it has a chance μ per generation of producing a new variant, which then runs a real diploid Wright–Fisher trajectory — selection and drift, with the beneficial allele fully dominant (h = 1) — until it fixes or is lost. A mutation's selection coefficient is signed at the moment it arises, positive if the step it makes happens to move the trait the way its habitat prefers and negative if it does not, and it does not change afterwards.
Two rates set the pace, and only one of them involves N. Supply first: a monomorphic locus waits a geometric number of generations for its next mutation.
E[wait for a mutation] = 1/μ generationsabout 100 generations per locus at the default μ = 0.010 — and N does not appear, because μ here is per locus per generation, not per gene copy
Then fate. The derived allele is fully dominant, so its advantage is exposed from the first heterozygote and Haldane's approximation applies directly:
u ≈ 2s when the step went the way the habitat prefers · u = 1/(2N) when the habitat cannot see the trait at alla mutation's step points the way the habitat prefers about half the time, so adaptive substitutions arrive at about μ · ½ · 2s = μs per generation, and the expected wait for one at a locus is about 1/(μs) — roughly 500 generations at the defaults μ = 0.010, s = 0.20
Together they say what a larger N is and is not doing here. It buys no extra mutations at all; what it buys is sharper sorting of the ones that arrive, because the neutral route to fixation shrinks as 1/(2N) while the selected route stays at 2s. The ratio between the two is 4Ns, so a small population fixes a great deal of what its habitat never asked for.
The Speciation Room
Divergence in isolation – One population split in two, no gene flow: when do they stop being one species?
Start here
Two populations, one ancestor, and nothing passing between them.
What it shows. One ancestral population of N fish lives in a lake, and has done for a thousand generations — so it is already a lake fish: deep-bodied, amber, big-eyed and long-finned, shaped by the place it lives in. An adapted population is not a uniform one, though. It carries 1,013 loci, and the variation at them is drawn from what a population at mutation–drift equilibrium actually has: about a third of the loci are monomorphic, and the ones that do vary mostly carry a rare second allele. How much of it there is comes down to θ — the ancestral population's own property, independent of the mutation rate you give the run ahead — and the ancestral card reports what it produced. Those loci are of three kinds: 13 that build the five traits — three for shape, four for colour, one for eye size, two for fins, three for the tail; 40 that build no part of the fish but set what its body has to do to live where it lives — how it takes up oxygen, holds its salt balance, pays for swimming; and 960 that neither habitat has any use for. The middle group is 4% of the non-morphological genome, and it matters because still water and fast water make different physiological demands: those loci are under selection too, even though nothing about them can be drawn.
The population splits into two groups. Population A remains in the original lake. Population B, founded by N₂ individuals, moves away — either to another lake, which is a different location but the same type of habitat, or to a stream, which is not. In either case, the two populations are permanently separated. From the moment of the split, nothing is exchanged: no migration and no gene flow. What each population does with the variation it carries is determined by drift and whatever its habitat favours, as well as new mutations that arise within it.
After G generations, we ask whether they are still one species. We apply two independent tests: fixed differences, standing in for the genetic incompatibilities that break hybrids, and divergence in a mating signal, standing in for the failure to recognise each other as mates.
Try this. Press Run, then send B to another lake and run again, and compare the morphological fixed differences — the gold line. Divergent selection in the stream sorts most of those 13 loci — around 8 of them end up fixed differences. Two lakes manage about 5: parallel selection is pushing both populations the same way, so what divergence there is has to come from their fixing different mutations to get there rather than from being pulled apart. Then notice how little either choice moves the black line: 960 loci that neither habitat selects on carry the genome-wide count, whatever B does. Then look at the ledger below the strip. The 40 physiological loci collect around 28 fixed differences in the stream and around 22 between two lakes — against about 120 from the 960 neutral ones, which is five times fewer per locus. A mutation at a locus selection can see fixes far more often than one at a locus it cannot.
Runs differ a great deal, and that is the model being honest rather than noisy — at realistic variation, whether a trait can respond at all depends on which few variants the ancestral population happened to be carrying. At the default settings a move to the stream ends in speciation about four runs in five, and a move to another lake about one in three: the habitat shifts the odds without deciding the outcome, so a single run tells you far less than a handful do. Press New Ancestral Population a few times to see the spread — how far a trait can move is decided partly by which variants that particular ancestor happened to carry. Then raise θ: a more variable ancestor makes everything faster and more repeatable, and you can watch the polymorphic count on the ancestral card climb as you do it.
More parameters — ancestral diversity, selection strength, mutation rate, per-locus effect size
Ancestral population
Population A — stayed put
Population B — moved away, N₂ founders
All 1,013 loci, side by side: one column per locus, the upper row population A and the lower row population B, shaded by how far that locus has moved from the ancestral allele — palest while the whole population still carries it, darkest when none of it does. A fixed difference is a column where the two populations have settled on different alleles; those are marked in red underneath. On the left, the 13 loci that build the traits, grouped by trait and tagged with how the two habitats treat each one. Then, as a narrow barcode, the 40 physiological loci — they change nothing about how the fish looks, but the two habitats make different demands of them, so they are under selection too. The wide barcode on the right is the remaining 960, which neither habitat has any use for. The physiological band is drawn far wider than its share of the genome, or there would be nothing to see in it.
Where the new mutations went: every new allele that arose after the split, counted by the kind of locus it landed on, beside how many of them went all the way to fixation — which is what makes a mutation a substitution. Mutation is blind: the first column follows the number of loci and nothing else, 13 against 40 against 960. What selection changes is the fate of a mutation, and that is the last row.
The two criteria over time: the dashed red line in each chart is the threshold you set. Once a line crosses it, that barrier is up. In the left chart the gold dashed line is the part of the count contributed by the 13 morphological loci, and the grey dotted line the part contributed by the 40 physiological ones — neither can rise above the number of loci it counts, so both stay near the floor while the black total climbs past them.
Divergence in shape (Δ, 0.00 = identical): the same normalised distance between mean fish used in the Branching and Adaptation rooms — how far apart they look, as opposed to how many loci have actually sorted.
What this model assumes
- No gene flow — and here that is the premise, not a simplification. The room asks what accumulates between two populations that never exchange a gene. Any migration at all would slow or undo it. How much is the , and its answer is the reason this one has to close the door completely: a single migrant a generation would hold these two populations together for as long as you cared to run them.
- 1,013 loci, all inherited independently. No linkage anywhere in this genome, which is why divergence accumulates as smoothly as it does. A real genome sorts in blocks.
- Incompatibility is counted, not modelled. The room treats fixed differences as a proxy for Dobzhansky–Muller incompatibilities — but a real incompatibility is an interaction between two loci, and no interaction between loci is simulated here. X and Y are thresholds you set, not measurements.
- At most two alleles at a locus at a time, and mutation strikes only a locus that has gone monomorphic. Both are for legibility; real loci carry more, and mutate whenever they please.
- Two habitats that never change, each with fixed preferences, and a phenotype that is a drawing plus one axis of physiology.
What to notice
Nothing here is a speciation mechanism. There is no machinery in this room that is not already in the Drift and Selection rooms — the same sampling, the same fitness bias, one locus at a time, 1,013 times over. Speciation is what that ordinary machinery amounts to once two populations stop exchanging genes. Isolation is not the result; isolation is the starting condition.
Most of the divergence is at loci nobody is selecting. 960 of the 1,013 loci are of no use to either habitat, and that is where most fixed differences end up — around 120 of them in a default run. Selection sorts the 53 loci it acts on much faster, five times faster per locus, but 53 is a small number against 960, so the total is carried by drift almost entirely. Moving population B to the stream rather than to another lake shifts the total by about nine differences out of 150 — six per cent, and all of it from the 53: whichever habitat B lives in, genome-wide divergence is set mostly by population size and elapsed time. It is closer to a clock than to a record of adaptation — which is exactly what makes it such a good clock.
Mutation is blind; substitution is not. This is the ledger under the strip, and it is the sharpest statement of what selection actually does. New alleles arrive at every locus at the same rate, so they arrive in proportion to how many loci there are: 13 to 40 to 960, and no habitat, effect size or selection strength changes that. Selection cannot make a useful mutation happen. What it changes is what becomes of one after it has happened — at the loci it can see, a new allele fixes tens of times more often than a neutral one does. Adaptation is not a matter of the right mutations arising; it is a matter of which of the ones that arise anyway get anywhere.
Adaptation is mostly invisible. Only 13 of the loci under selection here change how the fish looks; the other 40 change how it works, and a photograph would not show one of them. Two populations can look nearly identical and still have rebuilt their physiology in opposite directions — which is why a run to another lake, where the fish stay the same shape, still fixes twenty-odd differences at loci that matter a great deal to the animal.
Divergence is capped by the variation that was there to start with. A standing variant can only become a fixed difference if the locus was polymorphic in the ancestral population, and at equilibrium about a third were not. The two populations must then fix opposite alleles, which for a locus at frequency p happens with probability 2p(1−p) — and most standing variants are rare, so most of them are simply lost on both sides. Added up, that is the number of loci times the ancestral heterozygosity: about 120 of the 1,013 at the default θ, which is why most of a default run's 150-odd fixed differences come from the standing variation and why raising θ raises them — it is the only thing that puts more sortable variation into the ancestor. Raising μ works differently: it adds alleles that did not exist at the split, and those are what carry the count past that ceiling.
Drift can do it on its own. Send population B to another lake and run for long enough: fixed differences still accumulate, because in each population every polymorphic locus eventually fixes, and which allele it fixes is decided independently on the two sides. Selection does not make speciation possible.
But a count of fixed differences is not, by itself, evidence of two species. The verdict reads “two species” once the count passes X — and X is a threshold you chose, applied to a number that is pure bookkeeping. Two populations left alone for long enough accumulate fixed differences whether or not anything has gone wrong between their genomes, which is precisely what the paragraph above says: the black line climbs in the second lake too, on drift alone, at loci no habitat ever looked at. Nothing in this room tests a hybrid, because no locus here interacts with any other. Divergence on this scale is a reason to go and look for reproductive isolation; it is never a demonstration of it.
Same kind of habitat, and selection now works against divergence — but only on the variation the two populations share. This is the surprise, and it has a second half. With both populations in lakes, the 13 morphological loci are under identical selection, so both sides tend to fix the same ancestral allele — fewer fixed differences at those loci than drift alone would have delivered. Yet the 40 physiological loci still rack up around 22, nearly as many as the stream's 28. The reason is that a mutation is local: when both populations are adapting to the same demand but each is doing it with new alleles of its own, they arrive at the same physiology by different genetic routes, and every one of those routes is a fixed difference. Parallel adaptation does not mean parallel genetics. Selection opposes divergence only where the two populations are sorting the same alleles.
The two barriers are not the same size. Post-zygotic isolation is genome-wide bookkeeping: it needs many loci to have sorted, so it is slow, and slowest of all in a large population. Pre-zygotic isolation through a mating signal can be reached by one trait moving far enough — and in the stream, body colour is under selection and is the signal by which mates are chosen. A trait doing both jobs at once is the fast lane, and it is why the fastest speciation in nature so often involves exactly that.
Two sources, two speeds. Watch the fixed-difference curve change character. It climbs steeply while the two populations sort the variation they carried away from the home lake, then bends as that is exhausted — a small N₂ reaches that wall in a few dozen generations. What follows is the second regime: new alleles arising in one population and nowhere else, each starting at a single copy. By the end of a default run population A has fixed around twenty of them and population B around fifty — more than half of B's at loci nothing selects on, because drift carries a new allele to fixation far more readily in the smaller population. Standing variation is fast and finite; mutation is slow and never stops, and only the second one has no ceiling.
Why the beneficial allele being dominant matters. A new mutation spends its whole early life in heterozygotes. Were it recessive there, selection could not see it at all and drift would take nearly every one before it mattered. Dominant, it is exposed from the very first individual carrying it — which roughly doubles its chance of fixing, and is the difference between new mutation contributing to adaptation here and being a rounding error.
Looking back. The showed lineages splitting and diverging in appearance; this room asks the question that one left open — at what point does the split become permanent? The sorting of each locus is the and the running 1,013 times over, and the traits are the ones from the .
Where this goes next. That is the argument complete. What follows in Part IV is the machinery underneath it: the on how a generation is actually made, the on the bookkeeping every population-genetics room here has been using, and the on what changes when two loci travel together.
Exactly what this room simulates
The ancestral population. 1,013 independent diploid loci. Each locus's minor-allele frequency is drawn from the mutation–drift stationary distribution Beta(θ, θ) and rounded to a whole number of copies out of 2N, so about a third of the loci come out monomorphic and the variation at the rest is mostly rare — a median minor allele of about 7% at the default θ; the polymorphic count and the heterozygosity on the ancestral card are results, not settings. θ is a control of its own rather than 4Nμ computed from the run, because it describes the ancestor's long-term history and its Ne need not equal the N the daughters get.
The three kinds of locus. 13 build the five traits (shape 3, colour 4, eye size 1, fin size 2, tail size 3), each allele carrying an effect vector that its habitat scores. 40 are physiological: no effect vector, only a position on one axis of demand with the ancestral allele at 0, still water asking for −1 and fast water for +1, and an allele favoured when it brings the locus closer to what its habitat needs. The remaining 960 have no effect a habitat can see.
Each generation. Every locus runs its own Wright–Fisher trajectory in each population: binomial sampling of the 2N gene pool, plus selection where the habitat has a preference, with the beneficial allele dominant (h = 1) so a new mutation is exposed from its first heterozygote. A locus carries at most two alleles at a time; one that has gone monomorphic can mutate, producing an allele that has never existed before at one copy in 2N. Mutations are local to the population they arise in.
What is counted. A fixed difference is a locus where the two populations are each fixed, for different alleles. A mutation is a new allele that arose after the split and a substitution is one that reached fixation; standing variants sorting are counted as neither. Phenotypes are additive in allele dosage, so a population's mean fish is the baseline plus each allele frequency times its effect. Speciation is declared at X fixed differences, or, with body colour acting as a mating signal, at Y degrees of divergence in mean body hue.
The standard results behind the numbers on the cards. The ancestor's frequencies come from Beta(θ, θ), whose mean heterozygosity has a closed form:
E[H] = 2·E[p(1 − p)] = θ/(2θ + 1)0.12 at the default θ = 0.16 — which is the figure the ancestral card reports, up to the rounding to whole gene copies
After the split, what separates the three kinds of locus is not how often they mutate — that is μ for all of them — but what happens to a mutation once it exists. Each enters at 1/(2N), and:
invisible locus: u = 1/(2N) · scored locus: u ≈ 2s · ratio = 4Nsat N = 200 and s = 0.20, a locus the habitat can see substitutes about 160 times as readily as one it cannot
That ratio is why the 53 loci a habitat scores diverge visibly over a run while the 960 it ignores mostly sit still, and it is also why the two daughters are not symmetric: population B at N = 50 fixes neutral mutations four times as readily as population A at 200, so some of what separates them is drift in the smaller one rather than adaptation in either. The neutral substitution rate itself is μ/(2N) per locus per generation — but only for a run long compared with the ≈4N generations one neutral fixation takes, and at the defaults G = 1000 and N = 200 it is not, which is part of why so much of the early divergence is standing variation sorting rather than new mutation.
The Reproduction Room
Two ways to make the next generation – Exact clones on one side, shuffled genes on the other.
Start here
The rooms so far copied a shape, or tracked an allele, without ever asking how a generation is actually made. This one does — and asks what difference it makes that most organisms need two parents.
What it shows. The same two founders reproduce in two different ways, side by side for four generations. On the left, asexually: every individual makes two exact clones of itself, so the population doubles — 2 → 4 → 8 → 16. Copying errors are switched off in this room — the Copying Room showed that copying is never really exact — so that the only difference between the two sides is how the genes are combined. On the right, sexually: the two parents make two offspring, each carrying one recombined copy from each parent, so the population only replaces itself. Both panels report their head count and their number of genetically distinct individuals.
Try this. Press Auto-play and watch the two panels to the end. Then compare the two numbers under each heading. Look closely at a circle on the right where a half changes shade partway down — that is a crossover, a piece of one copy swapped onto the other during meiosis.
Population now: 2 · distinct genotypes: 2
Population now: 2 · distinct genotypes: 2
How to read a circle
- Each circle is one individual, drawn as a single chromosome — its two copies, the homologues, shown as the left and right halves.
- Colour marks ancestry: teal shades come from Founder 1; rust shades come from Founder 2.
- Where a half changes shade partway down, a recombination (crossover) swapped a piece between the two copies during meiosis. Asexual copies never recombine, so their halves stay solid.
Asexual reproduction
One parent, no mate, offspring are exact clones.
Advantages
- Fast. Every individual reproduces, so the population doubles each generation (2 → 4 → 8 → 16).
- No mate needed — no time, energy, or risk spent finding or courting one.
- A well-adapted genotype is passed on intact, unchanged.
Disadvantages
- No variety. Every offspring is a clone, so the whole line is genetically identical.
- Shared weakness. A disease or change that harms one can wipe out them all.
- Mutations pile up over generations with no way to shed them (Muller's ratchet).
- The two lines never mix — a useful allele in one can never be combined with a useful allele in the other.
Sexual reproduction
Two parents, each offspring a fresh reshuffle of both.
Advantages
- Variety. Recombination plus mixing two parents makes new gene combinations every generation.
- Spreads risk. With varied genotypes, a single threat is unlikely to take everyone at once.
- Good mutations from different individuals can be brought together, and bad ones weeded out.
Disadvantages
- Slow. A pair produces only two offspring, so the population exactly replaces itself — half the descendants the same two individuals would have left asexually (the two-fold cost of sex).
- A mate is required — costing time, energy, and risk.
- Each parent passes on only one of its two copies of every gene, so half of its genetic material is left out of each offspring.
The trade-off in one line
Both panels started from the same two individuals. After four generations the asexual panel holds 16 and the sexual panel just 2 — an eight-fold gap. That is the cost of sex compounding: an asexual line doubles every generation, while a sexual pair only replaces itself. In return, sex buys the genetic variety you can see building up on the right.
Which strategy wins depends on the world. In a stable environment, sheer asexual numbers are hard to beat. In a changing one — new predators, new diseases, shifting climate — variety is the raw material for adapting, and can be well worth the cost. This is why many species do both: aphids and water fleas (Daphnia) clone themselves all summer, then switch to sex when conditions deteriorate.
A note on the simplification: for clarity each individual here carries just one chromosome, shown as its two copies. Meiosis is drawn with a single crossover, and each offspring receives one recombined copy from each parent. Real cells carry many chromosomes with several crossovers each — but the core idea, shuffling to create new combinations, is exactly what you see here. Note too that from Generation 2 on, the only two individuals available to mate are siblings, so this sexual line is as inbred as a line can be — which, if anything, understates the variety sex generates in a real population.
What this model assumes
- No selection and no mutation. Nothing here is favoured and nothing new arises — the only thing being compared is how much variety each way of reproducing can make from what is already present.
- Four generations, and two founders. A short run, chosen so that every genotype can be shown; nothing is drifting to fixation in that time.
- The two-fold cost is paid in full. The sexual panel assumes males contribute genes and nothing else — no care, no provisioning, no help of any kind. Where males do contribute, the cost is smaller than the one drawn here.
- One crossover per meiosis, at a drawn position. Real meiosis has several, and where they fall is not uniform. Recombination as a rate is the .
What to notice
After four generations the asexual side has sixteen individuals but still only the two genotypes it started with; the sexual side has two individuals carrying two genotypes that never existed before. Selection can only act on differences, so sixteen identical individuals offer it no more to work with than one. That is the bargain: numbers on one side, variety on the other — and it is the gametes made here that the next room pairs up at random.
Where this goes next. The takes the gametes made here and pairs them at random. The returns to the point about mixing, and shows in population-genetic terms why two good mutations in different asexual lineages can never be combined.
Exactly what this room simulates
Two founders and four generations, run twice from the same start. There is no mutation and no selection here, and an allele is only an ancestry label: each individual is a single chromosome, drawn as its two copies. On the left every individual makes two exact clones of itself. On the right the two parents make two offspring, each receiving one gamete from each parent, and a gamete is built by a single crossover whose position is drawn uniformly from the middle 64% of the chromosome, with a coin deciding which copy contributes the top piece. Two individuals count as the same genotype when they carry the same pair of copies — crossover positions included, which is what the “distinct genotypes” readout is counting.
Numbers on one side.
asexual N(t) = 2t+1 · sexual N(t) = 2 · ratio = 2tthe two-fold cost of sex is charged every generation, so it compounds: 2, 4, 8, 16 against a flat 2, and the eight-fold gap on screen at generation 3 would be a thousand-fold by generation 10
Variety on the other.
asexual G(t) = 2, for every tcloning is the identity operation: it can copy a genotype but it cannot make one, so the count on the left never leaves the two the founders brought, however large the head count grows
sexual G(t) = 2, but never the same two twicethe crossover position is drawn from a continuous range, so two meioses coincide with probability zero and every individual on the right is a genotype that has never existed
What the drawing leaves out is worth a number too. One chromosome with one crossover is the smallest thing that shows the mechanism, and much less than meiosis really does: independent assortment alone, before any crossover at all, gives 2n distinct gametes from n chromosome pairs — 2²³ ≈ 8.4 million in a human, and merely 2 here, since n = 1. Nearly all the variety you can see on the right is coming from where the crossover happened to fall.
And one thing the short run hides. From generation 2 the only mates available are siblings, and continued full-sib mating removes heterozygosity at a fixed rate: Ht = ½Ht−1 + ¼Ht−2, which settles to a decline by a factor (1 + √5)/4 ≈ 0.809 each generation — about a fifth of what is left, every generation, for as long as the line continues. Four generations are far too few for that to bite — the run is short so that every genotype can still be drawn — but it does mean the right-hand panel understates what sex generates in a population where mates are not siblings.
The Hardy–Weinberg Room
From alleles to genotypes – One allele frequency fixes all three genotype frequencies.
Start here
The made the gametes. This room pairs them up, and works out what that does to the genotypes.
What it shows. A single locus with two alleles — A₁ at frequency p, A₂ at frequency q = 1 − p. Two handles cut the parent population into any mix of A₁A₁, A₁A₂ and A₂A₂ you like, and three histograms sit side by side: the genotypes the parents actually have (observed), the p²:2pq:q² expected from their allele frequency, and what one round of random mating really produces. Below them, the Hardy–Weinberg square shows where those proportions come from — and how many individuals each one means — while a gamete wheel builds the offspring one gamete at a time.
Try this. Collapse the One generation of random mating panel and slide p from 0.5 down toward 0.1: watch where the rare allele goes — almost every copy ends up inside a heterozygote, not a homozygote. Then open the panel again and drag the two handles on the genotype bar to build a lop-sided population of your own — more A₁A₁ and more A₂A₂, fewer A₁A₂. Press Mate randomly at each setting and see where the offspring land.
One generation of random mating → Hardy–Weinberg
What this model assumes
- These are the theorem's own assumptions, and here they are the subject rather than a simplification. Random mating, no selection, no mutation, no migration, and no drift.
- An infinitely large population — and this room breaks that one on purpose. "No drift" means a population large enough that a generation is a perfect draw. The panel here instead draws a real 2N gametes, so with N small the offspring miss the p²:2pq:q² proportions by a little, and the allele frequency shifts a little too. That gap is drift, and watching it appear as you lower N is the point: within any one generation the genotypes still follow the allele frequency exactly, which is what the theorem promises — what it cannot promise is that the allele frequency stays put. The is that second half on its own.
- One locus, two alleles, autosomal, in a diploid with discrete generations. Sex-linked loci, more than two alleles and overlapping generations all change the proportions.
- "Random mating" means random with respect to this locus. A population can be choosy about everything else and still satisfy it.
What to notice
Genotype frequencies are completely fixed by the allele frequency, and heterozygotes are most common at p = 0.5. Any starting mix reaches expected genotype frequencies of p²:2pq:q² after a single generation of random mating, and stays there. Exactly so only in an infinite population: draw a real 2N gametes, as this room does, and the realised counts fluctuate around those expectations — which is the gap between the Expected and After one random mating histograms, and the whole of what drift is. That is exactly why the diploid Drift and Selection rooms can draw 2N alleles and pair them: the genotypes follow automatically, so only the allele frequency has to be tracked.
Where this connects. This is the licence the earlier rooms were using: because genotype frequency follows from allele frequency, the and the could track the allele frequency alone and pair gametes as they went — which is what their Diploid setting quietly relies on. The shows where this convenient one-locus picture breaks down.
Exactly what this room simulates
One autosomal locus with two alleles, in a diploid population of N. G0 is whatever you build: with the random-mating panel closed the slider sets p and the parents are laid out in Hardy–Weinberg proportions at that p; with it open the two handles set the genotype mix directly and the allele frequency becomes a consequence of it, p = f(A₁A₁) + ½·f(A₁A₂). Mating then draws 2N gametes independently from that gene pool — each one A₁ with probability p — and pairs them two at a time. Nothing else happens to them: no selection, no mutation, no migration, and no second generation.
The theorem, and three things that follow from it.
f(A₁A₁) = p² · f(A₁A₂) = 2pq · f(A₂A₂) = q², with q = 1 − pthe probabilities of the two independent gametes an offspring gets, which is all "random mating" means — reached in a single generation from any starting mix, and unchanged in every generation after it
max 2pq = ½ at p = q = 0.5the peak of the middle curve: no population can have more than half its individuals heterozygous at a locus with two alleles
share of A₁ copies sitting in heterozygotes = 2pq/2p = qa rare allele hides in heterozygotes, in proportion to how rare it is: at p = 0.1, nine copies in ten are in an A₁A₂, and only p² = 1% of individuals are A₁A₁
E[p₁] = p₀ · Var(p₁) = p₀q₀/2Nthe assumption this room breaks on purpose: the theorem wants an infinite population, and drawing a real 2N gametes leaves this much wobble — a standard deviation of 0.05 at N = 50, p = 0.5
The rare-allele line is the answer to the Try this above, and it is also why the Selection Room's h carries so much weight: an allele that is rare is an allele selection almost only ever meets in a heterozygote, so a recessive one is nearly invisible exactly when it is scarce. The variance line is why Expected and After one random mating never land quite on top of each other. Because the gametes are drawn independently and then paired, each offspring is A₁A₁, A₁A₂ or A₂A₂ with exactly the probabilities above, so G1's genotype counts are a multinomial sample of size N from them and miss the expected bars by around √[f(1 − f)/N]. Press Mate randomly a few times at N = 10 and then a few more at N = 200: the same law both times, sampled coarsely or finely.
The Linkage Room
Two loci at once – Nearby loci travel together, so selection on one drags the other along.
Start here
The followed a single locus. Everything changes once you follow two.
What it shows. The previous room follows one locus. This one follows two, sitting a chosen distance apart on the same chromosome. Part 1 builds an association between them — allele A₁ travelling with allele B₁ — and lets recombination pull it apart, generation by generation, at the rate r you set. Part 2 drops two beneficial mutations into a finite population, one in each of two different individuals, and counts how often the population manages to keep both.
Try this. In Part 1, set r = 0.5 and press Auto-play: the association is gone almost at once. Now set r = 0.005 and run it again — after sixty generations most of it is still there. Then, in Part 2, press Run all replicates at a low r and compare the two sets of bars.
Part 1 · How long an association lasts
Part 2 · Two good mutations getting in each other's way
A population is sitting on A₂B₂. Two useful mutations have appeared in different individuals, so they are on different chromosomes — some carry A₁B₂, others A₂B₁. Both are good. But no chromosome carries both, and none can, until recombination puts them together as A₁B₁. Until it does, the two mutations are rivals rather than allies: every copy of A₁ that spreads is a copy of B₁ displaced, and the population can only keep one of them.
What this model assumes
- Two loci, and only two. A real chromosome puts a locus in the company of thousands, and the interference this room demonstrates is correspondingly stronger there.
- Fitness is multiplicative across the two loci, so there is no epistasis: the double mutant is worth exactly what its two halves are worth. That is deliberate — it isolates the effect of linkage itself, and any interference you see cannot be blamed on the two alleles interacting.
- A constant recombination rate. r is fixed, the same in both sexes and unaffected by anything else on the chromosome — no interference between crossovers, no hotspots.
- Part 2 follows chromosomes rather than individuals. The population is diploid — N individuals, 2N chromosomes, the same bookkeeping the diploid settings elsewhere use — but fitness here is multiplicative, so there is no dominance to model and each chromosome can be scored on its own. That is why only the four gamete frequencies have to be tracked. Otherwise it is Wright–Fisher as before: constant N, discrete generations, no migration and no new mutation.
What to notice
Hardy–Weinberg is reached in one generation and stays; linkage equilibrium is only ever approached, at a speed set by how close the two loci sit. And while an association lasts, it has a cost: two good mutations on different chromosomes are rivals rather than allies, because the chromosome carrying both has to be built by recombination before selection can favour it. With little recombination, one of the two is usually thrown away. That is Hill–Robertson interference — and an asexual lineage lives at r = 0 across its whole genome, permanently.
Where this connects. Linkage is the reason the one-locus rooms are a simplification, not the whole story. The treated its five traits as independent loci — worth going back with the knowledge that real traits are not always so obliging.
Exactly what this room simulates
Gamete frequencies are written x(A₁B₁), x(A₁B₂), x(A₂B₁), x(A₂B₂), and the linkage disequilibrium between the two loci is D = x(A₁B₁)·x(A₂B₂) − x(A₁B₂)·x(A₂B₁), zero when the two are inherited independently. Recombination at rate r per generation erodes it geometrically: D(t) = D₀(1 − r)t. Part 2 runs a two-locus Wright–Fisher model of a diploid population of N, bookkept as its 2N chromosomes. Fitness is multiplicative across the two loci and across an individual’s two chromosomes, which means there is no dominance and the gamete frequencies on their own are enough: selection reweights the four gamete classes, recombination reshuffles them at rate r, and 2N chromosomes are then drawn at random to make the next generation. Both beneficial alleles start at the frequency f₀ you set, on different backgrounds — at the defaults that is five copies of each in 2N = 100, not one — so the chromosome carrying both can only be made by recombination.
Two numbers to read off the sliders. The geometric decay above has a half-life:
t½ = ln 2 / [−ln(1 − r)] ≈ 0.69/r generationsabout 69 generations to lose half the association at r = 0.01, and barely one at r = 0.5, which is what unlinked means
In Part 2 the quantity that decides the run is how fast the missing chromosome gets made. Both mutations start at f₀ on opposite backgrounds, so x(A₁B₁) = 0 and D = −f₀², and recombination moves −rD into the coupling classes each generation:
E[copies of A₁B₁ in the next generation] ≈ 2N·r·f₀²0.0025 at the defaults N = 50, r = 0.01, f₀ = 0.05 — some 400 generations of waiting for the first copy of it to appear
Meanwhile, by the closed form in the Selection Room, either mutation on its own would climb from 5% to 95% in about 30 generations at s = 0.20. The race is not close, and losing it is exactly what Hill–Robertson interference is: the two alleles settle their contest between them long before recombination can put them on the same chromosome.