🎯 Spatial Prisoner's Dilemma (2D)

Every agent plays the Prisoner's Dilemma against its 8 grid neighbours each round, then copies whichever neighbour scored highest. Tune the payoff matrix and watch cooperation spread, collapse, or cycle.

Legend

Always Cooperate
Always Defect
Tit-for-Tat
Pavlov (Win-Stay)
Random 50/50

Payoff matrix

Opp. COpp. D
I cooperateR=3.0S=0.0
I defectT=5.0P=1.0

Grid & speed

Presets

Click / tap a cell on the grid to force it to the next strategy — the payoff & imitation rules replay from there.

Live stats

Cooperators—
Defectors—
Mean payoff—
Round #0