# What is the optimal strategy for 2048?

I've tried a few approaches, but I just can't make a tile with 2048

## The key

... to all merging/matching/combining games like this is creating what's called immutable subsets. I'll explain what this means using 2048, but it really applies to most, if not all, of the games similar to it in nature.

## Intermission

An immutable subset is a collection of tiles that don't change (in this case move) within a specific set of rules. Usually this comes with a restriction on the input commands you can use and the immutable subsets with respect to the different input commands can be different. Let me give you an example:

``````2  2  4  8

2     2
2
``````

The `2 4 8`part of the top row is immutable with respect to `up` and the `4 8` part is immutable w.r.t. `right`. The `2` in the bottom right corner is immutable w.r.t. `down` and `right`.

In sum, the immutable subsets w.r.t. each input are:

• `up`: the `2 4 8` block in the top row
• `down`: the `2` in the bottom right corner
• `left`: nothing
• `right`: the `4 8` block and the `2` in the bottom right corner

## Solving algorithm

Understanding immutable subsets is basically all you need. From there on, the trick is to use only such input commands that include your highest tile in an immutable subset. This way, the highest tile will remain in the same spot no matter what you do. Pick a corner, build a high tile there and make sure it's always part of an immutable subset from then on. The only exception is when you actually created another tile of same value next to it and merge them to get one step further. In this case, though, make sure the location of the new highest tile is the same as that of the old highest tile.

To actually do this, you will need a preference order of keys you use. One key will be the one you use most of the time, another one nearly as often. Those are the keys that point towards the corner you picked earlier. The key you use most often will result in the creation of an immutable subset along an entire border of the field w.r.t. the inputs perpendicular to the first one. For example, if you choose the bottom left corner and `down` over `left`, then you will soon have an immutable subset along the bottom row w.r.t. `left` and `right`. This puts `right` as the third key in you preference order and means the last key, which you will want to avoid as much as possible, is `up`.

Respecting this preference order, the second trick to solve the puzzle is to build consecutive chains, that is, tiles with values decreasing one step each, one next to the other. This chain can be along borders, usually in a snake formation, but can also go inside the field. What's important is that this chain or most of it should be part of your immutable subset. So basically, you're building a tile of one step less than your highest value tile next to it in such a way that they don't move around.

## The problems

Sometimes it just happens that the entire field is immutable w.r.t. some direction and mutable to all others. An example of such a field would be this:

``````32 16 8
16 8  4
8  4
``````

