Two suspects sit in separate cells. Each can stay silent or testify against the other. Whatever the partner does, testifying shortens your own sentence, so both testify and both serve longer than if they had kept quiet. Below you can check that cell by cell, play the game hundreds of rounds between strategies, and let the best scorers take over a population.
Each cell lists A's years, then B's years. Fewer years is better. The four numbers have names: R reward for mutual silence, P punishment for mutual defection, T temptation for defecting on a silent partner, and S the sucker's sentence. Edit any number (its mirror cell changes too, so the game stays symmetric), then step through each prisoner's reasoning.
| B silent | B defects | |
|---|---|---|
| A silent | ||
| A defects |
How to read this: the table lists each outcome as (A's years, B's years). The map beside it shows the same four outcomes, with an arrow wherever one prisoner would rather switch alone.
Try this: press From start, then Next, and watch A compare the two rows inside each column (the outlined cells).
A cell is a pure Nash equilibrium when each player's move is a best response to the other's: neither can do better by switching alone. In a 2×2 game that is two comparisons per cell. The arrows in the diagram are exactly those comparisons, so an equilibrium is a cell no arrow leaves.
Played once, defection wins. Played again and again against the same partner, today's move can be punished or rewarded tomorrow. Seven strategies meet in a round robin using the sentences from Lab 1. Each pair plays a match of N rounds, and every move can flip by mistake with the noise probability. Click a cell of the grid to watch that match.
Tit for Tat starts silent, then copies the partner's last move. Grim Trigger stays silent until the first defection, then defects forever. Pavlov (win-stay, lose-shift) repeats its move after a good outcome and switches after a bad one, which works out to "stay silent if we both made the same move last round". Tit for Two Tats defects only after two defections in a row.
In 1980 Robert Axelrod ran computer tournaments of the repeated game with strategies submitted by researchers. Tit for Tat, submitted by Anatol Rapoport, won. Turn the noise up and watch how it fares when one mistake can start a long feud between two copies of it.
Now treat the strategies as a population. Each generation everyone plays everyone, and a strategy's share grows in proportion to its average score. This is the discrete replicator equation. Scores are points per round, points = max sentence − years, so higher is better and nobody scores below zero. Matches here are noise-free and use the sentences from Lab 1.
How to read this: each line is one strategy's share of the population over the generations. A rising line is a strategy that is winning. The two thick lines are Always Defect and Tit for Tat, and the dashed gold line marks the current generation while it runs.
Try this: pick "Defectors vs Tit for Tat", then drag "Always Defect at start" until Tit for Tat drops below its threshold (shown in the panel text) and watch the outcome flip. The chip buttons add or remove strategies.
Let x be Tit for Tat's share in a population with only Always Defect. Here a is what Tit for Tat scores against itself, b against a defector, c what a defector scores against Tit for Tat and d against another defector. Tit for Tat loses only the first round to a defector, then defects back, while two copies of it stay silent the whole match. With enough rounds that beats the defector's one-time gain, so once Tit for Tat passes the threshold it grows.
Always Cooperate has no such defense: it scores less than a defector against every opponent, so any defectors among naive cooperators take over. In a single round (set rounds to 1) Tit for Tat is just a cooperator, and it loses too.