2048 Game and Bot

2048 Game and Bot

I have made a working 2048 game and a bot to play 2048.

The game works like a normal 2048 game, except there are no fancy animations because the bot runs too fast for the animations to look cool.

Activate the bot in the bot config tab. There are three options:

  1. Random Moves: The bot chooses random moves until the game is over.

  2. Random Bot: Random move simluation strategy. That is, for every starting move it simulates 30 games up to 60 moves in which it plays random moves and uses the starting move that has the best result.

  3. Minimax search: For the current state, goes through every possible move and for those moves goes through every possible tile spawn location up to a max depth of 5 because the branching factor is very high. Uses heuristics for number of empty tiles, monotonicity (row either increasing or decreasing), large tiles near the edge, smoothness (similarities in tile values close together for merge potential), and tiles merged.

I spent a long time working on this project. Unfortunately, none of the bot methods work spectacularly. I might improve upon it in the future by adding better heuristics or using a better algorithm. Comment any suggestions you have!

You are viewing a single comment. View All

@mwilki7 the shifts table is precomuting all the rows so I can shift each row in O(1) to make the bot very fast and the scores lookup table is the score based on heuristics for every single possible row so I can score the current board layout very fast