Generation | |
Cars alive | |
Distance | |
Height | |
Mutation rate: | |
Mutation size: | |
Floor: | |
Gravity: | |
Elite clones: |
The program uses a simple genetic algorithm to evolve random two-wheeled shapes into cars over generations. Loosely
based on BoxCar2D, but
written from scratch, only using the same physics engine (box2d).
seedrandom.js written by David Bau. (thanks!)
Save Population | Saves current population locally. |
---|---|
Restore Saved Population | Restore a previously saved population. |
Suprise | Toggles drawing, makes the simulation faster. |
New Population | Keeps the generated track and restarts the whole car population. |
Create new world with seed | The same seed always creates the same track, 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. |
Red | Top score in each generation |
---|---|
Green | Average of the top 10 cars in each generation |
Blue | Average of the entire generation |
The genome consists of:
This is not as deterministic as it should be, so your best car may not perform as well as it once did. The terrain
gets more complex with distance.
I'm not in the mood to deal with checking if all scripts have loaded before running, so refresh the page if things
seem whack.
The code is now on a GitHub repository. Feel free to contribute!
Originally written by this guy, now with contributions from patient people at GitHub.