developing flappy bird with artificial intelligence, Fatih Mehmet Bostancı, famebo Designed by Freepik
Software

Training Flappy Bird with Artificial Intelligence

This application was built using the "Reinforcement Learning" method. So what is this reinforcement method?

"Reinforcement learning is a training method based on rewarding desired behaviors and/or punishing undesired ones."

says the source for "Reinforcement Learning". It also adds that this learning method is considered a way of guiding AI’s unsupervised machine learning through rewards and punishments.

In short, Reinforcement Learning can be described as giving a machine the ability to learn from its mistakes and produce the most correct outcome. It can be considered one of the learning forms closest to human intelligence. After all, from the moment we’re born we make many mistakes, and by learning from them we grow into adults. Along those lines, a machine can also be enabled to use its earlier experiences in different situations and produce the most correct result.

In light of this research, while browsing the web I came across a video that inspired me to build my own "learning Flappy Bird" application. Because Reinforcement Learning reaches the right answer by drawing conclusions from mistakes, the situation being learned may need to be repeated thousands, hundreds of thousands, or even millions of times. For that reason, instead of drawing one bird on the screen once and watching it repeat similar mistakes 1,500 times, we draw the same bird 1,500 times so it can make 1,500 attempts at once and learn faster. That shortens the learning time by a factor of 1,500. After these 1,500 birds die (are punished, in reinforcement terms), the bird that survived the longest is treated as the "smartest bird", and a new generation of 1,500 birds is produced from that smartest bird’s brain. In other words, each new generation (generation) is produced smarter than the previous one, and the mistakes of the previous generation are avoided. Of course, because the pipes on screen are generated randomly, the playfield and the learning time can vary accordingly.

You can try the app at http://flappybirdai.fatihbostanci.com.

The areas where reinforcement learning can be used are not limited to a game; it can be applied in many parts of life (healthcare, search and rescue work, and so on). Thanks to its ability to decide faster than a human, when it is placed in a new environment it has never seen before (for example, while searching for a human body trapped under rubble), it can adapt to that environment much more quickly and continue search operations in places people cannot enter.

Of course, when developing AI applications we should be careful and follow engineering ethics all the way. After all, none of us wants to face an Ultron one day, right..?

Thank you for reading my blog. Until the next posts, take care!