NetLogo banner

 Contact Us

 Modeling Commons

 User Manuals:


NetLogo Models Library:
HubNet Activities/Unverified

Note: This model is unverified. It has not yet been tested and polished as thoroughly as our other models.

For information about HubNet, click here.

(back to the library)

Predator Prey Game HubNet

[screen shot]

If you download the NetLogo application, this model is included. (You can also run this model in your browser, but we don't recommend it; details here.)


This model simulates a predator-prey relationship. The population consists of wolf packs (predators) and sheep herds (prey), some controlled by students via HubNet clients and some androids controlled by the computer. The wolves gain energy from consuming sheep, and the sheep gain energy from consuming grass (a primary producer). The model allows students to examine simple population dynamics like those modeled through the Lotka-Volterra equations in a participatory way.


Predators and prey move around the world, searching for food. Prey eat plants (green areas), while predators eat prey. All animals gain energy by finding food and expend energy in the search for food. Prey also lose energy when predators catch them. Each predator agent can be thought of as a pack of wolves and each prey can be thought of a herd of sheep. Prey can be caught by predators a few at a time before they ultimately die out. In other words, a prey agent does not die the very first time they run into a predator. The grass is also a limited resource; it regrows at a fixed rate. Android predators and prey can wander around the world at random, while student predators and prey are directed through the HubNet clients.

If an animal's energy gets too low it dies. If a student controls the animal, that student is given the option to "recreate" as a predator or prey. Until the student "recreates" they cannot interact with the rest of the system, i.e. they cannot be eaten, they cannot eat, and they cannot move. By recreating the students have some control over the populations in the world and can dramatically shift the population dynamics. If the energy of an android goes below zero the android merely dies. However, androids do have the ability to reproduce, which student agents do not. Every tick each prey has a PREY-REPRODUCE chance of creating a new prey, and each predator has a PREDATOR-REPRODUCE chance of creating a new predator.


To start the game first press the SETUP button then press the GO button and ask the students to log in. You may also want to create android predators or prey using the ADD-PREDATORS and ADD-PREY buttons. You can control the movement of the androids using the WANDER? switch (which determines whether they move at all) and the ANDROID-DELAY slider (which determines how many seconds elapse between android movements).

The total number of PREDATORS and PREY, including both students and androids are displayed in the corresponding monitors. You can control the amount of energy each animal gains from consuming food by using the PREDATOR-GAIN-FROM-FOOD and the PREY-GAIN-FROM-FOOD sliders. PLANT-REGROWTH-RATE brown areas regrow grass at every tick in the model. Thus modifying this slider controls the amount of grass that is available for the sheep to consume.

If you wish to change all the students to either predators or prey press the MAKE-STUDENTS-PREDATORS or MAKE-STUDENTS-PREY buttons. These buttons do not affect androids.

To start the game over press the SETUP button, this will return all students to initial energy levels and place them at a new random position. It will kill all the androids and clear the plots.

AVERAGE ENERGY plots the average energy of all predators in red, and all prey in green, this includes androids. POPULATION plots the total of each type of animal.

Client Information

After logging in, the client interface will appear for the students, and if GO is pressed in NetLogo they will be assigned a role as predator or prey at random. Their character will consist of an animal indicator, a wolf if they are a predator or a sheep if they are prey, and an icon. The icon is their unique identifier so it's easy to distinguish themselves from other animals. A description of the icon will appear in the YOU ARE A: monitor. If the student does not like the shape and/or color of their icon they can hit the CHANGE APPEARANCE button at any time to change to another random icon.

The student controls the movement of their turtle with the UP, DOWN, LEFT, and RIGHT buttons (they can also use the hot-keys as short cuts) and the STEP-SIZE slider. Clicking any of the directional buttons (or using the hot-keys) will cause their turtle to move in the respective direction a distance of STEP-SIZE.

ENERGY for the appropriate animal is displayed in the monitor of same name. If the energy is zero or less, then the agent dies. The ROLE monitor will display "dead", the animal indicator shape will appear as a sad face, and the STATUS monitor will indicate that the student should recreate as a predator or prey. After s/he selects one s/he cannot switch roles until the animal dies again.


Predators may find it better to stay together. Prey, however, may learn to stay more scattered, so as to not become easy prey to a large group of predators.

At first students may find it advantageous to be predators but if many students become predators, the balance will shift and it may be more advantageous to "recreate" as a prey.


Try changing the amount of energy gained from food for both predators and prey, at what point does it cease to be advantageous to be a predator?

Try to balance out the system so that no predators or prey go hungry.

Change the PLANT-REGROWTH-RATE slider. How does this affect the balance between the predators and prey?


Try making the androids move toward food rather than moving randomly.

There is no cost for changing the step-size for a student agent. Is there a way a larger step-size could "cost" the agent something?


Because so much information must be conveyed through the appearance of each turtle, each player is actually made up of two turtles; one turtle's shape is either a wolf or a sheep to indicate whether it is a predator or prey. Behind the first turtle is an icon turtle that helps students distinguish themselves from other players (and androids). Thus though each student is viewed as one agent, they are actually made up of two turtles.


The various Wolf-Sheep models are non-HubNet versions of a similar model. Also see the Bug Hunter model and the Guppy model for other HubNet models that explore population dynamics.


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 2002 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 activity and associated models and materials were created 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.

(back to the NetLogo Models Library)