This simulation is a recreation of Jer Thorp's “smart rockets” — a classic demonstration of a genetic algorithm. A population of rockets is spawned with a randomised “DNA” of thrust vectors; each generation they fire those thrusts in sequence, flying until they crash, time out, or reach the target. Rockets are then scored on how close they get to the target (with a penalty for hitting obstacles and a big bonus for reaching the target), the fittest genes are combined using a simple crossover method, mutated, and the cycle repeats. Over time the population “learns” a flight path to the goal.
You can experiment by placing the target in a different location or drawing your own obstacles.
Inspired by Daniel Shiffman's Coding Train tutorial.