Bot uses Expectimax search with the depth of 4 to find the best possible move.
direct.py --> Expectimax implementation (main algorithm)
puzzle.py ---> Implementation of game (main file, run this file for demo)
logic.py ----> Implementation of game (backend)
merge_game.py -----> Helper file for merging the matrix
$ python3 puzzle.py
Click the "Bot Play" button to turn to Manual Playing mode. Click the same button, now turned to "Human Play" to let the bot take control
(In file direct.py)
I have used a score and a penalty function.
A configuration gets a high score if it follows snake line pattern.
Weights are assigned to individual tiles. You can modify them to get different results.
Penalty is given depending on how many filled tiles are present (more filled tiles => bigger penalty).