# 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. May 6 '14 at 19:32

I have been following the instruction from the link below:

Managed to get to a 4096 tile and I think it is possible to do a 8192, see the screenshot.

• Every time you pause the video to get the URL, mentioned in the video, it is covered up by an add. For those curious URL is ov3y.github.io/2048-AI Mar 21 '14 at 22:26
• You might want to extract the relevant info from the video and actually write it down. If the video goes down in the future, this answer will become utterly useless. Mar 25 '14 at 9:13

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, both of which I have gotten, we have to talk about "flatboards". Basically 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
``````

In this case, you can't go left, right or down, so you have to go in your forbidden direction, up. I consider flatboards as a game of luck. In this case, if the tile spawns under the 2k (2048) or 128, you can recover most of the time. However, if the tile spawns under the 1k or 256, you may be screwed up. You may want to try to get a better spawn by going towards the low tiles, in this case, right before moving down again.

# The real strategy:

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, 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 128 and not worry about shifted tiles, because there is a way to put 1 or 2 shifted tiles back in the corner.

## More advanced things

### 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:

``````0 0  0   0
0 0  0   0
0 0  2   0
0 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 for 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!

### Key to avoiding flatboards

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.

### 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

and a Reddit post:

https://www.reddit.com/r/2048/comments/ic841i/mastering_dpdf/

### The 3x4 space

*Still working on this!*

### 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. Here is a reddit post: https://www.reddit.com/r/2048/comments/hz1rj0/mastering_the_2x4_space/ 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. Jan 27 '21 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, will add screenshot later TBC