National Center for Caribbean Coral Reef Research
University of Miami - Rosenstiel School of Marine and Atmospheric Science
4600 Rickenbacker Causeway, Miami, FL 33149





This module is a simple simulation of the predator-prey dynamics based on "Sharks and fish wage an ecological war on the toroidal planet Wa-Tor" (A.K. Dewdney, 1984). This prototype simulates the distribution and abundance of the predator and prey through time as they interact with each other in a hypothetical 2D space.

Prototype Agents:

  • Fish-Prey Agents (FA): These are the prey of the shark. They randomly move around in the hypothetical toroidal world.

  • Shark-Predator Agents (SA): These are the sharks that preys on the FAs. They also move randomly around the same hypothetical toroidal world and preys on FAs as they by chance occupy the same space in one period.


In this prototype, both FA and SA have their own level of mortality. This mortality is implemented as a proportion of the FA or SA that dies at each time step.

The FA are assumed to have an infinite supply of food. They have the capability of reproducing another one of their kind upon reaching a user-defined reproductive age. However, reproduction is on condition that space is available.

Unlike FA, SA have to passively "hunt" for prey to survive. A starvation index is implemented that increases for each time step that SA are not able to prey. The inverse is also true. SA will die if they reach a threshold level identified by the value of the starvation index. Their reproduction is similar to FA. However, in addition to reproducing only when they have reached their own reproductive age, they can only do so if their starvation index is less than a set value.

GUI and Results:

The graphical Torus 2D space presents the locations of the FA and SA. FA are displayed as green circles and the SA are red circles (Fig. 1).



Fig. 1. Spatial distribution of agents (sharks are in red and fish preys in green dots; plot for every 10 ticks).

Another chart presents the population of both populations  (Fig. 2) and another, presents the age distribution of the preys.

Fig. 2. 2D plot of the fish and shark population in time (plot for every 10 ticks).

  • Click here to download the classes and to run it with RePast and simulate using other parameters;

  • Click here to view the Java documentation of the classes; or

  • Click here to download the compressed API document.