This is completely immutable w.r.t. `up` and `left`, but entirely mutable w.r.t. `down` and `right`. This is one of those cases where you have to gamble and hope your highest tile is not blocked by the newly spawned tile.
If it is, however, there are ways to recover. Explaining them in detail would go beyond the scope of this answer, but the basic strategy is to get the highest tile immutable w.r.t. the direction opposite of the border it touches (so if it's at the left, make it immutable w.r.t. `right`) and have all tiles to either side of it mutable, then execute that command and in the next step, move it back into the now free corner. An example of this setup is this:

``````2  32 16 8
16 8  4
8  4
2
``````

This could be a lucky result from going `left` after a `2` appeared in the wrong place when going `right` in the previous example. Now, going `down` will result in the top row holding only the `32` and possibly a random spawn, so you can move the `32` back to either the top right or top left corner.

## Common mistakes

While purely subjective and based solely on personal experience, I'll give you some things to look out for which I feel are done wrong often, even if you try to apply the strategy described here. Avoiding those can be the key to reaching the next level.

• Merges in your "immutable" row/column
You carefully built your immutable row with the highest and some other tiles so that it's immutable w.r.t. `left`and `right`(or accordingly with a column), so you know you are free to use both of those commands. Then a tile in said row becomes the same as another one, you don't pay attention, hit the wrong direction and the tiles merge, moving you highest tile out of the corner! Make sure to go towards the corner if your row ever gets a double tile. You can get away with it, you can also recover (see previous section), but it's better to avoid this altogether.
• Trying to keep the immutable row/column at all costs
It's not only possible, but also advisable to sometimes switch from row to column. The only really important thing is that your highest tile remains in its corner. Sometimes you reach a state where the highest tile is absolutely immutable (w.r.t. all commands). That's generally a good time to think about switching your direction. Don't forget to also adapt your command preference order!
• Trying to use up high tiles at all costs
Picture this situation: Your highest tile sits at `256` and you have a `128` tile somewhere, but not close enough. You then get another `128` tile next to your `256` tile and desperately try to get the first `128` closer in order to merge them and get to `512`. In the process, lots of low tiles spawn and soon, your field is all clogged up. Sometimes, you just can't use some tiles. Sometimes, you actually get a second one of the highest tile, but in the wrong place, because you just had to recover from a mistake or unlucky spawn as described in the previous section. Unless we're talking about `1024` tiles, it's usually the best idea to just leave it there, continue building up the rest of your field and use it once it comes in handy. Don't force anything, having high tiles hanging around is not a bad thing.
• Blocking your field with alternating `2` and `4` tiles
This is relevant when you reach a point when your field is nearly full. At this point, it's very important to not block your tiles. Moving into the wrong directions can mean you get a pattern of alternating `2`s and `4`s, which basically kills you. Make sure you can combine as many tiles as possible with each move when your field approaches the point of being full. Also, make sure to move your last rows so that you can immediately recombine the spawning `2`.

That's all I can give you, if you stick to this strategy and make sure you avoid the mistakes, winning should be a matter of time. Due to the random nature of the game and the occurence of situations where you must break the pattern, you just can't win sometimes. Keep trying and the strategy described here should help you win something between 10 and 60 percent of your games. It all comes with experience.

• I wrote an article recently covering these basic rules in a "human" digestible manner. gameskinny.com/lnagr/… I think it works well with your guidance above and I've linked from the article. Commented May 6, 2014 at 19:32

tl;dr: It's much more complicated than the answers above describe, if you want to get 8k, 16k or 32k.

Terminology: What we call the "3x4 space" is this space determined by the Xs:

``````X X X X
X X X X
X X X X
a b c d
``````

where a, b, c and d are your high tiles. There is a risk factor for beginners at the 3x4 space:

• 128 or less: piece of cake
• 256 or 512: medium
• 1024 or higher: hard

Most of this is enough to get 2048 almost every time, but if you want to get, say, 8192 or 16384, we have to talk much more deeply.

For every 'bad thing' happening to your boards in 2048, there are two techniques I will be talking about, prevention and recovery.

### Prevention

Prevention is a general umbrella term for techniques that help you avoid threats entirely. Often, these types of techniques force the player to be cautious in their playstyle - almost every single time you make a move, you should keep these prevention techniques in mind. I would suggest these kinds of techniques for the cautious, 'slow and steady' player.

### Recovery

Recovery is a mess - to put it bluntly. Most all recovery techniques focus on very 'hail mary'-type manuevers that depend on you getting lucky RNG, and then lead to *doable*, but much less organized situations that end up, eventually, in a worse place than you were originally.

# General ideas:

2048 itself is a very strategic and slow-and-steady game. Keep this in mind when ever you are thinking about rushing through willy-nilly. In the midgame, you need to follow general heuristics for moves to make sure you don't end up in a bad place. In the endgame, every single move is extremely important. Think about your decisions before you make them to see if they make sense.

2048 is an RNG-heavy game. After you make a move, there is an RNG choice about where in the empty spaces in the game a tile will spawn, and whether it will be a 2 or a 4. These can be crucial to success, and one wrong spawn can fail you.

Of course, you need to put your highest tile in the bottom right corner (or any corner) and make a snake leading up to it, but there's something called "coming in from behind" that allows you to make the highest tile resistant to shifting. For example, if you have this on your row:

``````32 64 256 512
``````

Instead of making a 32 like this

``````32
32 64 256 512
``````

, which makes the highest tile vulnerable to shifting, you make a 64 like this:

``````2  2  4   64
32 64 256 512
``````

Likewise, if you have

``````32 64 128 1024
``````

build the 128, not the 32.

Then you go: left left down to merge the two 64s. However, sometimes, it's not worth the risk, especially if, as a beginner, you try to make 512 in the 3x4 space when presented with a situation like this:

``````0   0   0   0
0   0   0    2
16  8   4    2
256 512 1024 4k
``````

Instead, you should just make 256 and not worry about shifted tiles, because there is a way to put 1 or 2 shifted tiles back in the corner.

## Flatboards

A **flatboard** is when you're forced to move in your "forbidden direction", like this:
``````0  0  0   0
2  4  2   4
8  2  16  64
2k 1k 256 128
``````

and then a tile spawns under your board:

``````0  4   0   0
2  2   2   4
8  1k  16  64
2k 2  256 128
``````

Flatboards are an insanely deadly threat, and are, in my opinion, the main thing that is keeping novice players from getting higher tiles. Nothing in this game is more soul-shattering than one getting so close to a 16k/32k tile, then losing because a flatboard strikes you since you weren't paying attention.

### Prevention

The key to avoiding is actually pretty simple: try to keep at least one tile on the top row, and considering a flatboard whenever going down. At first, it may seem a bit slow, but you can get used to it. For example, in this case:

``````2  4  2   0
2  4  2   0
8  16 32  64
2k 1k 256 128
``````

don't move down first, because if done, the RNG may decide to give us a tile like this:

``````0  0  0   0
4  8  4   2
8  16 32  64
2k 1k 256 128
``````

which is a flatboard. Instead move right which will decrease the 20% chance to an 0% chance of an flatboard.

### Putting shifted tiles back in the corner:

The accepted answer described your highest tile getting shifted as dangerous, but there is a way to put one or two high tiles back in the corner. Let us say you just made a 8192, but it isn't in the corner, like this:

``````0 0 0  0
0 0 0  0
0 0 2  0
2 4 8k 8
``````

In this case, you try to move left and right as many times as possible, and down if needed, until you get a formation like so, where the column with the 8k is "blocked":

``````0  0  2
0  0  4
0  0  2  4
16 32 8k 8
``````

Then, you move up and hope that the RNG doesn't spawn a tile next to the 8k. If it does, try again. If it doesn't, great, you have your corner formation restored!

In the case of two tiles, it's about the same strategy, however, there are now two different ways, applicable in different situations.

1: You have a formation like this:

``````0 0 4   2
0 0 2   4
4 8 16k 8k
0 0 0   2
``````

or any similar situation with the row with the 16k and the 8k blocked, and the bottom row contains at most 1 unmergeable tile, you should go left and then hope the RNG isn't too naughty to spawn a tile under the 16k or 8k, then you move down if the RNG is nice, and you try again if the RNG is naughty.

2: You have a formation like this:

``````2 4  2   0
0 2  4   2
4 2  8   0
8 8k 16k 4
``````

Again, you go left and right again and again until both of the 8k and the 16ks columns are blocked. Then, you hope the RNG has a good spawn, but in fact, it's absolutely okay to have something like this:

``````8k 16k 32 16
``````

on the bottom row. Just imagine the 8k and the 16k and swapped, and, there, you're building 32k. However, if you have 4k + 16k shifted, try again if the RNG gives an naughty spawn, because the road to 32k with 4k + 16k ain't too easy.

### Pushing the 8K up at juuust the right time

A short lesson: last lesson we learned that you can still have the 8k and 16k swapped and it would still work out. Well, how do you merge? you might ask.

Ah, a very appropriate question, and just the right one.

``````2   0   0   0
2   4   2   8
128 256 512 1k
8k  16k 4k  2k
``````

Now, instead we build the 64 on the right side, which will be key for our trick.

``````0   2   2   4
8   16  32  64
128 256 512 1k
8k  16k 4k  2k
``````

Now, we push up right here. You can quickly see the trick. After we go right left left down everything merges perfectly! And all we have is a shifted 32k that we can easily bring back to the corner.

You don't need exactly a situation like this, just a situation where you can push up to make a very neat merge. Be very careful, because if you don't, you may miss it!

### PDF and DPDF

In some cases, you may mess up, and get a flatboard. There is a strategy which may raise your chance of making 32,768 from 5% to 80%. Let us consider this situation:

``````0 2  4   2
2 8  16  32
2 1k 512 256
4 2k 4k  8k
``````

The goal is 16k. This situation is obviously unsuitable for snakechain, however, again, this is DPDF to the rescue. DPDF, sometimes called four-directional style, eliminates the idea of "never go in your forbidden direction" by going in all 4 directions. Usually, the goal is to get a setup of something like this:

``````0 0  0   2
2 32 64  128
2 1k 512 256
4 2k 4k  8k
``````

and then, again, move in all four directions in an reasonable style (Perimeter Defense Formation - PDF).

I have not mentioned this "style" yet, but, since I am not fully proficient at DPDF, the best guide I have is this site:

https://2048masters.com/lessons/pdf/training-1/index.html

## Tile Shifting

Tile shifting in the 3x4 space is so much more deadly than in the board, since there is no reliable way to shift your tiles back without leading to

## Backfilling

Backfilling is an absolute pain and can easily lead to a lost run.

### The 2x4 space

This is an very complicated topic, as complicated as PDF and DPDF. The strategy, as usual, is to put your highest tile in the corner like this:

``````4 2  2  0
8 16 32 64
``````

However, let us take this situation:

``````2 4 2 2
2 4 8 32
``````

with the goal of making 64 below the 32. Shifted 32s are usually dangerous, so we go right twice to get

``````0 0 4 8
2 4 8 32
``````

and then obviously we go left right. Neither am I proficient at the 2x4 space, but this is an basic example. There is lots more to learn if you want to be a true 2048 master.

• Wow, thanks for the complete answer! It's been a while since this thread didn't get some activity. Commented Jan 27, 2021 at 4:33

My strategy is to make a number one before the current (eg if the current highest is 4096, make 2048). Then make the one before that, and repeat until you have an easy one to get 2 of. Make 2, then combine the 2 to make a higher one, repeat until you have 2 of the highest number, combine them, and you have a new highest number. Hope this helps. :D

My strategy is to go up and right (back and forth) until it won't move anymore, then I go left ONE time. Then I continue going up and right until I either beat the game or lose. It won't work all of the time, but it does sometimes.

Pick one direction and strongly avoid going there. For me that's up.

I will endeavour to build the biggest tile in the bottom-left corner, and work backward along the bottom, making a "snake" chain. This gets twitchy when there's a long "tail"

My highest block was 32768, screenshot: