This video shows a creation of an artificial intelligence controller for the Flappy Bird game using neural networks and a genetic algorithm.
The program is written in HTML5 using Phaser framework (http://phaser.io/). There is also used Synaptic Neural Network library (https://synaptic.juancazala...) to implement entire artificial neural network instead of making a new one from the scratch.
According to Arthur Samuel, machine learning is the science of getting computers to act without being explicitly programmed. It is a fine tuning process of learning that incrementally improves an initial random system.
The form of machine learning implemented in this program uses a genetic algorithm to train artificial neural networks.
The birds are learning how to flap optimally in order to fly safely through barriers as long as possible.
The main concept is based on these 3 steps: 1. creating the initial population of 10 birds randomly 2. learning as the game is being played 3. applying natural evolution to form the next improved population
To measure the quality of birds and select the best ones, for each bird is calculated its fitness function in this way: - reward a bird by its total traveled distance - penalize a bird by its current distance to the closest gap
When the entire population is dead, the fittest four birds are selected to breed a new population by using genetic algorithm operators: selection, crossover and mutation.