Inside the AI

How the 2048 AI Solver Works: Expectimax Explained

By LK Forge  ·  6 min read  ·  Updated Jul 2026

When you turn on Autoplay, the board is handed to a small search algorithm — the 2048 solver — that plays 2048 far better than a casual human. It memorises nothing and follows no fixed script — it re-scores the entire board every single move. We also ran its exact search code headless for 250 full games to see how well it really plays: it reaches the 2048 tile in about 70% of games, pushes on to 4096 in roughly 30%, and — honestly — essentially never reaches 8192. Here is exactly how it decides, and where it hits its ceiling.

The Core Idea: Expectimax Search

2048 is a game against chance: you choose a direction, but the game then drops a new tile on a random empty square. The right tool for games like this is expectimax search. It builds a tree that alternates two kinds of layers. On a max layer the AI tries each of the four moves and keeps the best. On a chance layer it considers where a new tile could appear — a 2 with 90% probability or a 4 with 10% — and averages the results, weighted by probability. By looking several layers deep, the solver does not just grab the move that looks good now; it picks the move whose likely future is strongest, even accounting for unlucky spawns. That distinction is why expectimax handles 2048's randomness far better than a greedy one-move-ahead approach.

Why not minimax? Minimax assumes an adversary that plays the worst tile against you. But 2048's tiles are random, not malicious — so averaging over outcomes (expectimax) models the real game, while minimax would play far too defensively. This is the classic textbook split: minimax for adversarial games like chess, expectimax for games against nature.

The Heuristic: Scoring a Board

Search needs a way to score a board it cannot play all the way out. The whole evaluation is one line — three terms added together:

score = positional + empties × 200000 + smoothness × 4000

Those weights are why the AI keeps its largest tile pinned in a corner without ever being told to — it simply scores those boards higher. This is the snake rank map it uses (darkest = highest weight, the corner everything flows toward):

Ranks boustrophedon ("snake") down to the bottom-right corner. Each rank r contributes 4^r, so the corner is worth 4× its neighbour, 16× the next, and so on.

Searching Deeper When It Matters

Looking further ahead costs time, and the cost explodes with every empty cell because each blank is a branch on the chance layer. The solver makes two pragmatic trades to stay fast enough to run live in your browser:

Those two knobs are the entire reason it feels instant — in the benchmark it spent about 0.5 ms per move — and they are also the reason it plateaus, which we will get to.

From Score to Move

Putting it together, each turn the solver tries all four directions in the order down, right, left, up (a mild tie-break bias toward the bottom-right corner), runs expectimax over each resulting board, and plays the direction with the highest expected score. The AI Hint button runs that search once and reports the winning direction; Autoplay just repeats it on a timer until you stop it or the board locks up.

How Well Does It Actually Play?

Claims like "wins almost every time" are easy to write and easy to disprove, so we measured it. We lifted the solver's exact search and board code out of the page, played 250 complete games to game-over with no human input, and recorded the largest tile each game reached. Results:

Reached tileRateGames
512 or better93.6%234 / 250
1024 or better87.2%218 / 250
2048 or better (a "win")69.6%174 / 250
4096 or better29.6%74 / 250
8192 or better0.0%0 / 250
69.6% 29.6% 0.0% 2048 4096 8192 lkforge.com
Reach rate per doubling — the cliff from 4096 (~30%) to 8192 (0) is the solver's honest ceiling.

250 self-play games, standard spawn odds (90% "2", 10% "4"). Median game length ~1,650 moves; ~0.5 ms of thinking per move.

So the honest headline is roughly a 70% win rate to 2048 — strong, watchable, and well clear of casual human play — but it is not a superhuman bot. Notice the cliff between 4096 (about 1 game in 3) and 8192 (never). That wall is not mysterious; it is a direct consequence of the two speed trades above.

Reproduce this. Every number here comes from the shipped solver's exact search code run headless, and the harness is public and seeded — run it yourself → to regenerate the 250-game reach-rate table above.

2048 board where the AI solver reached the 2048 tile, pinned in the bottom-right corner
One live run of the solver reaching the 2048 tile — the 69.6% row of the table above, captured from AI Autoplay. The biggest tile stays anchored in the corner, exactly as the heuristic rewards.

Why it stalls at ~4096. Record-setting 2048 bots search deeper (depth 6+), expand chance nodes exhaustively rather than sampling six, and add a transposition table to reuse positions they have already scored. Each of those costs milliseconds per move — fine for an offline benchmark, too slow for a tab you are watching. This solver is tuned for a responsive live demo, and it trades the 8192 ceiling to get there.

The result is a live, watchable run of the corner-snake strategy — the exact pattern the strategy guide teaches — executed move after move in front of you. Turn on Autoplay and you can literally watch the snake weights and the empty-square bonus fight it out in real time.

Frequently Asked Questions

Is there a 2048 AI solver?

Yes — this page is a free in-browser 2048 AI solver. Tap AI Hint for the best next move, or AI Autoplay to let it play the whole game. No sign-up, and it runs entirely in your browser.

What algorithm does the 2048 solver use?

Expectimax search over the random tile spawns, scored by a corner-snake heuristic that rewards empty squares and a clean descending order. It is not a generative-AI or LLM wrapper.

How good is the 2048 AI solver?

In a 250-game benchmark it reached the 2048 tile about 70% of the time and 4096 in roughly 30%, and essentially never 8192. It is strong and watchable, but not an unbeatable bot.

Is there a 2048 best-move calculator?

Yes — the AI Hint button is exactly that. It scores all four directions with expectimax search and names the strongest move, along with why.

Is the 2048 solver free?

Completely free, with no account required. Everything runs client-side in your browser.

Can I run the solver on my own 2048 board?

The solver plays on this page's own 2048 board rather than importing a position from another site. Start a game here — or turn on Autoplay — to watch it work.

WATCH THE AI PLAY