Skip to main content

3.2) Declaration Of Variables, Agents And Collectives


The first code part contains the declaration of everything which is in the model.

Here we declare:

what global variables exist
globals []
what variables patches do have (in addition to the built-in)
patches-own []
what variables all agents (turtles) have
turtles-own []
what sort of agent types exist
breed [wolves wolf]
breed [sheeps sheep]
or what collectives they build
breed [packs pack]
and what special variables these have
wolves-own []

Besides the built in variables for time, patches and turtles (i.e. agents) anything we like to use in the model needs to be defined here. (NetLogo allows you to define global variables in the interface with sliders and inputs, but it is essentially the same as defining them in the Code tab. It might be worth mentioning in this section, as a comment, if a global variable is defined in the interface to keep the overview.)