Playing With AI - The Plan

Photo by Terry Lee on Unsplash

Playing With AI - The Plan

Mastering Tetris with Reinforcement Learning

Introduction

I like video games and I like AI. Coincidentally, they work pretty well together. In this series of blogs, I am going to be learning about and developing AIs with games as a sort of backdrop and writing about my experience.

I'd like to start with Reinforcement Learning as I haven't implemented this before and I find it quite fascinating. What would be fun is if the AI could learn to play a single-player game on its own without being given hard-coded behaviours. There are so many games to choose from but I have been inspired by the recent Classic Tetris World Championship last weekend so let's go with this timeless masterpiece.

Plan

My goal for this first project is to create an AI that can beat my score on https://tetris.com/play-tetris using Reinforcement Learning. The first step will be to create a Tetris game so I can train the AI locally. The next step will be to learn about Reinforcement Learning and then implement a training model that can play the game I've created. The final step will be to take the trained model and have it play the online Tetris.

As I'll likely create the AI model with Python, it will be easier to also create the Tetris game with Python. I'll base the rules, scoring, and controls of the Online version on Tetris.com to hopefully keep the training conditions as similar to the actual conditions as possible. As a starting benchmark (having done a quick play of the game) I want the model to achieve a score of at least 50,000. Any improvements beyond this will be a bonus until I eventually play a best of 5 against the AI to determine a winner.

The goal is not to make a polished version of Tetris. I will be happy with the bare minimum in terms of aesthetics and UI, as long as it performs like the online game. The real goal is to create and train the AI model and that will be my main focus while the Tetris remake will be treated only as a means to an end. If I find my own Tetris game to be not worth the effort, I may also look into pivoting to someone else's creation or utilising the online version from the get-go.

Conclusion

AI, Tetris, Python programming, and a whole lot of fun. I foresee this first project being a bit all over the place while I get settled in it but I am looking forward to getting started. Each blog post should give an update on where I am in the project and anything I've learned along the way. Expect the next post the involve my start on the Python-built Tetris game and possibly the first stages of research into Reinforcement Learning. If you also think this sounds interesting, be sure to follow along and give it a try yourself!