This simple simulation shows how complex behaviour can arise from a very simple set of initial rules. In this case, the sim models the predator-prey relationship and demonstrates the mutually inter-related population dynamics modelled by the Lotka-Volterra equations.
The sim in action:
Each site has three states: wolf, sheep or empty.
- Pick a site (only stochastic updates allowed), and a neighbour.
- If a wolf is adjacent to a sheep, the sheep gets eaten (becomes wolf with probability r). Otherwise the wolf dies with probability p.
- If a sheep is adjacent to empty ground, it reproduces with probability q.
- If empty ground is adjacent to anything, the thing moves into empty ground.
Other assumptions - there is an unlimited supply of grass for the sheep to eat, sheep only die from wolves, and wolves only eat sheep.
The sim is run for 5000 ticks, or until one species goes extinct, whichever comes first. A plot showing populations for the two species is then displayed:
The complex mututal relationship between predator and prey numbers is clearly shown here, with every great population boom for one side or the other followed by an equal crash.
I also wrote a version where the sheep were also constrained by limited food. In this version, grass was not infinite, but disppeared when eaten, and only regrew over time. This forced the sheep to constantly migrate in search of food. However, this variant resulted in a sharply-reduced sheep population (as you would expect) and a wolf population that was so low the sim usually ended fairly quickly.