Solving the 2048 tile game

I have working pretty hard on multiple projects recently, and that’s why I haven’t got the time to document my experiments with Cubieboard 2, but rest assured a good number of blog posts are coming up on that front.  However, I picked up this game from the internet called the 2048-tile game. Its a pretty neat (and addictive game) you can find the link here.

Here is the jist of what the game is – you have a 4*4 tile board and begins with 2 tiles with the number “2” on them. You can use the arrow keys to move all the tiles on the board in the 4 directions. Two tiles with the same number with combine to form a new tile with the next power of two, when they move in the direction you want them to.

Also, with every direction move, the game spawns a random “2” or “4” in one of the empty spaces on the board.


As an example, I have shown the starting frame, and the frames after the first move in the left directions and the second move in the downward direction, notice how the tiles of 2 combine to make a tile of 4. You win the game when you reach the 2048 tile; or if you run out of space to move (the more likely possibility). Its more difficult than it sounds, not to forget, the game is very addictive. 

A lot of people I know, have played the game, but not many have succeeded in reaching to the 2048 tile (If github is to be believed, even the creator himself hasn’t finished the game yet.) The one thing I realized that was always messing up my game was these godforsaken tiles coming up from all directions and blocking by bigger tiles – and it forced me to take another route which took a lot of space on the board. So I figured that restricting the directions from which the tiles could block would be very crucial to the solution.

A simple way to do the above would be to restrict all your movement to the bottom side of the board and never pressing the up direction, just use the lefts and rights and downs to manoeuvre the tiles as much as you can. There will be a few instances where you will have to use the up direction thus causing a disruption if a 2 or 4 blocks your tiles – but its still possible to control single anomalies.

The second step that you need to take is to ensure that the you block the bottom left corner for the tile with the highest power of two, and the subsequent tiles in the bottom row arranged in the descending order. This is very important – because you will soon realize that when you do this, a single tile can sweep away all tiles taking you to the next higher power of two – making your path and hence your movements defined at any point of time – basically at any point in the game, you would be concentrating in making a power of two sufficient enough to trigger a chain reaction of geometric progressions.

A few pictures will make this clearer:


The above picture is an example of this strategy, I kept the all my movements devoid of the up button, and concentrated on keeping the highest tile in the corner with the bottom row in the descending order. If you notice the images, all it will take in say the first image is a tile of 32 to introduce the 256 tile, similarly you see the strategy being applied in the subsequent images as well.

It takes time, but once you have the flow going you know what particular tile to focus on next and once you do that, the entire game becomes a series of local problems.

And now for the winning set of tiles (Narcissistic ego boost ):


I have tried this strategy, and have reached the end goal three times. It seems like a strategy that is reproducible and seems logical that it will work. However, I am trying to see if the problem can be formalized in mathematical terms, and hence the solution would be a formal one as well.

  1. Shreesh Katyayan said:

    Reblogged this on Unleashed! and commented:
    Ahh!! This has a solution too 😮 All I tried was brute force :p

  2. bharathkola said:

    Thanks a lot!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: