For this project, I was responsible for creating a bot capable of playing Tetris in an online, competitive and interactive environment. Instead for going for a traditional approach such as naïve search (breadth first), or heuristics search (A*) I decided to opt for a more novel technique which is an AI capable of reinforcement learning. The implementation was done using Q-learning.

Unfortunately, since the solution was required to run on the riddles.io website I couldn’t make use of python and popular libraries such as TensorFlow, PyTorch or Keras. Therefore, I implemented this in plain C#.

In order to describe the state of the environment, in this case, the board I used 4 features of the board: the sum of the all heights taken from each column, the sum of height difference between one column and the next, the maximum height and the number of holes or empty blocks left between already placed tiles. This provided enough information to construct and train an AI capable of playing Tetris.

To read more information about the implementation details of this project, please use the button below to download a report.

Also, please feel free to check this video in order to see the AI in action.