Iterated Prisoner’s Dilemma Tournament

In the experiment this page is built from, Tit for Tat finished 4th of 10 strategies with no noise at all, and 1% noise took two Grudgers from 3.000 points a round to 1.525. Pick the strategies, the noise and the seed, and check those numbers yourself — or play a match against any of them.

Winner—
Tit for Tat’s place—
Grudger vs Grudger, per round—
Matches played—

Hover or tap a cell to read it.

Each cell is the row strategy’s mean score per round against the column strategy. Blue is above the midpoint of R and P, red is below it.

Strategies in the tournament

What each strategy does
ALLC
Always Cooperate — Cooperates every round.
ALLD
Always Defect — Defects every round.
TFT
Tit for Tat — Cooperates first, then copies the opponent’s previous move.
STFT
Suspicious Tit for Tat — Tit for Tat that defects on the first move.
TF2T
Tit for Two Tats — Retaliates only after two defections in a row.
GRUDGER
Grudger (Grim Trigger) — Cooperates until the opponent defects once, then defects for the rest of the match.
RANDOM
Random 50/50 — Cooperates or defects with probability 1/2 each.
PAVLOV
Pavlov (Win-Stay, Lose-Shift) — Repeats its last move after R or T, switches after P or S.
JOSS
Joss — Tit for Tat, but defects at random 10% of the time instead of cooperating.
GTFT
Generous Tit for Tat — Tit for Tat, but lets a defection go 10% of the time.
TTFT
Two Tits for Tat — Answers each defection with two defections.
PROBER
Prober — Opens D, C, C. If the opponent cooperated on moves 2 and 3 it defects forever; otherwise it plays Tit for Tat.
SOFT_MAJ
Soft Majority — Cooperates while the opponent has cooperated at least as often as it has defected.
HARD_MAJ
Hard Majority — Defects first, then defects whenever the opponent has defected at least as often as it has cooperated.
GRADUAL
Gradual — After the opponent’s n-th defection it defects n times in a row, then cooperates twice.
Payoffs for one round (your points)

Play it yourself

Pick an opponent and press Cooperate or Defect each round. A small dot on a move means noise flipped it.

You
Opponent
Your points: 0Opponent’s points: 0Round: 0

Noise sweep: who wins as mistakes increase

Runs the whole tournament at 0, 0.5, 1, 2, 3.5, 5, 7.5, 10, 15 and 20% noise with the strategies, rounds and payoffs set above. Each noise level uses seed = base seed + noise × 1000, the rule the article used.

Evolution: which strategies spread

Discrete replicator dynamics on the score matrix of the last tournament: every strategy starts with an equal share, and each generation a share grows in proportion to its score against the current population.

Head-to-head and self-play

One pairing, many matches: the distribution of scores, one sample match drawn move by move, and the exact expected score where the strategies have short enough memory to compute it.

Same strategy against itself (200 rounds)

One sample match, A on the top row and B below. Blue = cooperate, orange = defect, a black tick = a move flipped by noise.

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

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

What will you try next?

Share this tool

Part of Shake AI Lab — interactive experiments in mathematics and machine learning. · More tools · 日本語の解説記事