← Genetics

🌱 Natural Selection

Gen 0 Pop 0 🇺🇦 UK

Statistics

Population
Generation
Total born
Total died
Trait distributions
Speed
Sense radius
Camouflage
Trait trends
Speed
Sense
Camo%
Sim Speed
Mutation 10%
Food rate 8/s
Predators 1
Env. hue 120°

About this simulation

This agent-based model shows natural selection acting on a population of foraging creatures, each carrying three heritable traits: movement speed, sense radius and body hue. Creatures gather food to gain energy, reproduce once they cross an energy threshold, and pass slightly mutated traits to their offspring. A predator hunts the most visible (least camouflaged) individuals. Over many generations the population's average traits drift toward whatever combination survives best in the current environment — an evolutionarily stable strategy.

🔬 What it shows

Each creature has a speed (0.4 to 2.8), a sense radius (25 to 130 px) for detecting nearby food, and a hue (0 to 360 degrees). Faster movement costs more energy per tick, so speed trades off against efficiency. Camouflage is scored by how close a creature's hue is to the environment hue, and predators detect well-camouflaged creatures from a shorter range. Survivors reproduce with mutation, so the trait distributions evolve generation after generation.

🎮 How to use

Use Pause/Reset and the Sim Speed selector (1x to 6x) to control playback. The sliders set mutation rate (1 to 40 percent), food spawn rate (2 to 30 per second), predator count (0 to 4) and the environment hue (0 to 360 degrees) that defines ideal camouflage. Hover any creature to see its traits and sense radius; watch the side panel's histograms and trend lines track average speed, sense and camouflage.

💡 Did you know?

Camouflage here is frequency-independent: if you shift the environment hue, the population that was once well hidden becomes conspicuous and is heavily preyed upon, then selection pushes hues back toward the new background over several generations — a fast, visible analogue of the peppered-moth story.

Frequently asked questions

What is natural selection in this simulation?

Natural selection is the process by which creatures with traits better suited to their surroundings survive and reproduce more often, gradually shifting the population's make-up. Here it emerges from simple rules: creatures spend energy to move and forage, only those that gather enough energy reproduce, and offspring inherit slightly mutated copies of their parent's speed, sense radius and hue.

How does reproduction and inheritance work here?

A creature reproduces when its energy reaches a threshold (about 85), spawning one offspring nearby and resetting to a baseline energy. The offspring inherits the parent's traits, but each trait may mutate with the probability set by the mutation slider. Speed and sense values nudge by up to a quarter of their range, while hue can shift by up to roughly 60 degrees.

What do the predator and environment hue controls do?

The predator slider adds 0 to 4 hunters that chase the most visible creatures; a creature whose hue is far from the environment hue is spotted from farther away and is more likely to be caught. The environment hue slider sets the background colour, which defines what counts as good camouflage. Move it and you change which colours are safe, forcing the population to adapt.

Is this a biologically accurate model?

It is a simplified teaching model rather than a literal one. It captures the core logic of selection, heritable variation and mutation, plus realistic trade-offs (faster creatures burn more energy, brighter creatures are easier prey). It omits sexual reproduction, recombination, diploid genetics, ageing and spatial habitats, so treat it as an intuition-builder, not a quantitative prediction.

Why do average traits settle rather than keep changing?

Once the population reaches traits that balance foraging success, energy cost and predation risk, any large deviation is selected against, so the averages hover around a stable point — an evolutionarily stable strategy. They only resume drifting when you change the conditions, such as the food rate, predator count or environment hue, which moves the optimum.