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:
Random Moves: The bot chooses random moves until the game is over.
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.
- 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!