← all repositories
ssusnic/Machine-Learning-Flappy-Bird

Teaching a bird to flap with Darwin and a dozen neurons

A browser-based demo that evolves neural networks via genetic algorithm to master Flappy Bird, built as a learning tutorial.

1.8k stars JavaScript ML FrameworksAgentsLearning
Machine-Learning-Flappy-Bird
Velocity · 7d
+0.6
★ / day
Trend
steady
star history

What it does

This is an HTML5 Flappy Bird clone where ten birds play simultaneously, each controlled by its own tiny neural network. When every bird has crashed, a genetic algorithm breeds the top performers into a new generation. Rinse and repeat until something survives longer than your patience.

The interesting bit

The neural network is almost aggressively simple: two input neurons (horizontal distance to gap, height difference to gap), six hidden neurons, one output neuron that triggers a flap above 0.5. The README walks through the full genetic pipeline—selection, crossover, mutation, fitness scoring—making it a rare codebase where the “boring” evolutionary plumbing is the actual educational payload.

Key highlights

  • Built with Phaser and the Synaptic neural network library; no backend required
  • Fitness function is explicit: total travelled distance - distance to closest gap
  • Genetic operators are fully documented: top-4 winners survive, 6 offspring fill the rest via crossover and mutation
  • Includes linked tutorial and video walkthrough for learning neuroevolution from scratch
  • ~1,800 stars suggests it has served as a gateway drug for many developers

Caveats

  • The Synaptic library and Phaser version used are from an earlier era; expect vintage JavaScript patterns
  • Hardcoded population size (10 birds) and network architecture; not designed for experimentation without code changes

Verdict

Grab this if you want to see neuroevolution happen in a browser tab and finally understand why your GA homework mattered. Skip it if you need a modern, extensible reinforcement learning framework—this is a tutorial fossil, not a research tool.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.