Prisoner's Dilemma Simulation

By Raj Saha, PhD

The Prisoner's Dilemma is a fundamental concept in game theory that demonstrates why two rational individuals might not cooperate, even when it's in their best interest to do so. This interactive simulation shows how different strategies perform when competing in a population over many iterations.

Watch as agents with different strategies interact, accumulate scores, and visualize how cooperative versus selfish strategies fare in various conditions.

Proportion of population of each group
50%
50%
Number of agents in the simulation
100
100
Total number of games to play
100
1000
Number of games each pair plays
1
10
Select Strategies

The Prisoner's Dilemma

In the classic Prisoner's Dilemma, two individuals must decide whether to cooperate or defect. If both cooperate, they each receive a moderate reward. If both defect, they each receive a small punishment. If one cooperates and the other defects, the defector gets a large reward while the cooperator gets nothing.

This creates a paradox: while mutual cooperation would benefit both players more than mutual defection, the rational strategy for an individual is to defect, leading to a worse outcome for both.

Strategies Explained

This simulation includes several well-known strategies:

Simulation Mechanics

This simulation creates a population of agents using two selected strategies. The agents are paired randomly and play multiple rounds of the Prisoner's Dilemma, accumulating scores based on their interactions.

The visualization shows both the agents (the dots on the left) and the score distribution (the histogram on the right). The size of each agent reflects its score: more successful agents appear larger.