Genetic Brick Cars

A genetic algorithm evolves piles of real LEGO® parts into cars that roll down a ramp.

Generation
0
Cars alive
20
Distance
0 m
Speed
0 km/h
Following the leader Drag to orbit · scroll to zoom · click a car to follow it
Loading 3D engine…

Progress

  • Top score
  • Top half average
  • Generation average

Top scores

    Ramp profile

    What is Genetic Brick Cars?

    A genetic algorithm builds cars out of LEGO parts, lets them roll down a ramp, and breeds the ones that get furthest. It is a version of HTML5 Genetic Cars and its 3D sequel built from LEGO bricks, itself loosely based on BoxCar2D. Part models from the LDraw parts library (CC BY 4.0), physics by Rapier, rendering by three.js, seedrandom.js written by David Bau. (thanks!)

    How the cars are built

    The ramp

    Controls

    The translucent car is the best run so far, replayed alongside the current generation.

    Save Population Saves current population locally.
    Restore Saved Population Restore a previously saved population.
    Surprise! Toggles drawing, makes the simulation much faster.
    New Population Keeps the generated ramp and restarts the whole car population.
    Fast Forward Instantly finishes the current generation.
    Create new world with seed The same seed always creates the same ramp, so you can agree on a seed with your friends and compete. :)
    Mutation rate The chance that each gene in each individual will mutate to a random value when a new generation is born.
    Mutation size The range each gene can mutate into. Lower numbers mean the gene will have values closer to the original.
    Elite clones The top n cars that will be copied over to the next generation.
    View top replay Pause the current simulation and show the top performing car. Click a second time to resume simulation.
    Camera Drag to orbit, scroll to zoom, and use the view buttons for preset angles. Click a car (or its bar in the car list, or its marker on the ramp profile) to follow it. The parts list shows the car you follow.

    The genome

    20 part slots, each with 10 genes:

    LEGO® is a trademark of the LEGO Group, which does not sponsor, authorize or endorse this project.