We knew we wanted to build an AI for a game and researched a few options we could do. Ultimately we decided on Tetris because of its easiness to play at the beginning, but difficulty in the higher level.

What it does

The AI learns from favorable or unfavorable moves it makes in Tetris and tries to replicate the good moves more and more and gets better as the game goes. Moves are ranked from best possible outcome to worse.

How I built it

We used Q learning, a subset of Reinforcement learning which essentially gives "rewards" for favorable moves and "punishments" for unfavorable moves. Among many iterations of the AI, it learns which moves cause rewards and tries to continue those behaviors thus getting better at the game. We used Python and TensorFlow to build this app.

Challenges I ran into

It took some work to fine tune the reward system and find initial values to get it to start working since both of us were new to AI.

Accomplishments that I'm proud of

The AI definitely gets better as it plays more games and it's really cool to see that something we built could potentially become better than us at the game.

What I learned

We learned a lot about how to build an AI and experimented with new technologies.

What's next for Tetris Ai

We can add more functionality and improve the reward system to pick up on the best moves even earlier in the lifespan.

Built With

  • python
  • q-learning
  • reinforcement-learning
  • tensorflow
Share this project: