Life of Turtles - Sharing

Life of Turtles - Sharing preview image

1 collaborator

Default-person Allen Karsina (Author)


(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.0.4 • Viewed 56 times • Downloaded 1 time • Run 0 times
Download the 'Life of Turtles - Sharing' 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 is an extension from the model included in the tutorial in the **NetLogo User Manual** (as of November, 2018). The tutorial provides a simple demonstration of a limited ecosystem in which turtles consume resources, reproduce, and die. Sustainable systems result in oscillating patterns of turtle populations and resources.

This extension adds an additional variable: sharing. In the tutorial, turtles never share resources and when more than one turtle occupies the same patch, the first turtle on the patch consumes all of the resources (if there are any). In this extension, turtles can be instructed to share _all of their resources_ with turtles who occupy the same patch.

This model is designed to evaluate the effects of "selfishness" versus sharing on the population, age, and energy of turtles in a simple ecosystem.


Each patch randomly produces energy. When ENERGY is available, the patch turns green. The amount of ENERGY the patch produces is determined by the ENERGY-FROM-RESOURCES slider. The rate that patches produce energy is determined by the REPLENISH-RATE slider.

A number of turtles determined by the NUMBER slider are placed randomly on the starting screen and move in random directions, one patch at a time. Each turtle starts with 10 ENERGY, and increases ENERGY by moving onto patches with energy (i.e., green patches). Turles lose 1 unit of ENERGY each time they move. Turtles who reach a certain amount of ENERGY, set by the BIRTH-ENERGY slider, hatch a new turtle. The turtle 'giving birth' loses an amount of ENERGY equal to the BIRTH-ENERGY, and the hatchling starts with the same amount of ENERGY.

Turtles and hatchlings start with AGE at 0. Age advances by 1 unit each tick. A turtle dies when its ENERGY reaches 0 or below, or when AGE is greater than OLDAGE, a number determined by the OLDAGE slider.

A SHARE? switch determines the color of the turtles and how resources are consumed or shared _when turtles occupy the same patch_.

* When SHARE? is set to _off_, turtles never share ENERGY and when more than one turtle occupies a green patch, one of the turtles consumes all of the available ENERGY from the patch.

* When SHARE? is set to _on_, turtles who occupy the same patch (green or black) share all of their energy equally between each other.

* To aid visual analysis, the colors of the turtles who do not occupy a patch with other turtles is set to orange when SHARE? is _off_ and yellow when SHARE? is _on_. Regardless of the SHARE? setting, turtles who occcupy a patch with other turtles are set to cyan.


SETUP clears all settings, creates turtles, and resets the ticks to 0.

GO starts the simulation.

Users can examine the affects of changing the following variables:

* Change the **number of turtles** using the NUMBER slider.

* Change the **amount of energy each green patch provides** by using the ENERGY-FROM-RESOURCES slider.

* Change the **rate at which resources are replenished** by using the REPLENISH RATE slider.

* Change the amount of energy required to **give birth** to a new turtle by using the BIRTH-ENERGY slider.

* Change the **behavior of the turtles** by switching the SHARING? switch on or off.

Watch the effects of your manipulations using one or more of the many monitors and graphs provided. These include

* Monitors on the top of the screen that show the total number of turtles alive at a given moment, the total number of patches with available resources, the mean age of the turtles, the median age of the turtles, and highest age of the turtles at a given time, and the mean amount of energy, median amount of energy, and maximum amount of energy of the turtles at a given time.

* To the right of the sliders on the bottom of the screen, three figures plot the total number of turtles and the total number of patches with resources, the mean age and the mean energy of the turtles, and the median age and median energy of the turtles. At the ar right, a histogram shows the distribution of the age of the turtles.


The model is set up to allow the user to quickly see the effects of sharing and not-sharing on turtle population, age, and energy.

Look closely at the effects of sharing across different initial conditions. What is the effect on age? Is it the same effect for energy? What about population?

A nice feature of the model is that sharing can be turned on and off as the model runs, allowing for an easy comparison of the effects during the same run. For anyone wishing to demonstrate a reversal design, this model provides a "hands-on" demonstration.


Run the simulation with the SHARING? switch set to off for awhile. Then flip the switch to on for about the same number of ticks. Then back to off. And so on. Watch the figures closely, especially the mean age and energy and the median age and energy figures.

Start with all the sliders set to near the middle (the default setting).

Run the next simulation with all the sliders set to near minimum, say around 10 (with OLDAGE 20).

Then run the next smulation with all the sliders at maximum.

After testing out these settings, have fun. Be sure to see how changing the BIRTH-ENERGY slider affects the outcomes.


There are many ways to extend this model. A few suggestions include the following:

* Rather than turning sharing on and off for all turtles, create a breed of turtle that shares and another that does not.

* In this model, when sharing occurs, all of the energy is summed and then divided equally among all the turtles on the same patch. What effects would other methods of sharing have (e.g., giving energy only to the neediest, etc.)?

* Create a breed of turtles that takes all the energy from other turtles occupying the same patch.

* Extend the reach of sharing to neighboring turtles.


The code for sharing is below:

`to eat-resources

ask turtles [

if pcolor = green [

set pcolor black

set energy (energy + (energy-from-resources))]

ifelse share?

[ set energy (sum [energy] of turtles-here / count turtles-here)

set color yellow ] ;;all energy shared among all turtles occupying same patch

[set color orange ] ;; otherwise keeps energy the same

if count turtles-here > 1

[ set color cyan ]




Rabbits Grass Weeds and Wolf Sheep Predation are two interacting ecosystem models similar to this one. See also the Altruism and Cooperate.


If you mention the NetLogo software in a publication, we ask that you include the citation as:

* Wilensky, U. (1999). NetLogo. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
counter  ;; set to stop running at 500 tick intervals
turtles-own [energy   ;; for keeping track of when the turtle is ready to reproduce or die
             age      ;; to track life expectancy

to setup

to setup-turtles
  create-turtles number
  ask turtles [
    set shape "turtle"
    setxy random-xcor random-ycor
    set energy 10
    set age 0                        ;; age starts at 0
    ifelse share?
    [ set color yellow ]             ;; sharing turtles set to yellow
    [ set color orange ]             ;; non-sharing turtles set to orange

to go
  if all? turtles [energy < 0] [stop]
  set counter counter + 1
  if counter = 500 [
    set counter 0

to grow-resources
  ask patches [
    if pcolor = black [
      if random-float 1000 < replenish-rate
        [ set pcolor green ]

to move-turtles
  ask turtles [
    right random 360
    forward 1
    set energy energy - 1
    set age age + 1

to eat-resources

  ask turtles [
    if pcolor = green [
      set pcolor black
      set energy (energy + (energy-from-resources))]

    ifelse share?
      [ set energy (sum [energy] of turtles-here / count turtles-here)
        set color yellow ]                     ;;all energy shared among all turtles occupying same patch
      [set color orange ]                      ;; otherwise keeps energy the same

    if count turtles-here > 1
    [ set color cyan ]

to reproduce
  ask turtles [
    if energy > birth-energy [
      set energy energy - birth-energy
      hatch 1 [
        set energy birth-energy
        set age 0

to check-death
  ask turtles [
    if energy <= 0 [ die ]
    if age > oldage [die]  ;; to effects of sharing across life expectancies

There is only one version of this model, created 4 months ago by Allen Karsina.

Attached files

File Type Description Last updated
Life of Turtles - Sharing.png preview Preview for 'Life of Turtles - Sharing' 4 months ago, by Allen Karsina Download

This model does not have any ancestors.

This model does not have any descendants.