http://stackoverflow.com/questions/2234 ... -game-2048
In fact, there is a serious random element in the game (indeed, if there were truly an "opponent" in placing new 2s and 4s it would be nigh impossible), but it seems that the expectiminimax variants work sufficiently well here.Since the game is a discrete state space, perfect information, turn-based game like chess and checkers, I used the same methods that have been proven to work on those games, namely minimax search with alpha-beta pruning. Since there is already a lot of info on that algorithm out there, I'll just talk about the two main heuristics that I use in the static evaluation function and which formalize many of the intuitions that other people have expressed here.