The spatial variant of the iterated prisoner's dilemma is a simple yet powerful model for the
problem of cooperation versus conflict in groups. The applet below demonstrates the spread of
'altruism' and 'exploitation for personal gain' in an interacting population of individuals
learning from each other by experience. Initially the population consists of cooperators and a
certain amount of defectors (a fraction represented by *p*). The advantage of defection is
determined by the value of *b* in the 'payoff matrix' (see below) which is used to
calculate the payoff after each round for each 'player' on the basis of its strategy. For the
next round, a player determines its new strategy by selecting the most favorable strategy from
itself and its direct neighbors.

You can use the links below to learn more about this fascinating topic in 'game theory':

- Prisoner's Dilemma - Stanford Encyclopedia of Philosophy
- Game Theory - Stanford Encyclopedia of Philosophy
- Game Theory .net - A resource for educators and students of game theory
- The Evolution of Cooperation - Robert Axelrod's Classic Book
- The Evolution of Cooperation - Summary and Analysis (YouTube)
- Prisoner's Dilemma - Khan Academy
- The Iterated Prisoner's Dilemma - Axelrod's Tournament
- Evolution of Cooperation - Research by Martin Nowak
- Game Theory (YouTube Playlist) - PBS Infinite Series
- Prisoner's Dilemma in Python - Interactive Simulation
- The Evolution of Trust (YouTube)
- The prisoner's dilemma: A Fable - Bonnie and Clyde
- The Prisoner's Dilemma (Principia Cybernetica Web)
- The Ethical Spectacle - About movies, love, holocausts and more...
- Undecidability in the spatialized prisoner's dilemma - some philosophical implications (recommended)
- Original Java applet source code
- Java demo application
- Iterated spatial prisoner's dilemma on arbitrary maps
- FAQ

This interactive simulation is inspired by A.L. Lloyd's concept featured in *Scientific American* (June
1995, 80-83).

Opponent | |||
---|---|---|---|

Cooperate | Defect | ||

Player | Cooperate | 1 | 0 |

Defect | b | 0 |

- is cooperating, did cooperate
- is defecting, did defect
- is cooperating, did defect
- is defecting, did cooperate

**b**: advantage for defection when opponent cooperates

**p**: fraction (0..1) of defectors in the first round

- Try different
*b*values between 1.00 and 3.00. Find out how the behavior changes. When do defectors tend to be isolated and when do they form interconnected structures around moving colonies of cooperators? - To see the gradual defector invasion pattern choose a low value for
*p*(like 0.001) and a*b*value about 1.85... and if you're lucky enough to start with just one defector you'll get the*kaleidoscope*. *Chen figures*. Rowland Chen discovered that if you use*b*= 1.9 and*p*= 0.6 a " walking man" will appear in about 1 out of 20 runs. Also a "crawling bug" can emerge. A stable figure that looks like a rotating*F*appears more often. Rory Plaire noted that some interesting patterns emerge when*b*= 1.800000015 and*p*= 0.5, e.g. the "crawling bug" (or "walking man" seen from above) making the kaleidoscope explode. The FAQ may be helpful in explaining these phenomena.- [...]

A JavaFX application is available on GitHub. Its also provides history charts.