Example models

These are the built-in example models that ship with Stigmery - classic starting points for learning agent-based modelling. Open any one in the editor to run it, inspect the rules, and fork it as the seed of your own model.

  • Ant Foraging

    Ant foraging is the canonical demonstration of stigmergy - the mechanism Pierre-Paul Grassé identified in 1959 to explain how termites and ants coordinate without any central direction. The principle: each agent leaves a trace in the environment, and the next agent reacts to that trace. Out of those simple local interactions, surprisingly clever collective behaviour emerges, including the well-known…

    Read more & run it →

  • Wolves and Sheep

    Wolves and Sheep is the canonical agent-based predator-prey model, descended from the Lotka-Volterra equations published independently by Alfred Lotka (1925) and Vito Volterra (1926) to explain oscillating fish populations in the Adriatic. Sheep wander and eat grass, wolves wander and eat sheep, and you watch the populations cycle, stabilise, or crash.

    Read more & run it →

  • Schelling Segregation

    Schelling Segregation, proposed by economist Thomas Schelling in 1971 (and central to his 2005 Nobel Prize in Economics), 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 relocates to a random empty patch.

    Read more & run it →

  • Game of Life

    John Conway's Game of Life is the most famous cellular automaton in history. Each cell is alive or dead; alive cells with 2 or 3 alive neighbours survive, dead cells with exactly 3 alive neighbours come to life, anything else dies or stays dead. From those four rules emerge oscillators, gliders, and even Turing-complete computation.

    Read more & run it →

  • Forest Fire

    The Forest Fire model is a textbook example of percolation theory: the study of 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.

    Read more & run it →

  • Flocking

    Craig Reynolds published the Boids model in 1987 (Flocks, Herds, and Schools: A Distributed Behavioral Model) to show that the swarming of birds, fish, and insects needs no leader and no shared plan. Each agent (a 'boid') applies three simple local rules to its neighbours:

    Read more & run it →

  • Virus on a Network

    This is the canonical agent-based SIR (susceptible / infected / resistant) epidemic, played out on a graph of individuals rather than a continuous medium. Each node has a small number of links to other nodes, and a virus can only travel between linked nodes. The model is the network counterpart to the Kermack-McKendrick compartmental SIR equations (1927), and is a standard teaching example for the role of network…

    Read more & run it →

  • Termites

    The Termites model, popularised by Mitchel Resnick in Turtles, Termites, and Traffic Jams (1994), is Resnick's classic illustration of stigmergy alongside the Ant Foraging model. A field is sprinkled with wood chips, and termites wander around. The rule each termite follows is laughably simple:

    Read more & run it →

  • Gray-Scott

    The Gray-Scott model is a continuous reaction-diffusion system that produces some of the most striking patterns in all of computational science: self-replicating spots, mazes, branching coral, moving solitons, and stripes that look uncannily biological. The two chemicals U and V diffuse across the grid and react locally, and from those two ingredients you get an enormous zoo of stable and unstable spatial patterns -…

    Read more & run it →

  • Cyclic Cellular Automaton

    A cyclic cellular automaton (David Griffeath, 1980s) is one of the simplest rules that spontaneously organises noise into spirals. Every cell 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 (wrapping around from N-1 back to 0), the cell advances to s+1. Otherwise it waits. That is the entire rule.

    Read more & run it →