What to do? Classical game-theory models predict that both criminals (or "players") should defect. Evolutionary biologists have interpreted this outcome as a predictin that there should be no cooperation among individuals in nature, in circumstannces mathematically similar to those in the game.
But maybe cooperation can occur if there are many players, and the many players each interact (play the game) with their neighbors.
And maybe after time, cooperation can evolve.
Here's the CA:
-
Each cell (patch) is a player. Each has two variables: its strategy and its payoff.
-
Represent strategy either by a boolean (for example, true for cooperate) or by a number (for example, 0 for defect). for convenience here, I'll use 0 for defect, 1 for cooperate.
-
In every time step, each cell plays the game with its neighbors and calculates its payoff. The payoff is the sum of the pairwise payoffs -- that is, it's the sum of the outcomes of the games played with each individual neighbor, plus itself. That's right, have each cell play with neighbors and also with itself.
-
Each cell has eight neighbors. Plus itself, each cell plays nine pairwise games.
-
Pairwise payoffs are as follows:
-
1,1 --> 1
-
0,0 --> 0
-
1,0 --> 0 (meaning the cooperator gets zero payoff if the accomplice defects)
-
0,1 --> p, where p is defined by a slider in the interface, and p > 1
-
How to read the rules as I've written them: You're trying to figure out the total payoff of some cell, with coordinates pxcor and pycor. If this cell is a cooperator, then its strategy is designated above by 1. If it's a defector, then its strategy is 0. To the left of the arrows are the strategies of two players in a pairwise game. The cell you're looking at, (the focal cell or focal player) is listed first, and the neighbor is listed second. So, say the cell is a cooperator. The simulation looks at the cell one position north, so it has coordinates pxcor and (pycor-1). If that neighbor cell is also a cooperator, then the total payoff gets 1 point. (See first rule above. Focal has strategy 1, neighbor has strategy 1, so contribution to total payoff is 1 point.) Now look at the neighbor to the northeast: coordinates pxcor+1 and pycor-1. Say this neighbor is a defector. Then consult the third rule for this pairwise game's contribution to the focal cell's total payoff: it's 0 points. But what if the focal cell is a defector instead of a cooperator? Then the payoffs age given by the second and fourth rules. In games with other defectors, the contribution to total payoff is 0 points, and in pairwise games with cooperators, the contribution to total payoff is p points. Find the contributions to total payoff for all eight neighbors neighbors, and also for the pairwise game between the focal cell and itself. Add up all the contributions to total payoff according to the rules.
-
Each time step, each cell's payoff is the sum of its nine pairwise payoffs.
-
Each time step, each cell sets its next strategy to be the strategy of the neighbor (eight neighbors plus self) with the highest payoff.
-
How to do this step, in which you choose the strategy of the neighbor with the highest total payoff? It's tricky. I'll give you one piece of code which you might find useful:
ask patches [
if max values-from neighbors[payoff] > payoff [
set next-strategy (current-strategy-of max-one-of neighbors[payoff])
]
]
-
Try color-coding the different strategies. Red for defect and blue for cooperate, or something. Try using different shades of color for newly-turned defectors and newly-turned cooperators, like light blue for new defectors and dark blue for veteran defectors.
-
Try running the CA with a random configuration, and try running it with a single cooperator in a sea of defectors.
-
When does cooperation persist? Do you ever get a dynamic steady state fluctuating between defectors and cooperators? Under what initial conditions do you get what behavior? In what ranges of p?
