NetLogo banner

NetLogo Publications
Contact Us

Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Farsi / Persian


NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)


Predator, Prey, Poison is a model of the interactions of predators, prey, and food eaten by the prey. The predator is represented by coyotes, the prey by rabbits, and the prey's food by grass, although the model can apply to any three species in an ecological food chain. The model simulates the population dynamics of coyotes and rabbits as they move around a grassy meadow feeding, reproducing, and dying. During part of a simulation, some patches of the meadow are treated with a poison that kills any rabbits or coyotes that move to those patches.

Using this model, you can ask how a generalized source of mortality on both predators and prey (poisoning) influences the relative abundances of the predators and prey. This question was first investigated by the Italian mathematician Vito Volterra in the 1920s in response to a question from a fisheries biologist named Umberto D'Ancona who was engaged to Volterra's daughter. During World War I, commercial fishing decreased in the Adriatic Sea, presumably because it was a war zone. D'Ancona noticed that numbers of predatory sharks increased relative to numbers of cod and other prey species during World War I, while the pattern was reversed after the war ended and fishing increased to pre-war levels. D'Ancona wondered if his future father-in-law could explain these results. Volterra built an abstract mathematical model to do so; Predator, Prey, Poison is an individually based and spatially-explicit computer simulation with the same goal. In the fishing example, humans are a generalized source of mortality on both sharks and cod, so humans act like the poison in our model of coyotes, rabbits, and grass.


The interaction between coyotes and rabbits plays out on a square grid containing 2500 individual cells. The grid represents a habitat such as a field or meadow occupied by coyotes and rabbits. Each cell is a patch of grass that may be alive, in which case the patch is green, or dead, in which case the patch is brown. When you load the model, the grid is a black square in the center of the screen. When you click the Setup button in the upper left corner of the screen, some cells will become green, others brown, and black coyotes and white rabbits will appear in random positions on the grid. Brown cells represent patches that have been fed on by rabbits recently, green cells represent patches in which live grass has grown back after earlier feeding by rabbits. At the beginning of a simulation, approximately half the cells are brown and half are green.

After this Setup, you can initiate a simulation by clicking the Go button. At each time step of the simulation that develops, rabbits and coyotes move from their current locations to adjacent cells, losing energy in the process, eat and gain energy if food is available on their new cells, die if they haven't eaten for a while and have run out of energy or, in the case of rabbits, if they have been eaten by a coyote, and finally reproduce with a certain probability. This process is repeated for the total time specified on the screen with one additional feature: partway through a simulation, a small, random subset of cells receives poison that kills any coyotes or rabbits that move to those cells. These poisoned cells become black for the duration of the poisoning. You can interrupt a simulation by hitting the Go button again.


1. Adjust the sliders to change the parameters of the model (see below), or use the default settings.
2. Press the SETUP button.
3. Press the GO button to begin the simulation.
4. Look at the POPULATIONS plot at the bottom of the screen to watch the populations fluctuate over time before, during and after poisoning. The monitors above the left upper corner of this plot show the numbers of rabbits, coyotes, and poisoned cells as they change over time. The monitors adjacent to the right upper corner of the grid show the average numbers of rabbits and coyotes before, during, and after poisioning.


TOTAL-TIME: Total number of time steps in a simuation run. The minimum is 100, the maximum is 2000, and the default is 1300.

INITIAL-NUMBER-RABBITS: The initial size of the rabbit population (minimum = 0, maximum = 400, default = 250).

INITIAL-NUMBER-COYOTES: The initial size of the coyote population (minimum = 0, maximum = 250, default = 100).

RABBIT-GAIN-FROM-FOOD: The amount of energy rabbits gain from each patch of green grass eaten (minimum = 0, maximum = 50, default = 5).

COYOTE-GAIN-FROM-FOOD: The amount of energy coyotes gain from each rabbit eaten (minimum = 0, maximum = 100, default = 20).

RABBIT-REPRODUCE: The probability of a rabbit reproducing at each time step (minimum = 0%, maximum = 20%, default = 5%).

COYOTE-REPRODUCE: The probability of a coyote reproducing at each time step (minimum = 0%, maximum = 20%, default = 5%).

GRASS-REGROWTH-TIME: The amount of time it takes grass on a patch to regrow after being eaten by rabbits. (Minimum is 0, maximum = 100, default = 20).

START-POISON: Time at which poisoning begins (minimum = time step 0, amximum = TOTAL-TIME, default = time step 450).

END-POISON: Time at which poisoning ends (minimum = START-POISON 0, maximum = TOTAL-TIME, default = time step 750).

POISON-PERCENT: Percentage of cells to which poison is applied between START-POISON and END-POISON (minimum = 0%, maximum = 20%, default = 1.5%).


Do the locations of green and brown cells change as the model is run? How about the locations of black cells during poisoning? What do these patterns represent?

What is the effect of poisoning on the population of coyotes? What is the effect of poisoning on the population of rabbits? If these effects differ, why do you think this is the case?

How do the population dynamics of rabbits and coyotes after poisoning ends compare to those before poisoning and during poisoning?


Try increasing the percentage of cells that are poisoned during the middle of a simulation run when poison is activated. Do either coyotes or rabbits disappear entirely from the world of our simulation? If so, which population disappears first as the precentage of poisoned cells is gradually increased? How does this relate to the use of DDT or other pesticides to control insect pests in habitats in which birds eat the insects?

What happens if you decrease the percentage of cells that are poisoned to 0, thus eliminating poisoning altogether from a simulation?

Try changing the intial numbers of rabbits and coyotes. Do any of these changes produce more dramatic effects of poisoning? Do any changes in initial numbers of rabbits and coyotes diminish apparent effects of poisoning?

Do a similar experiment by changing amounts of energy gained from food by rabbits and coyotes.

By default, rabbits and coyotes have the same chance of 5% of reproducing at each time step. Is this realistic? If not, why not? What happens if you make one population have a greater chance of reproducing than the other?

Compare the effects on population dynamics of the rabbits of changing their energy gain from food and changing grass regrowth time, leaving all other parameters the same.

Sometimes populations of rabbits and coyotes simuated by this model fluctuate in somewhat regular cycles; other times these populations are more stable. Investigate the circumstances associated with these differences.


You can get additional results or make certain changes in the model by right-clicking on any of the objects on the screen (Ctrl+Click with an older Mac). For example, if you do this for one of the bluish-green slider controls, then select Edit, you can change the minimum, maximum, or default values for the variable controlled by that slider, as well as the increment by which the slider changes with one mouse click to the left or right of the current value.

Several options are available if you right-click in the grid representing the habitat where coyotes and rabbits interact. You can copy an image of the grid to the clipboard to paste it into another application or export an image in a PNG graphics format. You can change the position of the grid on your screen by selecting it, then dragging it to a new location. You can change the size of the grid on the screen by dragging one of the edges or corners. You can change the size of the habitat by clicking Edit, then changing MAX-PXCOR and MAX-PYCOR. The default dimensions of the habitat are 50 x 50 = 2500 cells, with cells numbered from 0 to 49 in the horizontal and vertical dimensions. But you can make either or both of these dimensions larger or smaller if you wish. You can also experiment with the effect of removing world wrapping from the model. To see what world wrapping means, reduce the size of the grid to about 10 by 10 cells (change MAX-PXCOR and MAX-PYCOR to 9), change the initial populations to about 20 rabbits and 0 coyotes, and reduce the speed of a simulation using the slider in the gray area at the top of the screen. Finally, you can open a close-up view of a small portion of the grid by positioning the mouse pointer anywhere on the grid and selecting INSPECT PATCH. When you run a simulation after doing this, you will see what happens to the grass, coyotes, and rabbits in and near this patch. To follow what happens in this close-up view, it helps to reduce the speed.

If you right-click in the graph window at the bottom of the screen, you can edit things like the color of the pens used to plot rabbit and coyote populations. You can alos make a copy of the graph to paste into another application or export the results shown in the graph to a comma-delimited (CSV) text file that can be imported into a spreadsheet or statistical program for further analysis.

Another set of potential extensions involves programming changes, which you wouldn't want to do unless you know at least a little about programming in NetLogo. You can view and modify the code for the simulation at the Code tab, then save the new version on your own computer.


Predator, Prey, Poison is modified from Wolf Sheep Predation in the Biology section of Sample Models of the NetLogo Models Library. Both Wolf Sheep Predation and Predator Prey Poison are general models of predation, not specific models of wolves and sheep or coyotes and rabbits. I use coyotes and rabbits to illustrate predation because this is a natural predator-prey interaction that occurs wherever coyotes and rabbits coexist. Wolves may prey on sheep if they have an opportunity, but sheep are domesticated animals that ranchers can protect from wolves in various ways, and I don't wish to have the scientific aspects of predator-prey interactions confounded in your mind with the political, economic, and ethical aspects that are prominent in discussing wolf predation on sheep (not that the latter are unimportant, but it's worth separating them from scientific issues in thinking about predator-prey interactions).

Besides the addition of poisoning and modifications in display of output in Predator, Prey, Poison, I have removed the option from Wolf Sheep Predation of running a model without grass for rabbits to feed on. I have also changed the process by which predators and prey move around the grid. In Predator, Prey, Poison, each rabbit and coyote occurs on a particular cell, but the model doesn't keep track of its position within that cell. At each time step, the animal stays put or moves to one of the 8 adjacent cells, with equal probability for these 9 alternatives.

Rabbits Grass Weeds is another model of interacting populations with different rules.


Jenkins, S. H. 2015. Tools for Critical Thinking in Biology. Oxford University Press, New York.

Weisberg, M., and K. Reisman. 2008. The robust Volterra Principle. Philosophy of Science 75:106–131.

Wilensky, U. & Reisman, K. (2006). Thinking like a Wolf, a Sheep or a Firefly: Learning Biology through Constructing and Testing Computational Theories -- an Embodied Modeling Approach. Cognition & Instruction, 24(2), pp. 171-209.


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

Jenkins, S. H. 2015. Tools for Critical Thinking in Biology. Oxford University Press, New York.


Weisberg, M., and K. Reisman. 2008. The robust Volterra Principle. Philosophy of Science 75:106–131.


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


Copyright 2015 by Stephen H. Jenkins.

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.

(back to the NetLogo User Community Models)