27
$\begingroup$

Here's my most recent 2048 game:

final board state

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.

$\endgroup$
3

1 Answer 1

31
$\begingroup$

The sum of the tiles only changes when a new tile spawns; merging tiles doesn't change the sum. But, the sum doesn't tell us how many of the originally spawned tiles were twos and how many were fours. We can deduce this using the score, though, as twos contribute more to the score because additional points were earned merging them into fours.

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$.

As a sanity check, we can look at the expected spawn rate of twos versus fours. From what I understand, twos spawn about 90% of the time, so the calculated rate appears reasonable (assuming each spawn is an independent random event).

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.