Watch artificial intelligence evolve through natural selection! This simulation uses a genetic algorithm to train neural networks to play Flappy Bird.
A genetic algorithm is a search heuristic inspired by Charles Darwin's theory of natural selection. It mimics the process of natural evolution to generate high-quality solutions to optimization and search problems.
Each bird has a neural network brain that makes decisions. Birds that perform better (score more points) are more likely to be selected for the next generation.
When creating a new generation, we:
1. Select the best-performing birds
2. Crossover their neural networks
3. Mutate the networks to introduce variation
Each bird makes decisions using a small neural network that takes these inputs:
- Vertical position
- Current velocity
- Distance to next pipe
- Top and bottom of next gap
The network outputs whether to flap or not.