2048 game Sivaram Ambikasaran
SI VA RA M
Those who have played/won the 2048 game will soon realize that the 2048 tile is by no means the upper bound. An average player with reasonably sufficient time can easily reach 4096 tile (Figure 1(a)). So the question is “What is the upper bound of the maximum tile?” The answer to this is evident for those who have developed a strategy to play the game. (It is worth recalling that the key fact that the game exploits is 2k + 2k = 2k+1 .) One of the popular strategies is to form the maximum tile at one of the four corners of the board. A loose motivation behind this strategy is that fixing the tile at one of the corners gives us two degrees of freedom (most of the time) under which the maximum tile won’t move, thus making it easier to focus on the rest of the board. Any other location for the maximum tile will result in moving the maximum tile more frequently. Once we have our maximum tile, say M , at some corner, the strategy then is M M , and so on in a snake to populate the board going either row-wise or column-wise with tiles of value 2 4 like fashion (for instance, as shown in Figure 1(b) for a 4 × 4 case, with the maximum tile being formed at the top-left and subsequent tiles being arrange row-wise in a clock-wise fashion). M
M/2 M/22 M/23
M/27
M/26 M/25 M/24 M/211 8 9 10 M/2 M/2 M/2 ♠
(a) An occasion of 4096 appearing
M/214M/213M/212
(b) A possible strategy
If the randomness were to favor us, we would like to have ♠ to equal M/214 and the maximum value M of ♠ is 4. Hence, we need 14 = 4 =⇒ M = 216 . Once we have this, we have the domino effect and the 2 maximum tile that can be obtained is 2M = 217 at the top left corner. The more general setting: Given an n × n × · · · n hypercube with 2, 4, . . . , 2k ’s appearing at random, what is the maximum hyper-tile | {z } d times
that can be reached? By the same strategy, the answer is when
M 2nd −2
= 2k =⇒ M = 2n
d
d
+k−2
and the maximum tile that
can be formed is 2n +k−1 . For the usual game, with 2’s and 4’s appearing at random, we have n = 4, d = 2 (hypercube in 2D is a square) and k = 2 (4 = 22 ), giving the maximum tile as 217 .
1
Maximum score and maximum number of moves on a n × n square: The user’s score starts at zero, and is incremented whenever two tiles combine, by the value of the new tile. For instance, if a user reaches tile 4 making use of two 2’s, then the score increments by 4. Similarly, if a user reaches 8 making use of only 2’s, then the score would be 8 + 2 × Reaching 4 using two two’s = 8 + 2 × 4 = 16 In general, if S(m) denotes the increment in score on reaching a tile 2m , we have S(2m ) = 2m + 2S(2m−1 ) with S(21 ) = 0 Hence, we get S(2m ) = 2m + 2m + 22 S(2m−2 ) = (m − 1)2m + 2m−1 S(2) = (m − 1)2m
SI VA RA M
Hence, in the process of reaching the tile 2m , the maximum increment to the score is (m − 1)2m . However, when we want to reach the maximum tile, we would want the randomness to throw 4 at the bottom-left square at the critical step and we do not get a score of 4 for forming this. Hence, the score we obtain in the process of reaching the maximum tile is (m − 1)2m − 4. Once we have reached the maximum tile at the top-right square, to reach the maximum score the goal is to form half of this tile at the square to its immediate left and so on. Hence, the total score is 2 nX +1
2 (m − 1)2m−1 − 4 = 4 2n − 1 n2 − 1
(♠)
m=3
For the usual game played on 4 × 4 square, the maximum score is obtained by setting n = 4 in (♠), which gives us the maximum score of 3, 932, 100 . By a similar argument, if M (m) denotes the number of moves needed to reach a tile of 2m , then we have M (2m ) = 1 + 2M (2m−1 ) with M (2) = 0
Solving this recurrence gives us M (2m ) = 2m−1 − 1. Hence, in the process of reaching the tile 2m , the maximum number of moves we would have made is 2m−1 −1. However, when we want to reach the maximum tile, we would want the randomness to throw 4 at the bottom-left square at the critical step and we do not make a move to get this 4. Hence, the number of moves made to reach the maximum tile is 2m−1 − 2. Once we have reached the maximum tile at the top-right square, we can still make valid moves as discussed above. Hence, the maximum number of possible moves is 2 nX +1
2 2m−1 − 2 = 2 2n − n2 + 1
(♦)
m=3
For the usual game played on 4 × 4 square, the maximum number of moves is obtained by setting n = 4 in (♦), which gives us the maximum number of moves as 131, 038 . Similar expressions can be obtained for n-hypercube with 2, 4, . . . , 2k ’s appearing at random.
2