by Olivia Jack , Dirk Brockmann

This explorable illustrates beautiful dynamical patterns that can be generated by a simple game theoretic model on a lattice. The core of the model is the Prisoner’s Dilemma, a legendary game analyzed in game theory. In the game, two players can choose to cooperate or defect. Depending on their choice, they receive a pre-specified payoffs. The payoffs are chosen such that it seems difficult to make the right strategy choice.

In the Prisoner’s Dilemma, mutually cooperating players get a high payoff. However, if a player defects in the interaction with a cooperating player, the defector gets an even larger payoff, whereas the cooperator gets nothing. When both individuals choose to defect, they also receive no or very little payoff.

So that’s the dilemma: Both individuals get high payoffs when they cooperate, but are tempted to defect anticipating an even higher reward. But if both players decide to defect, they get nearly nothing. It can be shown, that for certain sets of payoffs, it is always more rational to defect.

The Prisoner’s Dilemma has been used to explain a phenomenon known as the Tragedy of the Commons and why it is so difficult to sustain cooperation in social and biological collective systems. In a community of cooperating individuals, defectors can “invade”, they get a higher payoff than everyone else and others will be adopting defection as a better strategy. Eventually nobody will cooperate and nobody benefits.

This explorable illustrates that the situation is a bit more non-trivial, when a spatial dimension is involved. This fact and the spatial model was first introduced and analyzed by Martin Nowak and Bob May in 1992 in a seminal Nature paper titled “Evolutionary Games and Spatial Chaos”.

Press Play and keep on reading…..

This is how it works

The foundation of the system is a lattice (by default a square, optionally a hexagonal one) of sites that can be in one of two states:

  1. Cooperator (labeled $C$)
  2. Defector (labeled $D$)

At each time step a site (a player or group of players) interacts with all nearest neighbors on the lattice (the adjacent 8 sites around a given site). In each pairwise interaction with a neighbor a payoff for each participant is computed which depends on the state of each player. When a cooperator interacts with another cooperator ($C\leftrightarrow C$) each one receives a payoff $R$. When a cooperator interacts with a defector ($C\leftrightarrow D$) the defector receives a payoff $T>R$ whereas the cooperator only receives a payoff $S$ which is small, so in general $T>R>S$. When both players defect ($D\leftrightarrow D$), each receives only a tiny payoff $P$.

In the Prisoner’s Dilemma the four different payoffs fulfill the inequality: $$ T>R>P>S $$

The four different payoffs that define the game, can be adjusted with the corresponding sliders in the control panel.

In the payoff phase of the dynamics, each site computes the total payoff it receives by interacting with all the 8 neighbors and itself. After that step, every site has an updated, total payoff value.

In the adoption phase every site adopts the strategy that, among its neighbors, has received the largest payoff in the payoff phase.

All sites update their state (i.e. their strategies) synchronously. Because no random elements / factors are involved, the dynamics is entirely deterministic, the same initial condition will always yields the same dynamics.

Kaleidoscopic Patterns

By default, all sites are set to cooperate ($C$) except for a defector seed in the center. The payoffs $T$, $R$, $P$, and $S$ are set to values that generate funky patterns, in which neither cooperators not defectors win globally. Instead, waves and structures of cooperator regions and defector regions merge and invade one another. Because of the symmetry of the initial condition (a single defector site in the center), the dynamic patterns also possess this symmetry.

The colors in the display distinguish between for states of a site, sites that keep their strategy are colored teal and black, for cooperators and defectors, respectively. Sites that change their strategy are colored white or light blue (for when $D$ flips to $C$ and vice-versa).

Try this

As the beautiful dynamic pattern keeps going on, you may want to play with the $T$-slider first. If you increase the benefit of defecting, at some point the pattern should collapse into one in which only defectors survive.

Likewise, if you now decrease $T$, at some point the cooperators should win globally.

Random initial conditions

Although the patterns in the default setting are very beautiful, the dynamics is better understood in the more natural setting of starting with a certain fraction of defectors, randomly placed on the lattice. You can do this by switching to the random initial condition with the corresponding selector.

First, reset all parameters to the default setting by pressing the reset button (the one with the circle arrow below the play button). Now start with a low concentration of defectors (use the slider for it). When you press play, the emergent pattern will turn into bubbles of cooperators and defectors moving about, not finding a global static equilibrium.

Now change the initial density slider to a higher value. Then you should see patterns of how cooperators invade regions of defectors. For some values you should see moving patterns reminiscent of patterns seen in the Game of Life, see for example Complexity Explorable “Nah dah dah nah nah… (Opus, 1984)”.

Rivers of defectors

When you start with random initial conditions and slowly decrease the defector payoff $T$ at some point the asymptotic pattern will become a uniform lattice of cooperators with thin lines of defectors, that span the lattice like a web of rivers.

Hexagonal lattice

Now the question is of course: How generic are these properties? In the control panel you can change the square lattice into a hexagonal one. You may expect to see similar behavior in the hexagonal lattice. Yet, it is very difficult to find some of the more interesting, highly dynamic patterns in the hexagonal lattice. Especially the rich, kaleidoscopic patterns that are observed in the square lattice and an initial central seed of one defector. So far, I haven’t found a parameter combination that generates kaleidoscope patterns in the hexagonal system.

Why is the Prisoner’s Dilemma called that?

When explained in general terms of cooperators and defectors each receiving a payoff depending on their own and their opponent’s strategy things seem to be very abstract and detached from real situations. The game can be explained, however in a real context rather well:

Imagine two criminals commit a two crimes together, crime A and crime B. The police catch them both and can prove the criminals committed crime A. For crime B, sufficient evidence is missing. So, both criminals get a 2 year sentence for crime A. Both criminals know that if they don’t collaborate with the police, both will only get the two year sentence. Crime B is worse than A and comes with an additional 8 year sentence. The police offer each of the prisoners individually that if he/she admits to crime B all charges will be dropped for the cooperating prisoner, while the other gets the full sentence of 10 years. If both prisoners “talk” they get a reduced total sentence of 5 years. The “payoff” in this situation is the reduction of the sentence and yields the same conflict / dilemma as described above.


Related Explorables:

The Prisoner's Kaleidoscope

The prisoner's dilemma game on a lattice


The spatial hypercycle model

A Patchwork Darwinge

Evolution: Variation and Selection


Yet another Complexity Explorable on evolution

Maggots in the Wiggle Room

The dynamics of evolution