Prisoner's Dilemma Calculator & Strategy Simulator

Explore the Prisoner's Dilemma — payoff matrices, Nash equilibrium, iterated games with Tit-for-Tat, Grim Trigger, Pavlov, and more strategies.

Prisoner's Dilemma Calculator

P1 Total Score
19.0
tit-for-tat: avg 0.95/round over 20 rounds
P2 Total Score
24.0
always-defect: avg 1.20/round over 20 rounds
Nash Equilibrium
Both Defect (D,D)
The stable outcome where neither player gains by switching unilaterally
Valid Dilemma?
✅ T>R>P>S, 2R>T+S
Standard PD requires T > R > P > S and 2R > T + S
P1 Cooperation Rate
5.0%
Cooperated 1 of 20 rounds
P2 Cooperation Rate
0.0%
Cooperated 0 of 20 rounds

Payoff Matrix

P2 CooperateP2 Defect
P1 CooperateR, R = 3, 3S, T = 0, 5
P1 DefectT, S = 5, 0P, P = 1, 1

Round-by-Round Results

RoundP1P2P1 PayP2 PayP1 CumP2 Cum
1CD0505
2DD1116
3DD1127
4DD1138
5DD1149
6DD11510
7DD11611
8DD11712
9DD11813
10DD11914
11DD111015
12DD111116
13DD111217
14DD111318
15DD111419
16DD111520
17DD111621
18DD111722
19DD111823
20DD111924

Score Comparison

P1
19
P2
24

Strategy Reference

StrategyRuleStrengths
Always CooperateAlways play CMaximizes mutual gain; exploitable
Always DefectAlways play DCan't be exploited; misses cooperation
Tit-for-TatStart C, copy opponent's last moveNice, retaliatory, forgiving; won Axelrod's tournament
Grim TriggerC until opponent defects, then always DStrong deterrent; unforgiving
PavlovRepeat if won; switch if lostSelf-correcting; exploits cooperators
Random50/50 each roundUnpredictable; suboptimal baseline
Planning notes, formulas, and examples

About the Prisoner's Dilemma Calculator & Strategy Simulator

The Prisoner's Dilemma is the most studied model in game theory. Two players independently choose to cooperate (C) or defect (D). Mutual cooperation yields a moderate reward (R) for both, mutual defection yields a low punishment (P), but if one defects while the other cooperates, the defector gets the highest temptation payoff (T) while the cooperator gets the sucker's payoff (S). The dilemma: individually, defection is always rational (it dominates), yet mutual cooperation yields a better outcome for both.

This calculator lets you explore both single-round and iterated versions of the game. In single-round mode, you pick each player's choice and see the payoff. In iterated mode, you assign strategies — Tit-for-Tat, Always Defect, Grim Trigger, Pavlov, Random — and watch them play over many rounds. The round-by-round table shows every move, payoff, and cumulative score, while the output cards summarize Nash equilibrium, cooperation rates, and total scores.

Game theory's insights apply far beyond academic puzzles: international relations (arms races), business (price wars), biology (reciprocal altruism), and technology (protocol design) all involve variants of the Prisoner's Dilemma. This calculator makes the abstract logic concrete and explorable.

When This Page Helps

Game theory is essential in economics, political science, biology, and computer science, and the Prisoner's Dilemma is its most important building block. However, textbooks present payoff matrices statically. This simulator brings them to life — you can watch strategies interact round by round, see cooperation rates evolve, and discover why "nice" strategies like Tit-for-Tat outperform "nasty" ones in the long run.

It is ideal for students learning game theory, instructors building interactive lectures, and professionals exploring strategic interaction in negotiations, auctions, or protocol design.

How to Use the Inputs

  1. Set the payoff values: Reward (R), Temptation (T), Punishment (P), and Sucker (S).
  2. Choose single-round mode to set each player's choice manually, or iterated mode for strategy simulation.
  3. In iterated mode, select strategies for both players and the number of rounds.
  4. Read the output cards for total scores, Nash equilibrium, and cooperation rates.
  5. Examine the payoff matrix to understand each outcome.
  6. Review the round-by-round table in iterated mode to see move-by-move dynamics.
  7. Use presets to explore classic matchups like TFT vs Always Defect.
Formula used
Payoff matrix: (C,C)→(R,R), (C,D)→(S,T), (D,C)→(T,S), (D,D)→(P,P). Standard PD: T > R > P > S and 2R > T + S. Nash equilibrium of single-round PD: (D,D). Tit-for-Tat: start C, then copy opponent's last move.

Example Calculation

Result: P1: 22, P2: 24

TFT cooperates on round 1 (gets S=0), then defects for the remaining 19 rounds (gets P=1 each). Always Defect gets T=5 once, then P=1 for 19 rounds. TFT loses slightly because of the initial exploitation.

Tips & Best Practices

  • Verify T > R > P > S and 2R > T + S to ensure a valid dilemma — the tool warns you otherwise.
  • Run TFT vs TFT to see the power of mutual cooperation: both get R every round.
  • Compare Always Defect against multiple strategies to see why it loses in tournaments.
  • Try Grim Trigger vs TFT — one accidental defection (in a noisy variant) makes Grim devastating.
  • Increase rounds to 50+ to see long-run average payoffs converge.
  • Use Random as a baseline to compare how much smarter strategies improve over pure chance.

History and Axelrod's Tournament

The Prisoner's Dilemma was formalized by Merrill Flood and Melvin Dresher at RAND in 1950, and Albert Tucker gave it its name. In 1980, political scientist Robert Axelrod invited game theorists to submit strategies for an iterated PD computer tournament. Anatol Rapoport's simple Tit-for-Tat strategy won both the original tournament and a much larger follow-up. The result was surprising: the winning strategy was the simplest submitted, and it never "won" a single round-pair — it succeeded by fostering cooperation.

Evolutionary Game Theory

In evolutionary biology, the Prisoner's Dilemma models reciprocal altruism. If organisms interact repeatedly, strategies like Tit-for-Tat can evolve and sustain cooperation in populations. This was a key insight of Axelrod and Hamilton's 1981 paper "The Evolution of Cooperation." The Prisoner's Dilemma also models the evolution of virulence in parasites, the maintenance of honest signaling, and the stability of mutualistic relationships.

Beyond Two Players

The N-player Prisoner's Dilemma (also called the Tragedy of the Commons) generalizes the model. Each individual benefits from defecting (free-riding), but if everyone defects, the shared resource collapses. Real-world examples include overfishing, pollution, and vaccine hesitancy. Solving these multi-player dilemmas requires institutional mechanisms: regulation, taxation, reputation systems, or repeated interaction — all of which can be understood through the lens of game theory.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • A game where two players each choose to cooperate or defect. Defection is individually rational but mutually harmful, creating a tension between self-interest and collective good.