Skip to main content
Version: 1.9.1

Predator Prey

This tutorial presents the structure of a GAMA model as well as the use of a grid topology. In particular, this tutorial shows how to define a basic model, to define "grid agents" which are able to move within the constraints. It also introduces the displays and agents' aspect.

All the files related to this tutorial (images and models) are available in the Models Library (project Tutorials/Predator Prey).


Model Overview

In this model, three types of entities are considered: preys, predators and vegetation cells. Preys eat grass on the vegetation cells and predators eat preys. At each simulation step, grass grows on the vegetation cells. Concerning the predators and preys, at each simulation step, they move (to a neighbor cell), eat, die if they do not have enough energy, and eventually reproduce.

Tutorial models Predator-Prey.

Step List

This tutorial is composed of 13 steps corresponding to 13 models which are incremental representation of the same model, starting with the simplest model 1 and finishing with the latest one, model 13. For each step, we will present its purpose, an explicit formulation and the corresponding GAML code of the model.

  1. Basic model (prey agents)
  2. Dynamic of the vegetation (grid)
  3. Behavior of the prey agent
  4. Use of Inspectors/monitors
  5. Predator agents (parent species)
  6. Breeding of prey and predator agents
  7. Agent display (aspect)
  8. Complex behaviors for the preys and predators
  9. Adding of a stopping condition
  10. Definition of charts
  11. Writing files
  12. Image loading (raster data)
  13. Exploration of the model