Example models
These are the example models that come with Stigmery: classic starting points for learning agent-based modelling. Open one in the editor to run it and read its rules. Fork it to start a model of your own.
-
Ant Foraging
Ant foraging is the classic demonstration of stigmergy. Pierre-Paul Grassé named this mechanism in 1959 to explain how termites and ants work together without anyone in charge. Each agent leaves a trace in the environment, and the next agent reacts to that trace. From these simple local interactions, clever group behaviour emerges. Real ant colonies use it to find the shortest path to food.
-
Wolves and Sheep
Wolves and Sheep is the classic agent-based predator-prey model. It comes from the Lotka-Volterra equations, which Alfred Lotka (1925) and Vito Volterra (1926) published independently. Volterra used them to explain the rising and falling fish populations in the Adriatic. Sheep wander and eat grass, wolves wander and eat sheep, and you watch the populations cycle, settle or crash.
-
Schelling Segregation
Economist Thomas Schelling proposed this model in 1971, and it was central to his 2005 Nobel Prize in Economics. It shows how mild individual preferences for same-colour neighbours still produce sharp residential segregation. Each occupied patch counts its non-empty neighbours. When too few share its colour, its occupant moves to a random empty patch.
-
Game of Life
John Conway's Game of Life is the most famous cellular automaton in history. Each patch is a cell that is alive or dead. An alive cell with 2 or 3 alive neighbours survives. A dead cell with exactly 3 alive neighbours comes to life. Every other cell dies or stays dead. From these rules emerge oscillators, gliders and even Turing-complete computation.
-
Forest Fire
The Forest Fire model is a textbook example of percolation theory. That theory studies how connected clusters form on a random lattice. A spark is lit in the top-left corner and spreads only to adjacent trees. Whether it engulfs the forest depends sharply on the initial tree density.
-
Flocking
Craig Reynolds published the Boids model in 1987 (Flocks, Herds, and Schools: A Distributed Behavioral Model). It shows that birds, fish and insects swarm without a leader or a shared plan. Each agent (a 'boid') applies three simple local rules to its neighbours:
-
Virus on a Network
This is the classic agent-based SIR (susceptible / infected / resistant) epidemic. It plays out on a graph of individuals rather than a continuous medium. Each node has a few links to other nodes, and the virus can only travel between linked nodes. The model is the network version of the Kermack-McKendrick SIR equations (1927). It is a standard teaching example of how network structure shapes an epidemic.
-
Termites
Mitchel Resnick made the Termites model popular in Turtles, Termites, and Traffic Jams (1994). Beside the Ant Foraging model, it is his classic illustration of stigmergy. A field is sprinkled with wood chips, and termites wander around. Each termite follows a laughably simple rule:
-
Gray-Scott
The Gray-Scott model is a continuous reaction-diffusion system. It produces some of the most striking patterns in computational science. You get self-replicating spots, mazes, branching coral and moving solitons. Some stripes look uncannily biological. Two chemicals, U and V, diffuse across the grid and react locally. From those two ingredients you get a huge zoo of stable and unstable patterns. John Pearson…
-
Cyclic Cellular Automaton
A cyclic cellular automaton (David Griffeath, 1980s) is one of the simplest rules that turns noise into spirals by itself. Each patch is a cell that holds a state from 0 to N-1, arranged in a colour wheel. A cell in state s looks at its eight neighbours. If at least threshold of them are in the next state s+1, the cell advances to s+1. The states wrap around, so after N-1 comes 0. Otherwise the cell waits. That is…