Skip to content

Cahid Arda Öz

Istanbul, Turkey

← The Logic of Crowds
Blog Essays, opinions, and how-tos. / 2 min read

The Prisoner's Dilemma

Why two sensible players end up worse off, and how repetition, reciprocity and evolution bring cooperation back.


Two roommates share a kitchen. Each would rather the other one did the dishes, and so the sink fills up. Both would prefer a clean kitchen, and neither can get one alone. That is the Prisoner’s Dilemma.

One round

Each player either cooperates or defects. The payoffs are temptation TT, reward RR, punishment PP and sucker SS, and two inequalities make it a dilemma (Axelrod and Hamilton, 1981, Fig. 1):

T>R>P>S2R>T+ST > R > P > S \qquad 2R > T + S
GT-02.1one roundT=5 R=3 P=1 S=0
they cooperatethey defectyou coop.you defectR3them 3better for bothS0them 5T5them 0P1them 1you both land here+2+1
defecting gains you
+2
5 instead of 3 when they cooperate

Defect is your better reply in both columns. They reason the same way, so you both get 1 instead of 3.

hover or click a column to pick what they do: your best reply never changes

Defect is a dominant strategy, so mutual defection is the only Nash equilibrium. Both players act sensibly and both end up worse off.

Many rounds

Now suppose you will probably meet again: after each round, another one follows with probability δ\delta. Say your partner cooperates until you defect once, and then never cooperates again. Cheating pays TT once and PP forever after, so it stops paying when

δ≥T−RT−P=5−35−1=12\delta \ge \frac{T - R}{T - P} = \frac{5 - 3}{5 - 1} = \frac{1}{2} Cooperating forever is worth R/(1-δ). Cheating is worth T + δP/(1-δ). The first is larger exactly when δ is at least (T-R)/(T-P). With T=5, R=3, P=1 that is 1/2.
GT-02.2the shadow of the futuregrim trigger
cooperation holds01350½1δ = chance of another roundpoints per roundkeep cooperating3 every roundcheat once5 once, then 1δ* = ½
another round
20%
≈ 1.3 rounds
cooperate
3.00
per round
cheat once
4.20
cheating pays

Cheating wins one big round and loses every round after it. Once another round is likely enough, those lost rounds outweigh the windfall.

drag along the chart (or use ← →) to change the chance of another round

The tournament

In the late 1970s the political scientist Robert Axelrod asked game theorists to submit programs for a round-robin tournament of the repeated game. Of the 14 entries, Tit for Tat won: cooperate first, then copy the opponent’s last move. It won again in a second, larger tournament (Axelrod and Hamilton, 1981).

GT-02.3round robin8 programs · 200 rounds a match
average points per round, against everyoneCooperate first, then copy their last move.Tit for Tat2.43Defect only after two defections in a row.Tit for Two Tats2.56Cooperate until betrayed once, then defect forever.Grudger2.52Win-stay, lose-shift: cooperate iff both moved alike last round.Pavlov2.47Always cooperate.Always Cooperate2.40Flip a coin every round.Random2.12Always defect.Always Defect2.01Tit for Tat, but sneaks in a defection 10% of the time.Joss1.89nice: never defect first ↑defect first sometimes ↓
winner
Tit for Two Tats
round 200 of 200, all matches at once

No nice program can beat the opponent in front of it by much. They top the table by doing well against everyone.

watch the table fill, then replay it

In this field Tit for Two Tats edges ahead of Tit for Tat, but the split is the one Axelrod found: every nice program (one that never defects first) finishes above every program that is not. He named two more traits of the winners: retaliatory (answer a defection) and forgiving (go back to cooperating afterwards).

Evolution

Now let strategies breed: a strategy’s share grows when it scores above average. That is the replicator equation, where xix_i is the share of strategy ii, fif_i its average payoff and fˉ\bar f the population mean:

x˙i=xi(fi−fˉ)\dot x_i = x_i \left( f_i - \bar f \right)

Players also make mistakes: with some small probability, a move comes out the opposite of what the strategy intended.

GT-02.4survival of the fittestreplicator dynamics
Always DefectTit for TatPavlov0%50%100%0200400600generationgen 650
average payoff
2.81/round
3 = all cooperate, 1 = all defect
mistakes

Tit for Tat clears out the defectors, then loses to Pavlov, which recovers from a slip in two rounds instead of feuding. Pavlov in turn is slowly undercut by defectors, and the cycle repeats.

pick a mistake rate to play it (again to replay); hover the chart to scrub

Mistakes are hard on Tit for Tat: one slip between two copies starts an echo of retaliation. Pavlov (win-stay, lose-shift) gets back to cooperating in two rounds, which is why it beat Tit for Tat in Nowak and Sigmund’s 1993 simulations. I replicated that paper in Java a few years ago and saw the same rise of Pavlov, and its collapse late in the run.