3 ms·
Back in the heydays of 2048, I wrote a solver based on monte-carlo search[0]: Given a board state, continue playing in memory using random-moves. Do this multip
by air7 9y ago
Back in the heydays of 2048, I wrote a solver based on monte-carlo search[0]: Given a board state, continue playing in memory using random-moves. Do this multiple times. Choose the best fairing initial move.
It does surprisingly well considering it has no domain-specific knowledge of the game. (Reaching the 8192 tile)
Also this might be of interest:
Many variants of 2048 came out at the time such as a hexagonal board or Fibonacci tiles. The algorithm is domain independent so it works just as well for these variants. Also, luckily, the original version of the game had its game state and controls exposed in JS and therefore so did most of the variants.
This allowed me to write a bookmarklet version of the solver that could play many of the variants without modifications.[1]
[0]https://stackoverflow.com/questions/22342854/what-is-the-optimal-algorithm-for-the-game-2048/23853848#23853848 https://stackoverflow.com/questions/22342854/what-is-the-opt...
[1]https://ronzil.github.io/2048AI-AllClones/ https://ronzil.github.io/2048AI-AllClones/