By now, we’ve all heard of the addictive tile-mashing game called 2048. Last week, I picked up 2048 for the first time and — true to my nature — I started designing an AI to beat the game for me the following day. It didn’t take me long to find out that there’s already some pretty good AIs out there, so I picked up the best 2048 AI I could find and fired several instances of it to see what it could do. Much to my surprise, it not only beat 2048… it crushed every human record in 2048 that I could find.

Below is a video of the first 20 seconds of the AI hacking away at the game, mashing and merging tiles at superhuman speeds that we only wish we could match.

Like a multi-armed genius, the AI played 1,000 games of 2048 simultaneously without a hitch. Some games ended in a few minutes due to a series of unfortunate random tile spawns, while others nearly lasted 4 hours and reached scores previously thought impossible.

The worst instance achieved a score of 35,600, but even that instance managed to build the 2,048 tile and beat the game. Most instances ended with a score around 390,000 and a 16,384 tile, but the best instance built a 32,768 tile and stayed alive long enough to reach a score of 839,732.

As far as I know, this is the highest score achieved in 2048 without undos.

Perhaps even more impressive is how consistently the AI beats 2048. The AI reached the 2,048 tile — and even the 4,096 tile — in all 1,000 games, and reached the 16,384 tile in a large majority of them. In 1/3 of the games, the AI astonishingly reached the 32,768 tile, though it wasn’t able to make it much further past that. (Though it’s theoretically possible, if you’re lucky.)

For the rest of this post, I’ll be looking at the game where the AI reached the high score of 839,732. In that instance, the AI beat the game in only 973 moves, which is about average for the AI.

What’s especially curious about the AI’s progression is that it tends to reach tile X in about (X / 2) moves. For example, the AI reached the 16,384 tile in about 8,000 moves. At that rate, the AI would theoretically reach the 131,072 tile (the theoretically largest tile) in about 65,500 moves — roughly 2x the number of moves it ended up lasting for — if the random tile spawns played out in its favor.

The AI’s 2048 strategy

To get a better understanding of how the AI managed to rack up such a high score, I analyzed its playing strategy on its highest-scoring game. Below, I’ll outline 4 useful playing tips that the AI adopted to beat 2048. Some of these tips are fairly well-known — and were even coded into the AI as heuristics — but I figured it’s good to cover the bases.

Following these tips will undoubtedly help you improve your game and — hopefully — beat 2048. Ultimately, however, your survival toward the end of the game relies heavily on the random tile spawns working out in your favor; one poorly placed tile can spell the doom of your game.

Tip #1: Keep your highest-value tile in one corner for the whole game

One of the earliest strategies that players discovered for beating 2048 was to keep your highest-value tile in one of the corners for the entire game and slowly build it up. Some writers even called this a major design flaw of 2048 because it tends to make the game (relatively) easy to beat.

It’s no surprise, then, that the AI took advantage of this design flaw to beat 2048. In this game, the AI happened to choose the upper left corner, but all corners are equally viable. Pick one corner and stick to it.

Tip #2: Keep your highest-value tiles lined up

Another early strategy that 2048 players adopted was to maintain a row of monotonically increasing tiles as you build your main tile. I took a screenshot from my video above to demonstrate:

Notice how the tiles are nicely lined up? The 64 is right next to the 32; the 32 is right next to the 16; and the 16 is right next to (what is about to become) the 8. When that line of 4s is combined into a 16, this configuration allows you to quickly compress the entire row into your next-highest tile and start again.

Unsurprisingly, the AI adopted this strategy as well. The AI chose the top row as its primary row and kept 2nd-highest-value tile on the board was consistently right next its highest-value tile…

… and kept the 3rd-highest-value tile right next to the 2nd-highest-value tile in the top row. And so on. You’ll also notice that the AI often had the 3rd-highest-value tile just under the highest-value tile as well, which I’m still trying to understand. Any thoughts?

Tip #3: Keep the squares occupied

Above, I mentioned that unfortunate random tile spawns can often spell the end of your game. One of the more interesting strategies that the AI seemed to adopt was to keep most of the squares occupied to reduce randomness and control where the tiles spawn.

For most of the game, the AI maintained 12-15 (out of 16) tiles on the board and avoided merging too many tiles at once. While risky, this strategy ensures that tiles will spawn where you want them on the board.

In this game, the AI kept the bottom-right corner of the board open so the low-value tiles would spawn around there, which it would then merge with nearby low-value tiles and move up the chain.

If you choose a different corner, make sure to use the diagonally opposite corner as your “spawning ground.”

Tip #4: Maximize the number of possible merges on the board

One of the mistakes that newer 2048 players tend to make is to try to merge everything quickly and leave as many squares open as possible. While such a strategy makes intuitive sense — more open squares means you’re less likely to get gridlocked — focusing on immediately merging everything actually leads to shorter games.

In its best game, 2/3 of the moves the AI made resulted in 2+ possible tiles that could be merged. At the extreme, some moves resulted in 6+ possible tile merges, but of course not all those merges could be made at once.

Try playing a few games where you keep tiles lined up to merge — but don’t merge them until you have to — and see if you last longer than usual.

Have you beat this high score?

If you’ve beaten this high score in 2048 (with an AI or otherwise) without undos, please let me know in the comments below! I’d love to hear how this AI can be beaten.