2048 Monte Carlo: How Random Games Choose the Next Move
A 2048 Monte Carlo player picks its next move by trying each legal slide, finishing the game many times with random slides, and playing the slide whose random games scored highest on average. It needs no strategy rules at all, and with 100 random games per move one such program reached the 2048 tile in 80% of its runs.
If you want a board to try the idea on by hand, Evolved 2048 puts the 2048 puzzle on a cube you turn like a Rubik's cube: you slide the front face, twist rows to bring tiles round from the other faces, and it is free to play in your browser.
How a 2048 Monte Carlo player picks a move
The player has no rule that says corners are good or that big tiles belong together. It has only a fast copy of the game's rules, used the same way on every turn:
- List the legal moves. A slide that moves no tile is not a move.
- For one of them, copy the board and make the move.
- From there, play random legal moves until the game is over. That is one random game, also called a playout. Note its score.
- Repeat steps 2 and 3 a fixed number of times, then do the same for every other legal move.
- Average the scores for each move. Play the move with the highest average on the real board, and throw every random game away.

One decision, with the averages from the test described below.
Wikipedia's Monte Carlo tree search article calls this pure Monte Carlo game search, and notes what makes it unusual: it needs no evaluation function. Writing down the game's mechanics is enough.
Where the idea comes from
The 2048 version most people meet is a small program by the GitHub user ronzil. Its README says the aim was a player with "no hard-coded knowledge about the game", one that should "find out for itself" with no scoring functions and no rules of thumb from the programmer.
The method is much older than the game. Stanislaw Ulam wrote that it came to him in 1946, while he was recovering from an illness and playing solitaire. He wanted the chance that a game would come out. Rather than calculate it, he thought, why not "lay it out say one hundred times and simply observe and count"? Wikipedia's Monte Carlo method article quotes him, and traces the name to the Monte Carlo Casino in Monaco.
Games came later. In his 1987 PhD thesis, Bruce Abramson judged positions by random games played to the end instead of by a hand-written evaluation. In 2006 Rémi Coulom gave the tree-building version its name, Monte Carlo tree search. The 2048 player in this post is close to that older idea: no tree, only averages.
A tested example: one board, three moves
We wrote a short script for this post and ran it on the classic 4 by 4 game, with the rules as the original 2048 code has them: a new tile is a 2 nine times in ten and otherwise a 4, and a merge adds the new tile's value to the score.
The board, top row first: empty, 2, 4, empty. Then 2, 8, 16, 2. Then 4, 32, 64, 8. Then 16, 128, 256, 512. Left, right and up are legal. Down moves nothing.
- First 100 random games per move: left averaged 702 points added, up 554, right 524. Pick: left.
- Second 100: right 561, left 526, up 486. Pick: right.
- Third 100: left 609, right 457, up 421. Pick: left.
- 1,000 per move: left 576, up 517, right 487.
- 10,000 per move: left 592, up 490, right 485.
Left is the better move by about 100 points. But left's own average swung from 526 to 702 between batches of 100, a spread of 176. The noise in a small batch is bigger than the gap it is trying to measure, and one batch in three chose the weaker move. Only at 1,000 games and more did the order settle.
What the method reaches
Random play by itself is hopeless. In 1,000 fully random games in the same test, the mean score was 1,101 and the best was 3,164. The highest tile was 128 in 496 games, 64 in 364 and 256 in 75. No game made a 512.
Yet averages of those same hopeless games choose well. The README reports that with 100 runs per move the program reaches the 2048 tile in 80% of its runs and 4096 in 50%. Its author calls that "surprising", because "a random-walk game finishes quite quickly".

Random play alone against the same random games used to choose each move.
More games help, slowly. The author's C++ version runs 10,000 games per move and reports the 2048 tile every time, 4096 in 70% of games and 8192 in about 1%. That is 100 times the work for 20 more percentage points at 4096.
The strongest objection: random games are bad games
Each move is judged by how it survives terrible follow-up play, not good play. Look at the example again. The random games added about 500 to 600 points before they ended. Merging two 512 tiles pays 1,024 points in one slide. So the typical random game never made the next big tile, and the averages said nothing about which move leads to it.
What the averages do measure is how forgiving a board is: room to move, and merges close at hand. A long plan, such as keeping the biggest tile in a corner and building a chain towards it, falls apart within a few random slides, so the method cannot see it pay off. Wikipedia lists a related weakness for the whole family: a move can look strong on average and still lose through one precise line of play.
The ceiling shows in the numbers. About 1% at 8192 is far from the players built on search and learning. Hung Guei's 2022 dissertation, on arXiv, reports a learning program that reaches the 32768 tile in 72% of games, with an average score of 625,377. Our posts on 2048 AI strategy and 2048 reinforcement learning cover those two families.
Pure Monte Carlo is not Monte Carlo tree search
This is the distinction people most often get wrong. The player above spreads its random games evenly over the first move and remembers nothing. Monte Carlo tree search keeps a tree of the positions it has visited and works in four steps: selection, expansion, simulation and backpropagation. It sends more random games down branches that have done well so far, so its estimates sharpen where they matter.
Neither one learns. Nothing is carried from one move to the next, or from one game to the next.
Some questions are still open. The author of the 2048 program tried scoring moves by the best or worst random game instead of the average, averaging over short move lists, and a kind of Markov chain, and reports no significant improvement from any of them. Why plain averages of random games do so well in 2048 has no agreed answer; the README offers surprise, not a proof. And Guei lists Monte Carlo tree search among the techniques that are "promising" for a stronger 2048 program, which is a way of saying the work is not finished.
What it means for your own game on a cube
You cannot play 100 random games in your head, but you can borrow what the averages reward. Before a move, ask which choice leaves the board most forgiving: the most empty squares and the most pairs ready to merge. That is the question the method answers.
Evolved 2048 gives the same advice in its own words. When a game ends, it says: "Next time, keep room on one face so a twist can still bring tiles round to their match."
The cube also changes the sums. It has six faces of nine squares, 54 in all. Besides sliding the front face, you can twist a row or a column to carry tiles to the next face, and every slide or twist adds a 2 or a 4. So a Monte Carlo player for the cube would have more moves to compare on each turn, and more random games to run. Turning the whole cube is free, so it would add nothing to the count. We have not built such a player; this is arithmetic, not a result.
Frequently asked questions
Does a 2048 Monte Carlo player need to know any strategy?
No. It needs only the rules: which moves are legal, how tiles merge, how new tiles appear and how the score is counted. Everything else comes from the averages.
How many random games per move does it need?
The original program reports the 2048 tile in 80% of runs with 100 per move, and every time with 10,000 in its C++ version. In our test, three moves needed 1,000 games each before their order stopped changing.
Is Monte Carlo the same as reinforcement learning?
No. A Monte Carlo player throws its random games away after every move and starts the next game knowing nothing. A reinforcement learning program keeps what it found and plays better over time.
Why is it called Monte Carlo?
The name comes from the Monte Carlo Casino in Monaco. Stanislaw Ulam traced the method to 1946, when he thought of playing a solitaire many times and counting the wins instead of calculating the odds.
Get started with Evolved 2048
Play two games and ask the playout's question before each move: which choice leaves the most room? Then compare the two scores. One game of yours is one playout, and the example needed 1,000 to settle.
Play Evolved 2048: it is free and plays in your browser on a computer or a phone.
The 2048 puzzle on a Rubik's cube, and past 2048.
Visit evolved2048.vlvd.net↗


Comments
No comments yet.