Sugarscape 1 Immediate Growback

Sugarscape 1 Immediate Growback preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)


social science 

Tagged by Reuven M. Lerner over 9 years ago

Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 620 times • Downloaded 44 times • Run 0 times
Download the 'Sugarscape 1 Immediate Growback' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


This first model in the NetLogo Sugarscape suite implements Epstein & Axtell's Sugarscape Immediate Growback model, as described in chapter 2 of their book Growing Artificial Societies: Social Science from the Bottom Up. It simulates a population with limited, spatially-distributed resources available.


Each patch contains some sugar, the maximum amount of which is predetermined. At each tick, each patch grows back fully to have the maximum amount of sugar. The amount of sugar a patch currently contains is indicated by its color; the darker the yellow, the more sugar.

At setup, agents are placed at random within the world. Each agent can only see a certain distance horizontally and vertically. At each tick, each agent will move to the nearest unoccupied location within their vision range with the most sugar, and collect all the sugar there. If its current location has as much or more sugar than any unoccupied location it can see, it will stay put.

Agents also use (and thus lose) a certain amount of sugar each tick, based on their metabolism rates. If an agent runs out of sugar, it dies.


Set the INITIAL-POPULATION slider before pressing SETUP. This determines the number of agents in the world.

Press SETUP to populate the world with agents and import the sugar map data. GO will run the simulation continuously, while GO ONCE will run one tick.

The VISUALIZATION chooser gives different visualization options and may be changed while the GO button is pressed. When NO-VISUALIZATION is selected all the agents will be red. When COLOR-AGENTS-BY-VISION is selected the agents with the longest vision will be darkest and, similarly, when COLOR-AGENTS-BY-METABOLISM is selected the agents with the lowest metabolism will be darkest.

The four plots show the world population over time, the distribution of sugar among the agents, the mean vision of all surviving agents over time, and the mean metabolism of all surviving agents over time.


After 20 ticks or so, many agents are no longer moving or are only moving a little. This is because the agents have reached places in the world where they can no longer see better unoccupied locations near them. Since all sugar grows back instantaneously each tick, agents tend to remain on the same patch.

Agents tend to congregate in "layers" around borders where sugar production levels change. This unintended behavior comes from the limitation of the agents' vision ranges. Agents that cannot see past the current sugar production grounds have no incentive to move, and so each agent only moves to the closest location with more sugar. This effect is more less apparent depending on the initial population.


Try varying the initial POPULATION. What effect does the initial POPULATION have on the final stable population? Does it have an effect on the distribution of agent properties, such as vision and metabolism?


All of the Sugarscape models create the world by using file-read to import data from an external file, sugar-map.txt. This file defines both the initial and the maximum sugar value for each patch in the world.

Since agents cannot see diagonally we cannot use in-radius to find the patches in the agents' vision. Instead, we use at-points.


Other models in the NetLogo Sugarscape suite include:

  • Sugarscape 2 Constant Growback
  • Sugarscape 3 Wealth Distribution


Epstein, J. and Axtell, R. (1996). Growing Artificial Societies: Social Science from the Bottom Up. Washington, D.C.: Brookings Institution Press.


If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:


Copyright 2009 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

Comments and Questions

Course "Political Attitudes: Modelling & Simulation" (Question)

Hi! I need some well-known models to run as demos for one of my courses on modelling & simulation. Unfortunately, no old model works for Sugarscape as it was written in old NetLogo version. May I kindly ask how can I get a running version of Sugarscape for demo and teaching for my courses? Looking forward to your collaboration, Best wishes, Camelia Florela Voinea, PhD, Assoc. Prof. University of Bucharest

Posted 7 months ago

Click to Run Model

turtles-own [
  sugar           ;; the amount of sugar this turtle has
  metabolism      ;; the amount of sugar that each turtles loses each tick
  vision          ;; the distance that this turtle can see in the horizontal and vertical directions
  vision-points   ;; the points that this turtle can see in relative to it's current position (based on vision)

patches-own [
  psugar           ;; the amount of sugar on this patch
  max-psugar       ;; the maximum amount of sugar that can be on this patch

;; Setup Procedures

to setup
  create-turtles initial-population [ turtle-setup ]

to turtle-setup ;; turtle procedure
  set color red
  set shape "circle"
  move-to one-of patches with [not any? other turtles-here]
  set sugar random-in-range 5 25
  set metabolism random-in-range 1 4
  set vision random-in-range 1 6
  ;; turtles can look horizontally and vertically up to vision patches
  ;; but cannot look diagonally at all
  set vision-points []
  foreach n-values vision [? + 1]
    set vision-points sentence vision-points (list (list 0 ?) (list ? 0) (list 0 (- ?)) (list (- ?) 0))
  run visualization

to setup-patches
  file-open "sugar-map.txt"
  foreach sort patches
    ask ?
      set max-psugar file-read
      set psugar max-psugar

;; Runtime Procedures

to go
  if not any? turtles [
  ask patches [
  ask turtles [
    if sugar <= 0
      [ die ]
    run visualization

to turtle-move ;; turtle procedure
  ;; consider moving to unoccupied patches in our vision, as well as staying at the current patch
  let move-candidates (patch-set patch-here (patches at-points vision-points) with [not any? turtles-here])
  let possible-winners move-candidates with-max [psugar]
  if any? possible-winners [
    ;; if there are any such patches move to one of the patches that is closest
    move-to min-one-of possible-winners [distance myself]

to turtle-eat ;; turtle procedure
  ;; metabolize some sugar, and eat all the sugar on the current patch
  set sugar (sugar - metabolism + psugar)
  set psugar 0

to patch-recolor ;; patch procedure
  ;; color patches based on the amount of sugar they have
  set pcolor (yellow + 4.9 - psugar)

to patch-growback ;; patch procedure
  ;; immediately grow back all of the sugar for the patch
  set psugar max-psugar

;; Utilities

to-report random-in-range [low high]
  report low + random (high - low + 1)

;; Visualization Procedures

to no-visualization ;; turtle procedure
  set color red

to color-agents-by-vision ;; turtle procedure
  set color red - (vision - 3.5)

to color-agents-by-metabolism ;; turtle procedure
  set color red + (metabolism - 2.5)

; Copyright 2009 Uri Wilensky.
; See Info tab for full copyright and license.

There are 9 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 9 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 10 years ago Updated version tag Download this version
Uri Wilensky over 10 years ago Updated to version from NetLogo 5.0.3 distribution Download this version
Uri Wilensky about 11 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 12 years ago Model from NetLogo distribution Download this version

Attached files

File Type Description Last updated
Sugarscape 1 Immediate Growback.png preview Preview for 'Sugarscape 1 Immediate Growback' almost 10 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.