In well-mixed populations the equilibrium fractions of cooperators and defectors are easily calculated using the replicator equation:

dxi/dt=xi (Pi - P)

where xi denotes the frequency, Pi the payoff (fitness) of strategy i and P the average population payoff. The replicator equation simply states that the success of a strategy depends on its relative performance in the population. Therefore, strategies with a higher than average payoff will spread. In a population with a fraction of x cooperators and y = 1 - x defectors the replicator equation reduces to

dx/dt = x(1 - x) (Pc - Pd)

where Pc and Pd denote the average payoffs of cooperators and defectors, respectively. The above equation has three equilibria: two trivial ones with x1 = 0 and x2 = 1 as well as a non-trivial one for Pc = Pd which leads to

x R + (1 - x) S = x T + (1 - x) P
x3 = (S - P) / (T + S - R - P).

The stability of all three equilibrium points is easily obtained by checking dx/dt near the equilibium points: x1 = 0 is stable if P > S, x2 = 1 stable if R > T and x3 is stable if S > P and T > R, i.e. whenever both x1 and x3 are unstable.

Instead of referring to the fraction of cooperators, x may equally refer to the propensity of cooperation in a continuous strategy space. This equivalent interpretation leaves the above calculations and conclusions unaffected but it does affect the individual based simulations. In particular, we need to introduce mutations. The replicator equation then determines the fate of a rare mutant y when competing against the resident x. If the mutation is favorable the mutant will spread and usually displace the resident.

## Dynamical regimes

The following examples illustrate and highlight different relevant scenarios but at the same time they are meant as suggestions and starting points for further exploring and experimenting with the dynamics of the system. If your browser has JavaScript enabled, the following links open a new window containing a running lab that has all necessary parameters set as appropriate.

### Legend

Time evolution of the fraction of cooperators and defectors in well-mixed populations with individuals engaging in prisoner's dilemma and snowdrift interactions.

 Color code: Cooperators Defectors

### Prisoner's Dilemma

The Prisoner's Dilemma is characterized by the payoff ranking T>R>P>S which means x1=0 is stable, x2=1 unstable and x3 not in [0,1]. Therefore, regardless of the initial configuration of the population cooperators are bound to go extinct. Consequentially everybody in the population ends up with the payoff P instead of the preferrable R for mutual cooperation - hence the dilemma.

The sample simulation shows the time evolution of the fraction of cooperators in a well-mixed population playing the Prisoner's Dilemma when starting with 99% cooperators.

### Snowdrift and Hawk-Dove game

For the Snowdrift and Hawk-Dove game the characteristic payoff ranking is T>R>S>P. From the above calculation follows that now both x1=0 and x2=1 are unstable but x3 is stable. Consequentially a stable mixture of cooperators and defectors evolves. Note that the average population payoff in equilibrium is smaller than R - just as in the Prisoner's Dilemma. Thus the paradox of cooperation is also apparent in the Snowdrift or Hawk-Dove games.

The sample simulation shows the time evolution of the fraction of cooperators in a well-mixed population playing the Snowdrift or Hawk-Dove game. Since the sample simulations consider finite populations, small fluctuations around the equilibrium occur.

## Virtual lab

Along the bottom of the VirtualLab are several buttons to control the execution and the speed of the simulations. Of particular importance are the Param button and the data views pop-up list on top. The former opens a panel that allows to set and change various parameters concerning the game as well as the population structure, while the latter displays the simulation data in different ways.

Color code: Cooperators Defectors New cooperator New defector
 Payoff code: Low High

Note: The yellow and green colors are very useful to get an intuition of the activitiy in the system. The shades of grey of the payoff scale are augmented by blueish and reddish shades, which indicate the payoffs for mutual cooperation and defection, respectively.

Java applet on cooperation in structured populations. Sorry, but you are missing the fun part!
Params Views Controls Pop up panel to set various parameters. Pop up list of different data presentations. Reset simulation Start/resume simulation Next generation Interrupt simulation 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. Mouse clicks on the graphics panels generally start, resume or stop the simulations.
Structure - Strategy Mean frequency Data views Snapshot of the spatial arrangement of strategies. Mouse clicks cyclically change the strategy of the respective site for the preparation of custom initial configurations. Time evolution of the strategy frequencies. Snapshot of the spatial distribution of payoffs. Time evolution of the mean payoff of each strategy together with the average population payoff. Histogram of payoffs for each strategy.

## Game parameters

The list below describes only the few parameters related to the Prisoner's Dilemma, Snowdrift and Hawk-Dove games. Follow the link for a complete list and detailed descriptions of all other parameters such as spatial arrangements or update rules on the player and population level.

Reward:
reward for mutual cooperation.
Temptation:
temptation to defect, i.e. payoff the defector gets when matched with a cooperator.
Sucker:
sucker's payoff which denotes the payoff the cooperator gets when matched with a defector.
Punishment:
punishment for mutual defection.
Init Coop, init defect:
initial fractions of cooperators and defectors. If they do not add up to 100%, the values will be scaled accordingly. Setting the fraction of cooperators to 100% and of defectors to zero, then the lattice is initialized with a symmetrical configuration suitable for observing evolutionary kaleidoscopes.