Flappy Bird Genetic Algorithm

Watch artificial intelligence evolve through natural selection! This simulation uses a genetic algorithm to train neural networks to play Flappy Bird.

Simulation

Generation
1
Alive
100
High Score
0
Speed:

How Genetic Algorithms Work

What is a Genetic Algorithm?

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.

How This Simulation Works

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

Bird's Neural Network

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.