2048 and algebra (Part 6)

In this series of posts, I consider how algebra can be used to answer a question about the 2048 game: From looking at a screenshot of the final board, can I figure out how many moves were needed to reach the final board? Can I calculate how many new 2-tiles and 4-tiles were introduced to the board throughout the course of this game? In this post, we consider the event horizon of 2048, which I reached after about four weeks of intermittent doodling:

2048-0

In the previous posts, we have developed a system of two equations in two unknowns to solve for t and f, the number of 2-tiles and 4-tiles (respectively) that appeared throughout the course of the game.

The first equation,

2t + 4f = \sum T_i,

says that the sum of the tiles that were introduced has to be equal to the sum of the tiles T_i that appear on the final board. Directly adding the sixteen tiles above yields

2t + 4f = 262,140.

This sum can also be calculated using a trick to be discussed in tomorrow’s post.

The second equation,

2(t - t_0) + \displaystyle \sum_{T_i \ge 8} (\log_2 T_i -2) T_i = P,

says that the total number of points P may be divided into the contributions provided by the tiles on the final board. For example, the 16-tile was formed by joining two 8-tiles for 16 points. Each of those 8-tiles were formed by joining two 4-tiles for another 2 \times 8 = 16 points. Added together, the 16-tiles results in 2 \times 16 = (\log_2 16 - 2) \times 16 = 32 points. This analysis does not account for any 4-tiles that were created by adding two 2-tiles. The number of such 2-tiles is t - t_0, where t_0 is the number of 2-tiles that appear on the final board (in this case, t_0 = 0). These additions result in (t - t_0)/2 2-tiles worth 4 \times (t-t_0)/2 = 2(t-t_0) points.

For the board above, this equation becomes

2t + \displaystyle \sum_{T_i \ge 8} (\log_2 T_i - 2) T_i = 3,867,072

and (for this particular board) the sum can be written more simply as

2t + \displaystyle \sum_{n=1}^{15} n \cdot 2^{n+2} = 3,867,072

Directly adding the sum 1 \cdot 8 + 2 \cdot 16 + 3 \cdot 32 + \dots + 15 \cdot 131,072 — and being very careful to double-check the arithmetic — yields the second equation

2t + 3,670,024 = 3,867,072

This sum can also be calculated using a trick to be discussed in a future post.

Solving, we find

2t = 197,048

t = 98,524

Substituting into the first equation:

2 \times 98,524 + 4f = 262,140

197,048 + 4f = 262,140

4f = 65,092

f = 16,273

So we conclude that 98,524 2-tiles and 16,273 4-tiles were introduced to the board. Stated another way, about 85.8% of the new tiles were 2-tiles, while about 14.2% of the new tiles were 4-tiles. Also, since two tiles were on the board before any moves were made, a total of 98,524 + 16,273 - 2 = 114,795 moves were needed to reach the above board.

Leave a comment

1 Comment

  1. 2048 and algebra: Index | Mean Green Math

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: