← 🧬 Biology

🐠 Prey-Predator

Prey 🐟 0
Predators 🦈0
Generation 0
Status Running
Prey (wander)
Predator (hunts)
Newborn prey
Adjust birth/death rates · Chart at bottom shows population history

About the Prey-Predator (Lotka-Volterra) Simulation

This simulation models the classic predator-prey relationship as an agent-based system rather than as smooth equations. Hundreds of individual prey and predator particles wander a 2D arena, interacting through purely local spatial rules: predators detect prey within a vision range, chase the nearest one, and consume it on contact. From these microscopic encounters, the macroscopic, phase-shifted population oscillations described by the Lotka-Volterra model emerge spontaneously, with a live chart tracking both populations over time.

The sliders set the prey birth rate alpha (per prey, per frame), the predator energy drain gamma per frame, the eat radius in pixels, the energy gained per kill, and an overall speed multiplier. You can also choose the starting prey and predator counts. The system underpins real ecology, fisheries management and resource economics, illustrating why over-harvesting a prey species or removing predators can drive a coupled population to boom, crash or extinction.

Frequently Asked Questions

What is the Lotka-Volterra predator-prey model?

It is a pair of coupled equations describing how two interacting populations change over time: prey grow when undisturbed and decline when eaten, while predators grow when prey is plentiful and decline when it is scarce. The result is repeating, out-of-phase oscillations where predator peaks lag behind prey peaks.

How does this simulation produce those oscillations?

Instead of solving equations directly, it runs hundreds of individual particles with simple local rules. Predators seek and eat nearby prey to gain energy, lose energy each frame, and starve when prey runs out. Prey reproduce stochastically. These individual behaviours collectively reproduce the classic cyclic population dynamics.

What do the alpha and gamma sliders control?

Alpha is the prey birth rate: each frame, every prey has that probability of spawning an offspring nearby, so higher alpha means faster prey growth. Gamma is the predator energy drain per frame; a larger gamma makes predators starve more quickly between meals, shifting the balance toward the prey.

What do the other controls do?

Eat radius is the pixel distance within which a predator can consume a prey on contact. Energy gain per eat is how much energy a successful kill adds, fuelling reproduction once a predator exceeds its energy threshold. The speed multiplier scales how fast all particles move, and the initial sliders set the starting prey and predator counts.

Why do predator peaks come after prey peaks?

Predators can only multiply once there is abundant prey to eat, so their rise lags the prey boom. As predators become numerous they over-consume the prey, the prey crash, and predators then starve. With prey pressure relieved, prey recover and the cycle repeats with a characteristic phase shift.

Is the simulation physically and biologically accurate?

It is a qualitative teaching model rather than a precise ecological forecast. It faithfully captures the emergent cyclic behaviour and phase shift of real predator-prey systems, but it ignores factors like age structure, habitat heterogeneity, disease and carrying-capacity details. A prey cap of 600 prevents unbounded growth.

Why does one population sometimes go extinct?

Because this is a finite, stochastic, particle-based system, random fluctuations can push a population to zero, after which it cannot recover. If prey vanish, predators soon starve; if predators vanish, prey grow toward their cap. The idealised continuous equations never reach zero, but discrete agents can, which is more realistic.

How do predators find and catch prey?

Each predator scans for prey within a fixed vision range using a spatial grid for fast neighbour lookup, then steers toward the nearest one. If a prey falls inside the eat radius, the predator consumes it, gaining energy. When a predator's energy passes its reproduction threshold it splits, passing half its energy to the offspring.

What is the population chart at the bottom showing?

The chart plots recent population history, sampled every ten frames, with the green line for prey and the red line for predators. Watching the two lines rise and fall in alternation is the clearest way to see the Lotka-Volterra cycle emerge from the underlying particle interactions.

Where are predator-prey models used in the real world?

They inform fisheries and wildlife management, pest and biological-control strategies, and conservation planning, and analogous equations appear in epidemiology and economics. They help explain why removing a predator or over-harvesting a prey species can destabilise an ecosystem and trigger boom-bust cycles or collapse.

🦊 Prey-Predator — Lotka-Volterra Particles

Hundreds of prey and predator particles interact through spatial rules, producing the classic Lotka-Volterra population oscillations. Watch predator booms follow prey booms in a never-ending cycle.

🔬 What It Demonstrates

Prey reproduce when well-fed, predators hunt nearby prey. When prey is scarce, predators starve. This creates the characteristic phase-shifted oscillation seen in real ecosystems.

🎮 How to Use

Adjust reproduction and hunting rates. Watch the population chart oscillate. Classic Lotka-Volterra dynamics emerge from individual particle interactions.

💡 Did You Know?

The Lotka-Volterra equations were independently derived by Alfred Lotka (1910, for chemical reactions) and Vito Volterra (1926, to explain fish populations in the Adriatic Sea).