What this page is. The interactive companion to a game-theory final project on the Prisoner's Dilemma: one game taken through rationality, selection, noise and learning. Everything here is computed in the page or taken from the canonical run of the pdlab Python package. The full derivations and proofs are in the report (PDF, 49 pages); the code, tests and reviews are in the repository. Scroll to operate it; the lattice behind the panels is a real simulation and scrolling is its clock.
Payoffs · one-shot game
The Prisoner's Dilemma, live.
Edit any cell. Every threshold on this page follows the matrix; every simulation result is the canonical one from the pdlab Python package, cross-checked against the axelrod library.
| they cooperate | they defect | |
|---|---|---|
| you cooperate | R · reward
|
S · sucker
|
| you defect | T · temptation
|
P · punishment
|
Editing a cell updates every threshold on the page.
Python, canonical matrix: δ*Grim = , δ*TFT = .
Opponent · hidden
Round 1. The hidden strategy has already chosen.
Pick one. Whatever you do, the matrix cell you land in lights up.
Behind this panel: a 99 × 99 lattice of cooperators with one defector in the middle. It has not moved yet. Scroll.
Finite horizon · backward induction
Two hundred rounds against the same opponent, and both of you know it. In the last round nothing follows, so defecting is simply better. Both of you can see that.
So round 199 is the last one where behaviour can still matter. Except that it cannot, because round 200 is already lost. Defect there too.
Every round falls to the one after it, all the way back to the first. The unique subgame-perfect outcome of a known-length game is mutual defection from the opening move.
Take the end away and the arithmetic changes. With a continuation probability δ the future is worth 1/(1−δ) rounds, and patience has a price you can compute.
Play · 17 opponents
Your hand on the lever.
Pick an opponent and play twenty rounds.
you
them
Score · per round
Auto-play a policy to compare with the Python tournament matrix.
Scored with the canonical payoffs . The matrix you edited drives the theory benches, not this one, so the comparison with Python stays exact.
Tournament · round robin
Nice strategies finish first.
Eighteen strategies, 200 rounds, ten repetitions, self-play included. Score is mean payoff per round. Pick the noise level and the cards re-rank.
Pairwise · row's payoff
Hover a cell.
Read-out
Nice means never the first to defect. The bar under each score is that strategy's cooperation rate.
Spatial · Nowak & May 1992
Population · replicator dynamics
Why Tit-for-Tat survives, and when.
ALLC, ALLD and TFT in the repeated game with δ = . Drag the start point. The dashed edge is a line of neutral fixed points; the dot on the ALLD edge is the invasion threshold.
Finite populations: Moran fixation of one TFT (Python)
| N | exact ρ | simulated | neutral 1/N |
|---|
Under mutation the eighteen-strategy Moran process spends most of its time near .
Noise · memory-one Markov chain
Eight strategies playing themselves, exact long-run payoff from the stationary distribution. At ε = 0 they all sit on R = 3, except the ones that were never nice.
One slip and Tit-for-Tat falls to (T + R + P + S)/4 = 9/4, for any ε > 0: the chain it drives is doubly stochastic. Pavlov and generous TFT lose only a multiple of ε.
The live column on the right is computed here from the 4 × 4 chain at the swept ε; the curves are Python's. They agree to the printed precision.
Live at this ε · self-play
Who profits · zero-determinant
Extort-2 pins every opponent to sX − P = 2 (sY − P) without noise. A Q-learner facing it ends near per round while the extortioner takes . Noise on the extortioner breaks the pin.
| opponent | learner | opponent |
|---|
Evolution under noise · dominant strategy
Prompt · same engine, on demand