Introduction to Complex Systems


Practical Problem 22: Cooperation

In this problem, we will investigate the emergence and stability of cooperation in a population of interacting agents. In the population of patches an agent can either be a

  1. cooperator
  2. defector

patches interact with their neighborhood. At each step they receive a benefit from the cooperators in their neighborhood proportional to the number of of cooperators in it. Defectors receive a factor $F$ more of a benefit. This factor $F$ should be a slider with a range between $1$ and say $5$.

Agents can also change their state. The adopt the state of the neighbor that received the largest benefit.

setup

Set up the system such that a fraction $p$ of patches are cooperators and a fraction $1-p$ are defectors.

simulation

You can color the patches according to their state. For a better visualization you can store the “old state” in a patch variable an color the four combintations

  1. old state = “D”, New state = “D”
  2. old state = “D”, New state = “C”
  3. old state = “C”, New state = “C”
  4. old state = “C”, New state = “D”

in four different colors.