Skip to content
This repository has been archived by the owner on Aug 9, 2023. It is now read-only.
/ FlappyBirdAI Public archive

A neural network that plays FlappyBird (made via PyGame) and learns through reinforcement learning.

Notifications You must be signed in to change notification settings

LV/FlappyBirdAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FlappyBirdAI

A neural network for Flappy Bird using reinforcement learning

This is my very first start at trying out any sort of machine learning or artificial intelligence. I am following Bluefever Software's tutorial which can be found here. His repo can be found here.

Start

How to install and run

  1. Clone this repository: $ git clone https://github.com/LV/FlappyBirdAI
  2. Go into the project directory and install the required packages: $ pip3 install -r requirements.txt
  3. Run the program $ python3 src/main.py

How to play

The premise of this game is to survive for as long as possible. Press space to jump. Press esc to quit the game.

master and no-ai branches

There are two branches of the repository, master and no-ai. The no-ai branch is version of the game you can play where as the master branch will be where all the reinforcement learning will take place.

The neural network

The neural network consists of two different inputs, five hidden layers, and one single output as demonstrated by the diagram below:

neural network diagram

Input nodes

  • Input 1 (i1) will consist of the distance (in pixels) to the end of the nearest upcoming pair of pipes.
  • Input 2 (i2) will consist of the height between the bird and the middle of the upcoming pipe pair gaps.

The inputs are demonstrated by the following photo:

input demonstration

The following diagram demonstrates how the neural network works (the actual program uses 5 hidden layers instead of 3):

neural network diagram

About

A neural network that plays FlappyBird (made via PyGame) and learns through reinforcement learning.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages