Which helping strategy does best while the population booms and crashes? Orange circles are ethnocentrics, purple stars altruists, slate squares egoists and cyan diamonds cosmopolitans. Averaged over a run at the defaults, ethnocentrics make up about a third of the population and altruists about 30%; with the Generous world preset altruists lead, at 40 to 46%.
Try this Set death-chance to 5 (it takes effect live). Booms now stay in the hundreds, well under the cap, and ethnocentrics average roughly 35 to 55% of the population, but the run still ends with everyone dead, usually within 450 ticks.
About this model Where it ends up The run stops by itself when nobody is left. At the defaults most runs hold at the cap for a few hundred ticks and then crash to extinction, usually between ticks 350 and 1,150. With the Generous world preset the population held at the cap for all 1,200 ticks in each of six runs, and the run keeps going.
Loosely based on Hammond and Axelrod's model of the evolution of ethnocentrism (Journal of Conflict Resolution, 2006) and NetLogo's Ethnocentrism. Each agent has a group colour and two inherited choices, so it is an altruist, an ethnocentric (helps only its own group), an egoist or a cosmopolitan (helps only other groups). In the original, ethnocentrics come to dominate a spatial population.
Here people sit at random points on a 61 × 49 torus and never move; the four groups are dealt out evenly at setup and inherited unchanged. Each tick, in random order, every person pays 1 energy and picks one random person within interaction-radius. It pays cost-of-giving if its own rule says to help that partner, and gains gain-of-receiving if the partner's rule says to help it; the partner's energy is not touched. Then anyone above 8 energy reproduces with probability reproduction-chance percent, halving its energy with an identical child placed next to it, after which each of the parent's two choices flips with probability mutation-rate percent. Births stop once the headcount reaches max-population (default 1,200): people are counted once per tick and each birth adds one, so the population never goes over the cap. Last, people with no energy left die, and so does each person with probability death-chance percent. population and the two initial-cooperate settings are read at setup; the rest, max-population included, every tick.
In Hammond and Axelrod's model each agent holds one lattice site and plays its four neighbours, a child needs an empty neighbouring site, an immigrant with random traits arrives every tick, and an offspring's group can mutate. Space limits their population to one agent per site. People here have no sites, so max-population caps the headcount instead, and the other mechanisms are left out. Because children are born beside their parents, neighbourhoods soon become one colour: by tick 200, 84 to 100% of pairs of people within 2 patches of each other share a group, so ethnocentrics act like altruists and cosmopolitans like egoists.