13
$\begingroup$

In the game 2048, you are given a board of tiles bearing numbers which are powers of 2. At each turn, you shift all the tiles in a given direction and are given a new tile; if two tiles bearing the same number are shifted into each other, they coalesce into one bearing the next power of 2, and that new power of 2 is added to your score.

The score is always displayed at the top of the board while you play, but I'm wondering if it can be deduced from the position of the board itself.

Given a particular layout of the board - these tiles bearing these numbers - is there only one possible score? Or could there be two different ways of playing to achieve that final layout, which give rise to two different scores?


(I don't know the answer to this question.)

$\endgroup$
1

3 Answers 3

18
$\begingroup$

No.

Both 2s and 4s can spawn on a turn. So it's possible to have a board with a single 4 and a 2 at the start of the game, or from starting with two 2s, merging them, and having another 2 spawn in.

If only 2s spawn, then yes.

Look at one of the largest pieces, $2^n$: it could only have come from two pieces of size $2^{n-1}$, and it must have yielded $2^n$ points. So we can "split" that largest piece and add $2^n$ to our score counter. Repeating this process allows us to "reverse" the game up to piece position and merge order. Neither of those affected the score, so that gives a unique score.

How?

To see the contribution from any particular piece of value $2^n$, we solve the recurrence relation: $$a_{n} = 2a_{n-1}+2^{n}$$ with initial condition $a_1 = 0$. Solving this through standard methods gives a solution of $a_n = 2^n(n-1)$. The total score is simply the sum of $a_n$ for each tile with exponent $n$.

$\endgroup$
3
  • $\begingroup$ Nice. I'm too lazy to do it but it would be interesting to calculate the possible range of scores (assuming only $2$s and then only $4$s) as well as the average score (assuming 50% of $2$s and 50% of $4$s). $\endgroup$ Commented Apr 1, 2018 at 13:38
  • 1
    $\begingroup$ Aww, is the occurrence of 2s and 4s random? :-( I thought it was somehow determined by what's on the board at the time. $\endgroup$ Commented Apr 1, 2018 at 15:52
  • $\begingroup$ @Randal'Thor it's completely random. I've played it in practice mode, where I can do take backs. I've got stuck several times, where I have had to undo and redo a move trying to get a 4 to appear. $\endgroup$
    – Herb
    Commented Apr 2, 2018 at 2:49
4
$\begingroup$

In the original version of the game, the probabilities for a new tile are 90% 2, 10% 4, as seen in the addRandomTile function in game_manager.js:

var value = Math.random() < 0.9 ? 2 : 4;

Imagine a representative sample of 20 tiles: 18 2's and 2 4's. Combine the 2's and you have 11 4's and 36 points from the 9 4's that you created. So the average value of a 4 tile is 36/11 points.

Use that as the starting point for the recurrence relation and you get

$a_n = 2^n\left(n-\frac{13}{11}\right)$

The average value of the 2048 tile across a large enough number of games is therefore $2048\left(11-\frac{13}{11}\right)$ or 20107.63... points. It's not very far from the 20480 that you'd get if all starting tiles were 2's, because your score is dominated by the points you get from making the big tiles. The points you get from doing 2+2=4 don't matter much.

$\endgroup$
2
  • $\begingroup$ What does the "Q" stand for? $\endgroup$ Commented Apr 1, 2018 at 17:39
  • $\begingroup$ @A.I.Breveleri good letter for a random silly name, I thought $\endgroup$
    – user16792
    Commented Apr 1, 2018 at 17:42
3
$\begingroup$

I think

Yes and No, No you can't know the exact score as well described by @Deusovi - so I am not going to describe it except to say because we start with 2s and 4s randomly appearing we can't know, but we can figure out approximate scores. So yes, your score is generally just about 20000 when you hit 2048 and around 45,000 when you hit 4096 and close to 90000 for 8192. If you get to 2048, you must have scored $$ 2048 + 2*1024 + 4*512 + 8*256+ 16*128+32*64+64*32+ 128 *16 + 256 * 8 + ?*4 = 9 * 2048 +?*4 = 18432 +?*4 \simeq 20000 $$ If you get to 4096, you must have scored $$ 10 * 4096 +?*4 = 40960 +?*4 \simeq 45000 $$ If you get to 8192, you must have scored $$ 11 * 8192 +?*4 = 90112 +?*4 \simeq 90000 $$

$\endgroup$
0

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.