2.2. Example: Biology
2.2.1 Vibe Coding simulations in the biology classroom
Predator–Prey Dynamics (Lotka–Volterra model)
Subject: Biology · Grade: 9 (age 14–15) · Duration: 1 double lesson (90 min)
Learning objectives
By the end of the lesson, students can:
- describe the key variables (prey population, predator population) and parameters (growth rate, predation rate, conversion efficiency, mortality rate) of the Lotka–Volterra model;
- form and test hypotheses about population dynamics using an interactive simulation;
- extend an existing simulation with additional layers of ecological complexity (e.g. a carrying capacity, a second species, a seasonal factor) by writing structured prompts for an AI language model;
- critically evaluate the model’s assumptions and limitations (Nature of Science), including why introducing randomness or an additional factor can destabilise it.
Take-home message: Students don't need to code from scratch. Reading and testing an existing simulation, then using an LLM to add one layer of ecological realism at a time, is enough to build genuine understanding of a dynamic biological model — and, sooner or later, to discover for themselves exactly where that model reaches its limits.
Content
Mathematical models and computer simulations are especially valuable tools in ecology, because they can express highly complex relationships between organisms and their environment through comparatively simple mathematical equations (often systems of differential equations). This makes it possible to run experiments in silico and test hypotheses on the model in situations where a real experiment would be too costly, too slow, ethically difficult, or outright dangerous — manipulating a real predator population, for instance, is rarely an option. At the same time, every model is necessarily a simplification of reality, and this is exactly where its weaknesses lie: real ecosystems are far more complex than any model can fully capture.
The Lotka–Volterra model (Lotka, 1925; Volterra, 1926) is a classic example of such a simplification, applied to predator–prey dynamics — the cyclical, phase-shifted fluctuations typical of many real predator and prey populations (classic example: lynx and snowshoe hare). It describes the system with two variables — prey population and predator population — and four parameters: prey growth rate, predation rate, conversion efficiency, and predator mortality rate. The oscillation results from a feedback loop: more prey → more food for predators → predator population grows → more predation → prey declines → less food for predators → predator population declines → prey recovers, and the cycle repeats.
To produce this clean cycle, the model makes several strong assumptions: it is deterministic (the same starting values always produce exactly the same curve); it is a closed two-species system that excludes every abiotic factor (temperature, precipitation, season) and every other biotic factor (food plants for the prey, a third species, disease); and it makes each population's growth depend on nothing except the size of the other population.
Real populations rarely meet these assumptions. Births, deaths and encounters are subject to chance, and a stochastic (randomised) version of the same model tends to drift away from the clean cycle and can even collapse (e.g. the predator population dying out) in cases where the deterministic version predicts stable oscillation. Likewise, adding just a single missing factor — a temperature-dependent growth rate, or a limit on the prey's own food supply — is often enough to break the clean two-variable cycle. This is not a flaw to hide from students: it is the central Nature-of-Science lesson of the activity. A model can be genuinely useful (it explains why lynx and hare numbers rise and fall in step) while still being a deliberately narrow approximation of reality — and using it well means knowing exactly which factors it leaves out. In this lesson's main activity, students discover this for themselves by trying to add exactly these kinds of factors.
Lesson plan
| Phase | Time | Activity |
| Warm-up | 8 min | The teachers shows an unlabelled graph of a real predator–prey data series (e.g. lynx/hare); students describe the pattern and form first hypotheses. |
| Input | 12 min | The teacher introduces the model’s variables and parameters using a simple diagram (no differential equations needed). |
| Explore | 15 min | Students test their hypotheses in pairs on a ready-made HTML simulation and record their observations. |
| Layer in complexity | 35 min | In pairs, students work through 2–3 rounds of predict → prompt → test → diagnose (guiding questions below), each time asking the LLM to add one more layer of ecological realism to the simulation (a limit on the prey's food supply, a second species, a seasonal/abiotic factor) until the clean two-variable cycle visibly breaks down. |
| Reflect: what the model can and cannot show | 20 min | Whole-class discussion, guided by questions such as: At which round did the simulation stop producing a clean, repeating cycle? What does the original model deliberately leave out, and why? What makes it a useful simplification rather than simply a wrong one? |
Guiding questions: layering complexity
Pairs work through as many of the following rounds as time allows in the 35 minutes (most manage two; the third is an extension for early finishers). Each round follows the same four-step cycle:
- Round 1 — limit the prey's food supply (a carrying capacity):
- Predict: Before you prompt anything — what do you expect to happen to the cycle if the prey's growth slows down once the population gets large, instead of growing without limit? Sketch the curve you expect.
- Prompt: Ask the AI to add a maximum sustainable prey population to the simulation, and to explain in its own words how it changed the growth equation to do this.
- Test & compare: Run the new simulation with the same starting values as before. Did the amplitude of the oscillation shrink? Did the population settle at a steady level instead of cycling?
- Diagnose: Which assumption of the original model (unlimited food for the prey) did you just remove? Is this factor biotic or abiotic?
- Round 2 — add a second living factor:
- Predict: If a third species now competes with the prey for food, or preys on it as well, what do you expect this to do to the original two-species cycle?
- Prompt: Choose one option (a competitor, a disease, or a second predator) and write a prompt asking the AI to add it as a new variable linked to the existing ones — specify exactly how it should interact with the prey or predator population.
- Test & compare: Observe the simulation over several cycles. Does the original two-species rhythm survive, get distorted, or disappear?
- Diagnose: The original model assumed each population depends only on the other. Is that still true after this round? What real ecological relationship does your new factor represent?
- Round 3 — add a factor from outside the ecosystem:
- Predict: If prey growth now depends on temperature or the season (e.g. faster growth in “summer” months), how might the cycle change over a longer simulated time span?
- Prompt: Ask the AI to make one growth or mortality parameter vary over time (e.g. following a seasonal pattern) instead of staying constant.
- Test & compare: Run the simulation for a longer period. Does the cycle stay regular, drift, or become chaotic?
- Diagnose: This factor is abiotic. Which of the model's original “closed system” assumptions does it break?
- Optional round 4 — introduce randomness:
- Predict: If one parameter (e.g. the predation rate) is no longer fixed but drawn randomly within a range at each time step, what do you expect for the long-term stability of the populations?
- Prompt: Ask the AI to replace one constant parameter with a randomised value and to keep track of whether either population reaches zero.
- Test & compare: Run the simulation several times with the same settings. Do you get the same result every time? Does either population ever collapse?
- Diagnose: Why can the same “average” parameter values sometimes lead to extinction here, when the deterministic model never predicted that?
Closing question (for the Reflect phase): At which round did the simulation stop producing a clean, repeating cycle — and what does that tell you about how many real-world factors the original Lotka–Volterra model has to leave out in order to stay solvable and easy to interpret?
Materials
- One laptop per student pair, with a browser
- Access to an LLM chat interface via the internet, or a locally installed model if internet access is restricted at school
- Ready-made HTML predator–prey simulation (single file, sliders for selected parameters)
- A short prompting / worksheet template for the “layering complexity” rounds (predict → prompt → test → diagnose)
- Guiding questions for the exploration phase and the Nature-of-Science reflection (model purpose vs. model limits)