What you just saw
In well-mixed populations, defection always wins the prisoner's dilemma. But on a 2D grid, cooperators can survive by clustering — the edge of a cooperator cluster loses to defectors, but the interior is safe, and the cluster as a whole outgrows defector patches. There's a sharp phase transition near T = 1.50: below it, cooperation dominates; above it, defection sweeps the grid.
The science behind it
Martin Nowak and Robert May introduced this model in Nature in 1992. It was one of the first convincing demonstrations that spatial structure — not kin selection, reciprocity, or reputation — is enough to sustain cooperation in a prisoner's dilemma. It became the foundation of an entire field studying the evolution of cooperation on networks, including modern results on heterogeneous scale-free networks (Santos & Pacheco, 2005).
Try these experiments
1. Cooperator-dominated
Settings: temptation=1.4
What to look for: Cooperators survive in stable clusters. Fraction stabilizes around 0.6–0.8.
2. Edge of chaos
Settings: temptation=1.50
What to look for: Noisy, turbulent boundaries. The cooperator fraction oscillates and the pattern looks alive.
3. Defection wins
Settings: temptation=1.7
What to look for: Defection sweeps the grid in ~20 steps. No cooperator clusters survive.
Run this at 100x scale
Spatial cooperation runs in your browser up to 6,400 agents. With SimLab, the same model runs on GPU at 10M+, with ensemble parameter sweeps and publication-ready output.
from scirouter import SciRouter
client = SciRouter(api_key="sk-sci-...")
result = client.simulation.run(
model="cooperation",
params={"grid_size": 1000, "temptation": 1.45,
"initial_cooperator_fraction": 0.5},
steps=500, seed=42,
)Related simulations
Schelling Segregation Simulator
Watch neighborhoods self-segregate from mild individual preferences. Drag the tolerance slider and see the 1971 model come alive.
Voter Model Simulator
Binary opinion dynamics on a network. See how zealots, media influence, and network structure drive consensus vs. polarization.
Sugarscape Wealth Simulator
The Epstein–Axtell economy. Heterogeneous agents harvest sugar under lookup rules; watch Pareto wealth distribution emerge.
Conway's Game of Life
Conway's 1970 cellular automaton. Drop gliders, guns, and spaceships on the grid, or draw your own and watch them evolve.
Frequently asked questions
Why does spatial structure save cooperation?›
A cooperator surrounded by other cooperators scores high from every interaction. A defector surrounded by other defectors scores near zero. Clusters of cooperators can out-score the defector cells on the boundary, even though each individual defector beats each individual cooperator in pairwise play.
What exactly is T?›
The temptation payoff — what a defector gets when playing against a cooperator. Cooperators against cooperators score 1; cooperators against defectors score 0; defectors against defectors score 0. When T > 1, defection pays better against cooperators than cooperation pays against itself. When T crosses ~1.50, defection wins the spatial battle too.