Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
erilyth committed Dec 9, 2016
1 parent a2dd3a9 commit 02c2b3b
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
# Flappy Bird Genetic Algorithm
# Flappy Bird Genetic Algorithm
Train a neural network using genetic evolution to play flappy bird!

## Final Results
![Trained Model](Screenshots/trained_final.gif?raw=true "Trained Flappy Bird")

## Algorithm Details
* Starts out with a pool of 50 models
* Each iteration based on fitness scores of the models, perform crossover
* Crossover would swap the first layers (input -> hidden) for both the selected parents
* Random mutation ensures that the models are changed at every iteration

## Progress Screenshots
#### Stage 1
Initially all the models would do the "same" wrong thing. So they would all die out quickly.
![Untrained No-Spread](Screenshots/untrained_initial_states_nospread.gif?raw=true "Untrained No-Spread")

#### Stage 2
After some time however, they would start to show more variation, but still perform the wrong moves. This gives us a spread of flappy birds throughout the screen (lengthwise).
![Untrained Spread](Screenshots/untrained_initial_states_spread.gif?raw=true "Untrained Spread")

#### Stage 3
After a bit of training (~1hr) the spread decreases and is more concentrated at the height where there is a hole in the pipes. They start performing a lot better since they now understand when to flap and when not to.
![Trained](Screenshots/trained_set_initial.gif?raw=true "Trained")

#### Stage 4
Considering the model with the maximum fitness, we can consider it as a trained model and it would perform much better than the average human.
![Final Trained Model](Screenshots/trained_final.gif?raw=true "Final Trained Model")

### Disclaimer
* Based on Flappy Bird clone in pygame, https://github.com/sourabhv/FlapPyBird
Binary file added Screenshots/trained_final.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/trained_set_initial.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Screenshots/untrained_initial_states_spread.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 02c2b3b

Please sign in to comment.