Learn how deep Q-learning works by running this hands-on Flappy Bird training experiment
Watch a pre-trained AI play Flappy Bird using the included checkpoints without waiting for training to finish
Adapt the neural network architecture or training parameters to experiment with reinforcement learning concepts
Use this as a starting template to apply deep Q-learning to a different simple game environment
Requires TensorFlow 0.7, which is very old, use a Python virtual environment with a compatible version.
This project teaches a computer to play Flappy Bird on its own, without any hand-written rules. Instead of telling the program what to do, it lets the AI figure out the game by trial and error, watching raw pixels on the screen and learning from experience. The core idea is called Deep Q-Learning. The program uses a type of neural network, similar to how image-recognition software works, to look at the game screen and decide whether to flap or do nothing. Every time it takes an action, it remembers what happened: the screen before, what it did, the score change, and the screen after. It stores thousands of these memories and trains on random batches of them repeatedly, gradually improving its judgment about which action leads to a better outcome. To get the network to start learning something useful, the project first runs the game for 10,000 steps with completely random actions, just to fill up the memory bank before any real training begins. After that, the AI slowly shifts from random choices toward what it has learned, reducing its randomness from about 10% down to nearly zero over three million game frames. The game screen is preprocessed before feeding it into the network: each frame is converted to grayscale, shrunk to 80 by 80 pixels, and four consecutive frames are stacked together so the network can sense motion. The network itself has three convolutional layers for detecting visual patterns, followed by a fully connected layer with 256 nodes, and a final output that scores each possible action. Running it requires Python, TensorFlow 0.7, pygame, and OpenCV. After cloning the repository, a single command starts training from scratch. Pre-trained checkpoints are included so you can also watch a trained bird play immediately without waiting for training to finish. The project is based on a published DeepMind paper on playing Atari games, adapted here specifically for Flappy Bird.
← yenchenlin on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.