Evolutionary Simulation

This simulation demonstrates evolutionary programming using Three.js. A population of simple virtual creatures (the cubes) tries to move forward toward a finish line. They start with random movement patterns, but over time they evolve more effective strategies through natural selection, crossover, and mutation.

How it works

  • Genome:Each cube is controlled by a "genome" – a list of tiny movement impulses applied frame by frame.
  • Fitness:At the end of a generation, a cube's fitness is measured by how far it moved toward the finish line (along +Z).
  • Selection:The best-performing cubes are kept. Others are discarded.
  • Crossover + Mutation:New cubes are born by mixing the genomes of survivors and adding small random changes.
  • Evolution:Over many generations, movement patterns improve. Random walkers become purposeful runners.

What to look for

  • Yellow finish line: The goal every cube is trying to reach.
  • Trails: Show the path each cube has taken during its lifetime.
  • Gold cube: The current generation’s best performer.
  • Overlay stats: Track the generation number, best fitness, and average fitness.
  • Use the Time Scale slider (top right) to speed up or slow down evolution.
Generation: 1
Best Fitness: 0.00
Avg Fitness: 0.00
Built with React, Three.js, and evolutionary algorithms 🌱