The Lab · Genetic algorithms, 1975

Evolving Bikes

Every bike is a list of 18 numbers: the shape of its frame, where its two wheels go and how big they are, and where the rider sits. The first bikes are random junk. The ones that ride furthest become the parents of the next.

How it evolves

Each generation races together over the same track, which starts flat and grows hillier the further you go. A bike is out when it stops making progress, or when the rider's head hits the ground. Its fitness is simply how far it got. Then the next generation is bred:

Watch the chart: the best distance (orange) climbs in steps, and the average (teal) follows it up as the whole population gets better. Tick Race without drawing to run dozens of generations in seconds. Try a mutation rate of zero and watch evolution stall, or a huge one and watch it forget what it learned.

Where it came from

John Holland set out the genetic algorithm in his 1975 book Adaptation in Natural and Artificial Systems: solve a problem the way nature does, with a population, survival of the fittest, mixing and mutation. In 1994 Karl Sims stunned the computer graphics world with Evolved Virtual Creatures, swimming, walking and jumping creatures that nobody designed. This toy is in the spirit of Ryan Weber's BoxCar2D, which evolved little cars over rough ground in a web browser, and taught a generation what a genetic algorithm looks like.

Links