What this simulator does
Two players each choose to cooperate (C) or defect (D) at the same time. With the payoffs used on this page and in most of the literature, both cooperating pays each of them R = 3, both defecting pays P = 1, and a defector facing a cooperator gets T = 5 while the cooperator gets S = 0. Whatever the other player does, defecting pays more in a single round — which is why the one-shot game has a single equilibrium at mutual defection (you can check that in the Nash equilibrium calculator). The game is a dilemma because of two inequalities, and the payoff box above checks both as you type: T > R > P > S, and 2R > T + S, so that taking turns to exploit each other is still worse than cooperating every round.
Repeat the game and today’s defection can be punished tomorrow. That is the iterated prisoner’s dilemma, and the classic way to study it is a round-robin tournament: every strategy plays every other strategy, and itself, for a fixed number of rounds. This page runs that tournament in your browser, with up to 15 strategies, an editable payoff table, and one thing most demonstrations leave out — noise, a chance that a move comes out as the opposite of what the strategy intended.
How to use the controls
- Strategies — tick the ones that enter. The first ten are the ten from the article this page is based on; Two Tits for Tat, Prober, the two Majority rules and Gradual are added for comparison. Open “What each strategy does” for the exact rule of each.
- Rounds per match and Repetitions per pair — every ordered pair, including a strategy against a copy of itself, plays that many matches of that many rounds.
- Noise — each player’s intended move is flipped independently with this probability, every round. Strategies see the moves that were actually played, not what was intended.
- Random seed — the same seed and settings give the same tournament, move for move. Change it to see how much of a result is luck.
- Score — a strategy’s score is its mean points per round, averaged over all of its opponents including itself. The heatmap shows the pairwise numbers behind that average: row against column.
The random numbers come from the same generator NumPy uses (default_rng, PCG64), drawn in the same order as the article’s Python code. That is why the article’s presets reproduce its published tables to every digit, not approximately.
The article’s numbers, reproduced
The Japanese article behind this page ran ten strategies, 200 rounds a match and 40 matches per pair. Without any noise, Tit for Tat did not win. The top four were Tit for Two Tats at 2.643 points per round, Generous Tit for Tat at 2.614, Always Cooperate at 2.520 and Tit for Tat at 2.497, 4th. With 1% noise, the Grudger fell from 2.415 to 1.991 and Always Cooperate from 2.520 to 2.215. Press Article: no noise and Article: 1% noise to run those exact tournaments; the Article column then shows the published value next to this page’s.
The article also played each strategy against itself. Two Grudgers cooperate forever without noise and score 3.000; with 1% noise the article measured 1.525, and with 5%, 1.242. The reason is simple once you see it: in 200 rounds there are 400 chances for a mistake, and the chance of at least one is 1 − 0.99400 ≈ 98.2%. One mistake ends the cooperation for good, because each Grudger then waits for the other to stop defecting, which neither will.
The self-play table in the head-to-head section puts the article’s figures next to the exact expected score, which this page computes without sampling (see below). For two Grudgers at 1% noise it is 1.521, and every self-play figure in the article is within 0.02 of its exact value. A single estimate from 40 matches is noisy, though. Measured here over 2,000 batches of 40 matches (seeds 1 to 2,000), the batch average had a standard deviation of 0.071, and 95% of batches fell between 1.381 and 1.661. The article’s 1.525 sits inside that range; so does the 1.414 in the diagonal of the article’s own 1% tournament, which is a different set of 40 matches. That is why the Grudger tile above shows 1.414 for the 1% preset and not 1.525 — both are honest samples of the same number.
Noise sweep: forgiving strategies lose their edge
The sweep runs the full tournament at ten noise levels from 0% to 20%. With the article’s settings — ten strategies, 200 rounds, 25 matches per pair, base seed 100 — the chart reproduces the article’s saved sweep exactly, and the leader changes three times: Tit for Two Tats at 0%, Generous Tit for Tat from 10%, Grudger at 15%, and Always Defect at 20%. The forgiving strategies slope down as noise rises and the unforgiving ones slope up. At high noise, a move tells you little about intent, so forgiving a defection mostly means being exploited by a coin flip.
The crossover points belong to this particular mix of opponents and payoffs. Change the field and the picture moves. The Forgiveness wins preset keeps only the six reciprocating strategies and adds 2% noise; with seed 1 it finishes Tit for Two Tats 2.561, Generous Tit for Tat 2.300, Tit for Tat 2.173, and the Grudger last at 1.422. The All 15 strategies preset, with no noise, puts Gradual first at 2.759 and Generous Tit for Tat second at 2.736, with Tit for Tat 4th again at 2.631. Those are this page’s measurements, not the article’s. Every strategy in the Forgiveness preset has an exact value, so its Exact column shows how much of each gap is luck; Gradual, Prober and the Majority rules do not, so the All 15 table has no Exact column.
Evolution: replicator dynamics
The evolution chart treats the last tournament’s score matrix M as fitness. Starting from equal shares x, every generation computes each strategy’s score against the current population, f = M x, and updates xi ← xi fi / (x · f). After the article’s 1% tournament, 120 generations end with Generous Tit for Tat at 67.6%, Tit for Two Tats at 29.0% and Tit for Tat at 1.5%; this page gets the same figures from the same matrix. Those are values at generation 120, not an equilibrium: run more generations and they keep moving. If a payoff is negative, every fitness is shifted up by that amount so that shares stay positive.
Exact expected scores
For eleven of the strategies — everything except Prober, the two Majority rules and Gradual — the next move depends only on the last two moves of each player and on whether the opponent has ever defected. That makes a match a Markov chain on 64 states, so the expected score over n rounds can be computed exactly by pushing the probability distribution forward one round at a time. When every strategy in the tournament has this property, the ranking table adds an Exact column: what the tournament would converge to with infinitely many repetitions. Use it to tell whether a gap between two strategies is real or the luck of the seed. Tit for Tat against Always Defect, for example, has no randomness at all without noise: S in the first round, then P for the remaining 199, or 0.995 points per round.
Play it yourself
The game mode puts you in the tournament. Choose an opponent, or a mystery one that is revealed at the end, and press Cooperate or Defect for 10, 20 or 50 rounds. When the game ends, the page shows what Tit for Tat, Always Cooperate and Always Defect would have averaged against the same opponent under the same settings, over 1,000 simulated games. Try a Grudger with 5% noise: you can play perfectly and still lose the relationship to one flipped move.
Limits
- A ranking belongs to its field of opponents. Tit for Tat came 4th of these ten; in another field it can win, which is what happened in Axelrod’s tournaments. The article does not claim otherwise, and neither does this page.
- Noise here flips executed moves only. Misperception — seeing a cooperation as a defection — is a different model and is not simulated.
- Matches have a fixed, known length. No strategy here exploits the last round, but a strategy that did would change the picture.
- Replicator dynamics assumes an infinite, well-mixed population with no mutation. Real populations are finite and noisy, so shares close to zero would often disappear outright.