Visualisation of a genetic algorithm

Here you can see how the path of a moon lander is optimized using a genetic algorithm.

When you press "run 1x", 200 landers are created with random commands and fly through the level. Each line is the path of one lander. When you press the button again, the best landers are selected and used to create new landers.

When you press "run a lot", this happens automatically. You can observe how the landers slowly get better. On the javascript console you can see how the score of the best lander increases from 0 to 100 when they reach the landing zone and to 200 when they do so within safe speeds. Above 200 they get more points for consuming less fuel.

The landers change color based on the score they achieve. In the beginning they are red or yellow, after a safe path was found they appear green.

The code is on github. Inspiration came from this Codingame challenge.

Controls
Select level