NetLogo banner

 NetLogo Publications
 Contact Us

 Modeling Commons

 User Manuals:
 Farsi / Persian


NetLogo Models Library:
Curricular Models/BEAGLE Evolution/EACH

(back to the library)

Divide The Cake

[screen shot]

If you download the NetLogo application, this model is included. You can also Try running it in NetLogo Web


This is an evolutionary game-playing model. Three types of agents must divide a common resource. In the original model it's cake, but let's think of it as edible grass instead, which is green. The agents come in three types: modest, fair, and greedy. The agents move around competing for grass. Agents need grass in order to produce offspring, so over time, the agent types that get more grass will tend to increase in number.

This model (and Cooperation and Altruism) are part of the EACH unit ("Evolution of Altruistic and Cooperative Habits: Learning About Complexity in Evolution"). See for more information on the EACH unit. The EACH unit is embedded within the BEAGLE (Biological Experiments in Adaptation, Genetics, Learning and Evolution) evolution curriculum. See


Agents randomly wander the map.

When there are only two agents on a patch of grass, each of the agents tries to eat a certain amount of the grass.

There are three types of agents: - Modest agents (brown) who try to eat one-third of the grass on a patch - Fair agents (red) who try to eat one-half of the grass on a patch - Greed agents (blue) who try to eat two-thirds of the grass on a patch

If the total amount requested by both agents is greater than 100%, then both agents die. Otherwise, each agent gets its requested share of the patch's resources.

Each agent then enters a reproduction lottery based on its appetite: the greater the appetite, the greater the chance of reproduction. This factor gives a fitness advantage to the agents with a greater appetite that counteracts the disadvantage of having a greater appetite.

Each turn, every patch resets to the full amount of grass.


SETUP: Creates the agents.

GO: Starts the model running.

INITIAL-NUMBER: Creates this number of turtles of all three types together.

MODEST-PROPORTION, FAIR-PROPORTION, GREEDY-PROPORTION: These sliders set the proportions of the three agent types within the initial number of agents. Note that the actual numbers chosen for these three sliders are irrelevant--only the ratio of the three numbers counts vis-a-vis the setting of the INITIAL-NUMBER slider. For example, the ratio settings "1 1 1" will produce roughly equal numbers of each type, as will the settings "79 79 79" or what-have-you. Likewise, the setting "0 0 1" is no different from "0 0 88", etc.

TRAVEL-DISTANCE: The value of this variable determines the number of steps an agent moves each turn. This value is the mobility of an agent.

VISCOSITY: This variable is the difficulty of movement. It limits the general mobility of agents.


If you run the model with the default settings (high viscosity), notice how the population of fair agents increases. Why does this happen?

Also, notice how the modest and greedy populations and the modest and fair populations congregate in dynamically-stable communities but the greedy and fair populations do not seem to co-exist. Why does this happen?


Try changing the population VISCOSITY value. What happens when this value is decreased? How does this affect the survival and the grouping of the different populations?

Change the starting ratios of the populations. How do these ratios affect the behavior of the model? Why should the model depend on these ratios?

Change TRAVEL-DISTANCE. How does it affect the model? What is the relationship between the values of TRAVEL-DISTANCE and VISCOSITY?


What environmental variables might affect the model? Should the grass grow back to its full length each turn? How would changing the rejuvenation of available resources affect the model?

Should the agents be informed of each other's anticipated demands prior to making their claims? If they did, then agents could bargain before asking for food, and therefore reduce their chances of death as a result of a joint demand that exceeds the available resources, e.g., 1/2 + 2/3 > 1. This bargaining behavior would change the model drastically, but is an interesting way of exploring how populations may adapt their interpersonal behaviors in order to survive. A question would then arise of whether such survival does or does not ultimately play against agents as a type, because the price of survival could be a depletion of resources in future generations.


  • Altruism
  • Cooperation
  • PD Basic


This model, the Cooperation model and the Altruism model are part of the curriculum unit "Evolution of Altruistic and Cooperative Habits: Learning About Complexity in Evolution". See for more information. The EACH unit is embedded within the BEAGLE (Biological Experiments in Adaptation, Genetics, Learning and Evolution) evolution curriculum. See

This model is based on William Harms's "Divide the Cake" model, described in Brian Skyrms's book "The Evolution of the Social Contract".

Thanks to Damon Centola for his implementation of this model.


If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.

For the model itself:

Please cite the NetLogo software as:


Copyright 1997 Uri Wilensky.


This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.

Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at

This model was created as part of the project: CONNECTED MATHEMATICS: MAKING SENSE OF COMPLEX PHENOMENA THROUGH BUILDING OBJECT-BASED PARALLEL MODELS (OBPML). The project gratefully acknowledges the support of the National Science Foundation (Applications of Advanced Technologies Program) -- grant numbers RED #9552950 and REC #9632612.

This model was converted to NetLogo as part of the projects: PARTICIPATORY SIMULATIONS: NETWORK-BASED DESIGN FOR SYSTEMS LEARNING IN CLASSROOMS and/or INTEGRATED SIMULATION AND MODELING ENVIRONMENT. The project gratefully acknowledges the support of the National Science Foundation (REPP & ROLE programs) -- grant numbers REC #9814682 and REC-0126227. Converted from StarLogoT to NetLogo, 2002.

(back to the NetLogo Models Library)