Library/Social sciences
Cooperation and social dilemmas
The world is a small toroidal grid (31 x 31 = 961 agents).
Read the assumptions first. The model itself says it is illustrative and uncalibrated. Treat its output as a demonstration of a mechanism, not an estimate of a real system.
An illustrative, uncalibrated educational model of the spatial iterated Prisoner's Dilemma (PD). It shows how cooperation can emerge and persist among self-interacting agents even when defection is individually tempting.
Mechanism
- The world is a small toroidal grid (31 x 31 = 961 agents). Each patch is one agent that plays PD with its 8 neighbors every tick.
- Each agent has a strategy: cooperate (green) or defect (red).
- Payoffs follow the classic PD ordering T > R > P > S:
- After scoring, each agent copies the strategy of its best-scoring neighbor. With probability
mutation-rateit instead picks a random strategy. This "best-neighbor imitation + mutation" rule is a standard way to study the evolution of cooperation. - The population is bounded (fixed number of agents) and the world is small, so the model runs quickly and is easy to observe.
- T (temptation) = payoff for defecting against a cooperator - R (reward) = payoff for mutual cooperation - P (punishment) = payoff for mutual defection - S (sucker) = payoff for cooperating against a defector
Controls
- initial-cooperation (0-1): fraction of agents that start as cooperators.
- mutation-rate (0-0.2): probability an agent randomly switches strategy each tick.
- tempt / reward / punish / sucker: the four PD payoffs. Defaults (5, 3, 1, 0) give the standard dilemma ordering T > R > P > S.
Monitors and plot
- cooperators / defectors: counts of each strategy.
- cooperation fraction: cooperators / total agents.
- Cooperation over time: plot of the cooperation fraction per tick.
Assumptions and limitations
- Agents are placed on a fixed grid; there is no movement, no memory of past interactions, and no reputation.
- Imitation is based only on the current tick's scores, not on accumulated payoffs.
- The payoff values are arbitrary and chosen for illustration, not fitted to any real data.
- Results depend on the random seed; individual runs vary.
- This is a teaching tool, not a scientifically validated model. Do not use its outputs as evidence about real social behavior.
Running
1. Press Setup to randomize the grid. 2. Press Go to start the simulation (it runs continuously). 3. Adjust sliders while running to see how cooperation responds.
- Field
- Social sciences
- Model file
Cooperation-and-social-dilemmas-9b5384471fe1.nlogox· 40 KB- Controls
initial-cooperation,mutation-rate,tempt,reward,punish,sucker- Reporters
patch-score- Procedures
setup,go,patch-score,recolor- Experiment
- none pinned in this file
- Documentation
- 5/7 · 347 words in the Info tab