Evolutionary Steering
Watch "Survival of the Fittest" in real-time. Agents evolve DNA to better distinguish between food and poison.
How Natural Selection Works
How Natural Selection Works
This simulation implements an agent-based model of Darwinian evolution. Agents (organisms) move through an environment containing food (green) and poison (red). Each agent has a neural-network-style genome encoding how it weights different types of food in its field of view. Agents that eat more food survive longer, reproduce, and pass on their genome — sometimes with random mutations.
Over successive generations, the population becomes adapted to its environment. You can observe the emergence of feeding strategies, avoidance behaviours, and even competitive dynamics — all from simple fitness rules and variation.
Genetics and Inheritance
Each agent carries a genome — a set of numerical parameters controlling its behaviour when it senses nearby food or poison. When an agent reproduces, its offspring inherits its genome with a small random mutation: a slight tweak to one or more parameters.
Key genetic concepts illustrated:
- Variation — mutations create diversity within the population
- Heritability — offspring resemble parents
- Selection pressure — environmental conditions favour certain traits
- Fitness landscape — not every mutation is beneficial
Evolution in Practice
Real-world applications of evolutionary computation include:
- Genetic algorithms — optimising engineering designs, scheduling, and routing
- Neural architecture search — evolving the structure of AI models
- Drug discovery — evolving molecules with desired pharmaceutical properties
- Robot locomotion — evolving walking gaits for physical robots
- Game AI — evolving strategies for complex board games
The field of evolutionary computation (EC) spans genetic algorithms, genetic programming, and evolution strategies — all inspired directly by the biological processes modelled here.
Experiments to Try
- Increase poison density — watch how quickly agents evolve avoidance strategies
- Crank up the mutation rate — observe rapid environmental adaptation vs. genetic instability
- Reduce food — create strong selection pressure and watch population fitness jump
- Watch the fittest agents — identify the behavioural patterns that emerge over time
- Reset and compare — run multiple experiments to see how evolution converges differently each time
Key Equations & Concepts
| Concept | Formula / Rule | Notes |
|---|---|---|
| Hardy–Weinberg equilibrium | p² + 2pq + q² = 1 | Allele frequencies stable without selection; baseline for measuring evolution |
| Fitness function | w = e−ΔH | Agents with higher health survive longer to reproduce |
| Mutation probability | Pmut = μ per gene per generation | μ = mutation rate; controls diversity vs. stability trade-off |
| Population genetics | Δp = p ⋅ (wA − ¯w) / ¯w | Change in allele frequency per generation (selection equation) |
| Natural selection strength | s = 1 − wless fit | Selection coefficient; s = 0 = neutral; s = 1 = lethal |
| Effective population size | Ne = 4NmNf / (Nm + Nf) | Determines rate of genetic drift; small Ne → faster drift |
Curriculum Links
| Level | Topics |
|---|---|
| GCSE Biology | Natural selection, variation, inheritance, mutation, adaptation |
| A-Level Biology | Population genetics, Hardy–Weinberg, selection pressure, speciation |
| A-Level Computing | Neural networks, genetic algorithms, agent-based modelling |
| University (Biology) | Evolutionary biology, quantitative genetics, fitness landscapes |
| University (Computer Science) | Evolutionary computation, genetic algorithms, swarm intelligence |
| Postgraduate | Computational evolution, eco-evolutionary dynamics, digital life |
Share this simulation
Send this page to students or colleagues.
Related simulations
Continue with similar experiments.
📖 Recommended Reading
Deepen your understanding with our in-depth article.