Lesson 1

Introduction. Patches and turtles. Observer command.

Creating turtles (first project.nlogo Download). Turtles have coordinates, shape, color, heading, pen up or down. They respond to commends like right and forward. Using buttons. Using sliders to set up global variables.

Patches. They have coordinates (immutable), color, labels. A patch can communicate to other patches (or turtles). Example: the game of life. Patches can stay in two states, living?=true or false. A living cell remains living if surrounded by two or three living cells (among the 8 neighbours), and a dead cell becomes alive if surrounded by three living neighbours. The program makes use of the pre-set agenset "neighbours" (8 nearest neighbours), and reduces it using the operator "with" : agenset with [reporter] => set of agents from agenset for which reporter = true. The operator "count" is used to determine the size of the resulting agenset (see life.nlogo Download). By plotting the number of living cells in a log-log scale (for large worlds) one sees that it follows a power law for a log time, meaning that the game of life is near at a critical state, without having to tune any variable. Models that stay in a critical state without tuning parameters are said "self-critical".

A famous self-critical model is that by Bak-Tang-Wiesenfeld for modelling earthquakes (BTW.nlogo Download). In this model eat patch has a variable (stress) which can take values 0,1,2,3 (stable) or larger (unstable). If unstable, they pass one unit of stress to the 4 nearest neighbors. This can trigger an avalance (that relaxes at boundaries). If all sites are below threshold, the stress of a random cell is increased.