FreeSimulationNo signup

Predator-Prey Simulator

Wolves, sheep, grass. Three populations locked in oscillation — watch ecology run.

Ready
Step 0 / 0
Agents: 0
Group AGroup BEmpty
10/s

Parameters

150
50300
40
10100
0.040
00.1
0.050
00.1

Tweak parameters, then press Reset to apply.

What you just saw

Wolves hunt sheep, sheep graze grass, grass slowly regrows after being eaten. The three populations rise and fall in offset cycles — exactly the Lotka-Volterra oscillation. When sheep are abundant, wolves proliferate; when wolves peak, sheep crash; when sheep are scarce, wolves starve; grass recovers; sheep bounce back. No equations — just individual animals deciding whether to eat, reproduce, or starve.

The science behind it

The predator-prey pattern was first described mathematically by Alfred Lotka (1925) and Vito Volterra (1926) as coupled ODEs. The agent-based version here (wolf-sheep-grass) is one of NetLogo's flagship demonstrations and has become a canonical teaching example. Unlike the ODE version, the spatial agent-based model exhibits extinctions, refugia, and fronts — effects invisible to the well-mixed equations.

Try these experiments

  1. 1. Classic oscillation

    Settings: defaults

    What to look for: Offset sine-like waves in sheep and wolf populations.

  2. 2. Wolf extinction

    Settings: wolf_reproduce_rate=0.02

    What to look for: Wolves die out, sheep explode to carrying capacity limited by grass.

  3. 3. Total collapse

    Settings: wolf_reproduce_rate=0.08 sheep_reproduce_rate=0.02

    What to look for: Wolves over-hunt, sheep crash, wolves starve. Both populations extinct.

Sprint 1 scaffold. Full long-form article, references, and FAQ will land in the content sprints (3–6). The simulation above is already wired to the production worker.
SimLab

Run this at 100x scale

Predator-prey runs in your browser up to 190 animals agents. With SimLab, the same model runs on GPU at 1M+ animals, with ensemble parameter sweeps and publication-ready output.

from scirouter import SciRouter
client = SciRouter(api_key="sk-sci-...")
result = client.simulation.run(
    model="predator_prey",
    params={"grid_size": 500, "initial_sheep": 10_000,
            "initial_wolves": 2_000,
            "sheep_reproduce_rate": 0.04, "wolf_reproduce_rate": 0.05},
    steps=1000, seed=42,
)

Related simulations

Frequently asked questions

Why is there grass?

Without a renewable food source for sheep, the system collapses in one or two cycles. Grass is the bottom of the food chain — a slowly recovering spatial resource, not just infinite background energy.

Is this predictive of real ecology?

It captures the oscillation pattern observed in lynx-hare pelt records from the Hudson's Bay Company (the classic Lotka-Volterra dataset). Real ecosystems add seasonality, disease, habitat patchiness, and human pressure — but the core dynamic is the same.