Spatial Games

Watch cooperation rise and fall on a grid of simple players who copy whichever neighbor is doing best.

Generation 0 Cooperators
Cooperator Defector Just defected Just cooperated

Try a preset

Temptation b

Cooperators win. They hold big clusters; defectors survive only as thin lines.
Coexistence. Each side keeps invading the other, so it never settles.
Defectors dominate. Only a few small, frozen cooperator clusters hold on.

Starting grid

A fresh grid where 1 in 10 squares starts as a defector.
A single defector in a sea of cooperators. With b = 1.63 it grows into a symmetric, ever-changing pattern.
Pick a photo: dark pixels become defectors, light pixels cooperators. It stays on your device.

What is this?

A simple model of how cooperation can survive among selfish neighbors, from a 1992 paper by Martin Nowak and Robert May. Each square on the grid is a player that either cooperates (helps the players next to it) or defects (takes advantage of them).

The rules

Each round, every square plays a quick game with its neighbors, the 8 squares touching it (fewer at the edges). Two cooperators each earn 1 point, a defector facing a cooperator earns b points while the cooperator gets 0, and two defectors get 0; a square's score is its total from all its neighbors. Then every square switches, all at the same moment, to the strategy of the highest scorer among itself and its neighbors.

b is the temptation to defect: how much a defector gains by cheating a cooperator. It is always more than 1, the reward for cooperating. One round of playing and switching is a generation.

Reading the colors

Blue and red squares kept their strategy this generation. Yellow and green squares just switched, so they show where the action is.