This fourth blog post concludes my personal project of developing an AI-based 2048 video game in Python 3. Feel free to check the first blog post of this series out if you haven’t read it yet.
If you want more details, the source code of the project is also available on Github.
This fourth and last post will focus on implementing the Neural Network itself and show a basic train/play cycle. Initially, I also wanted to demonstrate how this AI-based 2048 was (almost) always performing better than a Human but, well, you will see that it did not go as good as planned… 😀
This third blog post presents the User Interface that I designed for my 2048 video game (you can check the first blog post of this series out if you haven’t read it yet).
I chose to rely on the very good
tkinter package, which is the standard Python interface to the
Tk GUI toolkit. Both
tkinter are available on most Unix platforms, as well as on Windows systems. More details are available on the official documentation website.
This third post will mainly describe the
Window classes. If you want more details, the source code of the project is also available on Github.
As I was previously writing about, I am currently in the middle of developing a custom AI-based Python program able to play to the 2048 video game (you can check the first blog post of this series out if you haven’t read it yet).
So let’s state the obvious: if you want an algorithm to play to a video game, you first have to implement it, right? Basically, this means to “translate” the different rules of your video game, such as: What does it mean to win? What about loosing? What are the allowed moves? etc.
This second blog post presents the three most important classes (namely
History) I defined to model the 2048 game logic. For those who are impatient to see some User Interfaces (UIs) and Neural Networks, please just hang in there because -spoiler alert- these topics are coming up in the next posts (actually UI presentation is coming up right away in the next blog post. 😉
Origin of this project
Few years ago, I followed and completed a Massive Open Online Course (MOOC) on the Coursera platform about Machine Learning. This MOOC has been created (and it is regularly updated since) by Andrew Ng, a Professor at Standford University who also happens to be the co-funder of Coursera and the founding lead of Google Brain…
To me, this MOOC was the very first introduction to what more and more people are now calling “Artificial Intelligence” (AI). Whether we use Machine Learning or Artificial Intelligence terminology, we see more and more use cases where systems have to perform a narrow task based on some algorithms and (history) data.
As I’m working on a personnal programming project, I had to think about a way to easily share some code snippets on this WordPress blog.
I ended up installing SyntaxHighlighter Evolved, which is a WordPress plugin developped and maintained by Alex Mills.