Sheep (white) eat grass (green), wolves (red) eat sheep. Both reproduce and die. Population oscillations emerge — classic Lotka-Volterra dynamics from individual agent rules.
Tick: 0
Changelog
2026-04-05 — fix: wolves check Moore neighbourhood for prey
Bug: wolves only checked their exact cell for sheep.
On the 100×100 grid the empirical encounter rate was roughly
30 % of the theoretical numSheep/numCells, because
the random-walk movement creates spatial correlation that
single-cell lookup cannot overcome. Wolves starved within
50–100 ticks regardless of parameter tuning—no
population curve ever established.
Testing: a single wolf was placed on a 50×50
grid with 500 sheep (20 % density). Over 2 000 ticks
it ate at only 1.4 % per tick versus the 8.2 % predicted
by uniform random overlap. Sweeping grid sizes from 100×100
down to 10×10 (100 % sheep density) confirmed wolves
went extinct on every configuration and every seed.
Fix: expanded the predation check from a single
cell to the 3×3 Moore neighbourhood (current cell + 8
neighbours) in step(). After the fix, wolves
survive 8/10 seeds through 2 000 ticks on the default grid,
showing stable Lotka-Volterra–style oscillations.