What is the optimal strategy for 2048?

[BACK]
What is the optimal strategy for 2048?
Posted On: July 9, 2023

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


Question from user André Lucas at stackexchange.


Answer:

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 8part 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. leftand 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 2s and 4s, 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.


Answer from user scenia at stackexchange.



[BACK]
What is the optimal strategy for 2048?
Posted On: July 9, 2023

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


Question from user André Lucas at stackexchange.


Answer:

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 8part 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. leftand 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 2s and 4s, 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.


Answer from user scenia at stackexchange.



[BACK]

Can I salvage my Kerbal Space Program career with a single launch? Can I salvage my Kerbal Space Program career with a single launch?

Posted On: April 17, 2023
My KSP career has stagnated. I can't get enough income from contracts to cover my launch costs. My per launch costs to LKO and back are 20-30k depending on payload size. Is there any way to get in...[More]


What is the maximum stamina in Nier Reincarnation? What is the maximum stamina in Nier Reincarnation?

Posted On: April 15, 2024
What is the maximum amount of stamina you can have at once in Nier Reincarnation?Question from user Stevoisiak at gaming.stackexchange.com.Answer:Stamina maxes out at 999. Any stamina gained after rea...[More]


Is Pokemon Mystery Dungeon: Explorers of Darkness region-locked? Is Pokemon Mystery Dungeon: Explorers of Darkness region-locked?

Posted On: March 24, 2023
I have an Italian 3DS and I've bought a second-hand English Mystery Dungeon: Explorers of Darkness. I should be able to play it, but I can't, and I don't know why. According to this que...[More]


Can a redstone latch in Minecraft Java Edition be supplemented with a toggle function? Can a redstone latch in Minecraft Java Edition be supplemented with a toggle function?

Posted On: April 3, 2023
SR latches and T-flip-flops are trivial circuitry in Minecraft redstone, but it appears that there is little to be found for a circuit that combines both, allowing for both SR and T functionality. ...[More]


How to make the event sound from share button louder? How to make the event sound from share button louder?

Posted On: May 15, 2023
I have a little problem finding something in the settings. I want to make the event sound louder when I take a screenshot over the share button since I can barely hear it. Is it possible to adjust ...[More]


Can I give the naked stalking courier his clothes back? Can I give the naked stalking courier his clothes back?

Posted On: April 8, 2013
The courier who frequently delivers you letters to start quest chains got killed outside of Riften by the guards. Not wanting to let a perfectly good dead body go to waste I decided to loot it, includ...[More]


What video game is played in the movie “Drugstore June”? What video game is played in the movie “Drugstore June”?

Posted On: March 11, 2024
In the comedy film Drugstore June (2024), June’s (Esther Povitsky) brother, Jonathan (Brandon Wardell), is depicted engrossed in a first-person multiplayer team-based video game. .The player charac...[More]


Is it impossible to be a certain rank, say, Gold 3, without having won or drawn against an opposing team where at least 1 player was at least Gold 2? Is it impossible to be a certain rank, say, Gold 3, without having won or drawn against an opposing team where at least 1 player was at least Gold 2?

Posted On: January 26, 2023
Note 1: I think this question is the same for csgo or valorant, but if you want I can double ask this question, 1 for each game. It'll have the same answers anyway I believe. Up to you. To avoid such ...[More]


What is the purpose of a D Flip-Flop in Minecraft? What is the purpose of a D Flip-Flop in Minecraft?

Posted On: October 23, 2023
Based on the design of the circuit and on the description, what is its purpose? It says that it transfers the state of D to Q. This means it can store one bit. But what is the purpose of a D Fli...[More]


Donkey Kong 64 - What do the Chimpy Cam options do? Donkey Kong 64 - What do the Chimpy Cam options do?

Posted On: March 17, 2023
In the options for Donkey Kong 64 I can set Chimpy Cam to either Free or Follow. What's the difference between Free and Follow? Question from user Stevoisiak at gaming.stackexchange.com. Ans...[More]