Spatial 2×2 games

by Christoph Hauert, Version 2.0, January 2002.

In behavioral sciences, the essence of various interactions among humans and animals can be modeled by so called 2×2 games. Such games describe pairwise interactions between individuals with two behavioral strategies to choose from. The most prominent representative is certainly the prisoner's dilemma - a powerful framework to explain the emergence of cooperative behavior among unrelated and selfish individuals. Extensive theoretical studies identified several mechanisms capable of promoting cooperation. One of them refers to spatially extended systems which represents the main topic of the following text. In particular, a Java applet allows to experiment with such spatially extended 2×2 games and to investigate effects of different parameter settings and update rules on the systems dynamics and the equilibrium frequencies of cooperators and defectors.

IJBC cover This work was originally published as
Hauert, Ch., (2002) Effects of Space in 2×2 Games,
Int. J. Bifurcation Chaos 12 1531-1548.

The cover shows the equilibrium fraction of cooperators in well-mixed populations as a function of two parameters S, T (see below). Cooperative regions are colored blue and non-cooperative, i.e. regions with prevailing defection, are red. Intermediate fractions of cooperators are shown in light blue, green and yellow (decreasing). The dashed line separates four quadrants with different dynamical characteristics: dominating defection (top left), co-existence (top-right), prevailing cooperation (bottom right) and bi-stability (bottom left). In the last quadrant, the colors indicate the size of the basin of attraction. In blue regions even few cooperators thrive while in reddish regions cooperators prosper only in populations that are already highly cooperative.

The following pages are designed as additional material to this article and provide interactive Java applets to visualize and experiment with the system's dynamics for various parameter settings.


Virtual lab

This page requires Java capabilities.

Color code:

Table 1: Color codes for simulation
Cooperator Cooperator
Cooperator New cooperator, former defector
Defector Defector
Defector New defector, former cooperator

Note: The yellow and green colors are very useful to get an impression of the activitiy in the system.


Table 2: Applet controls
Info Author's homepage
Params Pop up panel to set various parameters
Reset Reset simulation
Run Start/resume simulation
Next Next generation
Pause Interrupt simulation
Slider Idle time between updates. On the right your CPU clock determines the update speed while on the left updates are made roughly once per second.

Note: Mouse clicks on the lattice start, resume or stop the simulations.



All of the following examples and suggestions for experimenting with the virtual lab on spatial 2×2 games refer to players interacting in the Moore neighborhood, i.e. with all neighbors reachable by a chess-kings-move. Most of the phenomena are found for the smaller von Neumann neighborhood, too. However, this requires appropriate adjustments of the parameter values S, T. In some cases specially indicated parameter values are given to demonstrate differences and similarities between simulations with the two neighborhoods. Settings that are not explicitely mentioned are assumed to take on their default values, i.e. lattice size 51×51, synchronized updates and players update their strategy with certainty.

Evolutionary caleidoscopes

For particular parameter values dynamical co-existence of cooperators and defectors is observed producing intriguing and ever changing patterns. Without noise, i.e. for deterministic update rules, the symmetry of a particularly prepared initial configuration is preserved and the emerging patterns ressembles a caleidoscope - actually an evolutionary caleidoscope since the driving force results from an evolutionary process.

Setting the initial fraction of cooperators to 100% (or 0%) creates such a symmtrical initial configuration with a single defector (cooperator) in a world of cooperators (defectors). For parameter values S=0, T=1.65 with synchronized board updates and the Best takes over-rule for the players the symmetric evolution of intriguing spatio-temporal patterns are observed. These settings correspond to the predefined defaults when the applet is loaded.


  1. Set S=0, T=1.65 with synchronized board updates and the deterministic Best takes over update rule and an initial fraction of cooperators of 100%. This creates a symmetrical initial configuration with a single defector in a world of cooperators. These settings correspond to the predefined default values once the applet is loaded.
    The time evolution preserves the initial symmetry and produces intriguing spatio-temporal patterns of sheer beauty. After 1369 generations the fascinating dynamics comes to a sudden and unexpected stop when the lattice relaxes into a homogenous state of defectors. The time until an absorbing or cyclic state with short period is reached sensitively depends on the lattice size. Appareantly there is no simple relation between the two. The above only holds for the default grid size of 51×51.
  2. Repeat the above procedure for the von Neumann neighborhood with T=1.4. The emerging caleidoscope looks quite different and it becomes appareant that the von Neumann neighborhood stresses the underlying geometry of the lattice. After roughly 5200 generations the lattice relaxes into a cyclic state with a short period (for a 51×51 lattice).
  3. Now return to the Moore neighborhood and set the initial fraction of cooperators to 80% and see what happens when changing the different update rules for the lattice and the players. Enjoy the hypnotizing effect of the ever changing patterns. If you are lucky, you may even spot moving structures such as gliders known from John von Neumanns Life cellular automaton.

Prisoner's dilemma:

The prisoner's dilemma requires T>1 and S<0. In well mixed populations such parameter values eventually lead to the extinction of cooperators. In general, this equally holds for spatially extended systems. Only for a very small parameter range with roughly T<S+5/3 cooperators can outweigh their losses against defectors by forming clusters. The size of this range is further reduced by stochastic components of the different update rules. Nevertheless and despite its small size, this range is particularly important because it demonstrates that cooperative behavior can survive and prosper just by adding spatial extension and without the requirement for any sophisticated strategic behavior.


  1. Set T=1.5, S=-0.5 and the initial fraction of cooperators to 80%. Within few generations all cooperators will have vanished. In the case of Best takes over larger clusters of cooperators can persist (for T<2) but the slightest amount of noise in the player's update rule will wipe out these fragile structures.
  2. Decrease the temptation to T=1.1. Now cooperators may dominate the system depending on the player's update rule. The characteristical patterns are:
    1. for Best takes over defectors form a persistent thin network,
    2. for Imitate the better cooperators form large clusters meandering through space due to the stochastic strategy changes of players along their boundaries.
    3. for the Proportional update cooperators are still unable to survive. This would require parameter values still closer to the limits of the prisoner's dilemma.

Hawk dove game:

The hawk dove game requires 0<S<1 and T>1. In well mixed populations these parameter values lead to co-existence of hawks and doves, i.e. of cooperators and defectors. The equilibrium frequencies of the two strategies depends on S, T: fc=S/(S+T-1). This implies that the equilibrium state is essentially independent of the initial configuration.

The spatial arrangement does not change the qualitative picture. However, it does affect the exact equilibrium frequencies of cooperators and defectors. For the deterministic Best takes over update rule local configurations have a strong influence on the evolution of the system. As a consequence the fractions of cooperators and defectors occur only at discrete levels. The transition points can be directly related to growth conditions of particular spatial configurations. These levels are less pronounced for the weakly stochastic Imitate the better and are almost absent for the Proportional update rule.


  1. Set S=0.5 and T=1.8. Compare the spatial patterns after 100 generations with initially 5% and 95% cooperators. After only few generations the patterns are very similar and fluctuate around 30% of cooperators. For Imitate the better you may even start with 0% and 100% cooperators.
  2. With S, T as above, synchronized lattice updates and the deterministic Best takes over rule, another type of evolutionary caleidoscopes are obtained for symmetrical initial conditions i.e. when setting the initial fraction of cooperators to 100%. Note the differences to the type of caleidoscopes mentioned above. Instead of travelling waves producing ever changing patterns, the patterns now rather ressemble structures blinking with various periods.


For S>0 and T<1 a well mixed population eventually relaxes into a homogenous state of cooperators regardless of the initial configuration. In spatially extended systems this is generally equally true. However, for parameter values S<T/N it becomes increasingly unlikely that an isolated cooperator is able to expand in a neighborhood of size N (von Neumann: N=4; Moore N=8). This is particularly pronounced for Best takes over. In that case, cooperators expand only if at least one cooperator finds other cooperators in its neighborhood. This then acts as a seed for the future success of cooperators. On finite grids such configurations require either many realizations or a certain initial frequency of cooperators. Obviously the probability to find neighboring cooperators scales with the lattice size.


  1. Set S=0.5 and T=0.5. Verify how quickly the system reaches the homogenous state regardless of the initial configuration and the update rules.
  2. For S=0.01 and T=0.5 you need good luck or at least around an initial 3% of cooperators. Otherwise they go extinct. Start 10 simulations with 0.5% cooperators on the default 51×51 lattice and repeat it on a 100×100 lattice. For Best takes over and synchronized lattice updates should find something like 10% ending in the cooperative state on the small lattice but with around 70% on the larger lattice.


For S<0 and T>1 defection dominates and the system eventually reaches a homogenous state of defectors regardless of the initial configuration. In general this also holds for spatially structured populations. Only for a very small parameter range cooperators are able to survive through cluster formation. For further details see the example on the prisoner's dilemma above.


For S<0 and T<1 a well mixed population is bi-stable, i.e. depending on the initial configuration the system approaches either a state of homogenous cooperation or homogenous defection. In this parameter range spatial extension has the most pronounced effect on the long term fate of the strategies. The parameter values S, T determine the stability i.e. average lifetime of certain local configurations. The probability for their creation at initialization time sensitively depends on the initial fraction of cooperators.


  1. Set S=-1, T=0.9 with synchronized board update and Best takes over. Compare the frozen patterns when starting with an initial fraction of 20%, 50% and 80% cooperators. Generally you see the following: for 20% defectors win, for 50% few rectangular clusters of cooperators survive and for 80% cooperators dominate and together with narrow networks and small patches of defectors.
  2. Repeat the same simulations dor Imitate the better. Generally, 20% still leads to homogenous defection but 80% now usually result in homogenous cooperation. For 50% the final state crucially depends on the initial configuration - some converge to cooperation and others to defection.


In well mixed populations co-existence requires that S>0 and T>1. The equilibrium frequency of cooperators is then given by fc=S/(S+T-1). Interestingly, in this parameter region spatial extension generally favours defectors. For further details and suggestions for simulations see the example on the hawk dove game - the most prominent representative of this category.


Table of contents

  1. Introduction
    1. 2×2 Games
    2. Prisoner's dilemma
    3. Hawk dove game
  2. Spatial Games
    1. Parameters
  3. References & further reading



For the development of these pages help and advice of the following two people was of particular importance: First, my thanks go to Karl Sigmund for insipiring discussions and helpful comments on the game theoretical parts and second, my thanks go to Urs Bill for introducing me into the Java language and for his patience and competence in answering my many technical questions.
Financial support of the Swiss National Science Foundation is gratefully acknowledged.


Updated on Tuesday, January 5, 2002 by Christoph Hauert.