# 2048: How many turns did I survive?

Here's my most recent 2048 game: Clicking on the image takes you to the 2048 site.

Transcription of board (final score 59612):

2 4 8 4
8 32 64 16
4096 2 512 256
2 8 1024 8

How many turns happened before the game ended? (I promise the answer can be deduced from the information given.)

Rules of 2048:

The board starts with two tiles. Every turn, the player presses an arrow key, and all tiles move in that direction. After that, a tile containing the number 2 or 4 spawns on the board. If two tiles with the same number collide with each other, they merge into a tile with twice that number. Every time a tile is created by merging two tiles with smaller numbers, the number of the created tile is added to the player's score.

• stackoverflow.com/questions/24010027/… is the same Oct 27 at 10:42
• Is it answerable for any configuration? Oct 27 at 13:20
• @IvayloStrandjev I didn't check for cross-site duplicates. Oct 27 at 14:59

First, we calculate the points we know were scored by merging into numbers larger than four. An $$n$$ tile contributes $$n(\log_2(n)-2)$$ points ($$n$$ points upgrading all the $$4$$ tiles to $$8$$ tiles, another $$n$$ points going from $$8$$ to $$16$$, etc). This accounts for a total of $$54688$$ points in the given game meaning the remaining $$4924$$ points were scored by creating $$4924/4 = 1231$$ fours via merging. This means $$1231 \cdot 2 = 2462$$ twos have been merged away. Adding the twos remaining on the board, a total of $$2465$$ twos have spawned in the entire game. We can then calculate the number of fours that spawned from the sum of all the tiles. $$(6046 - 2 \cdot 2465)/4 = 279$$.
Thus, $$279+2465=2744$$ tiles have spawned. If we don't count the two tiles that are spawned before the game starts, $$2742$$ moves have been made.