2048 and algebra (Part 5)

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?

2048-6

(The above board is the only picture I currently have of reaching 4096 without using an undo — the version of the game that I had at the time permitted two undos per game. I have also reached 8192 in game mode — I was really lucky that day — but I sadly don’t have a screenshot to memorialize the occasion.)

In the previous post, I used two insights  to develop of a system of two equations in two unknowns. Let t and f denote the number of 2-tiles and 4-tiles, respectively, that were introduced by the game. The sum of the tiles on the final board must also be the sum of the 2-tiles and 4-tiles that were introduced during the course of the game. Therefore,

2t + 4f = 3 \times 2 + 3 \times 4 + 2 \times 8 + 16 + 4096

2t + 4f = 4146

Next, we consider how the total of 44,148 points was reached by looking at the final tiles.

  1. Each 8-tile was formed by joining two 4-tiles (for 8 points). Some of those 4-tiles were added by the computer; others were formed by joining two 2-tiles (for 4 points each). So each 8-tile is worth 1 \times 8 points, plus 4 times some undetermined number.
  2. Each 16-tile was formed by joining two 8-tiles (for 16 points). Each of those two 8-tiles was formed by joining two 4-tiles (for 8 points for each 8-tile, or 2 \times 8 = 16 more points). Again, some of those 4-tiles were added by the computer; others were formed by joining two 2-tiles (for 4 points each). So each 16-tile is worth 16 + 16 = 2 \times 16 = 32 points, plus 4 times some undetermined number.
  3. There are no 32-tiles on this board. However, to continue the pattern, any 32-tiles are formed by joining two 16-tiles (for 32 points). Each of those two 16-tiles was formed by joining two 8-tiles (for 16 points for each 16-tile, or 2 \times 16 = 32 more points). Each of those four 8-tiles was formed by joining two 4-tiles (for 8 points for each 8-tile, or 4 \times 8 = 32 more points). Again, some of those 4-tiles were added by the computer; others were formed by joining two 2-tiles (for 4 points each). So each 16-tile is worth 32 + 32 + 32 = 3 \times 32 = 96 points, plus 4 times some undetermined number.
  4. By now, the pattern should be clear. Any 64-tile on the board would contribute 4 \times 64 = 256 points, plus 4 times some undetermined number (as a reminder, the number of 4-tiles formed by adding in the course of making the 64-tile).
  5. Any 128-tile on the board would contribute 5 \times 128 = 640 points, plus 4 times some undetermined number.
  6. And, in general, a 2^n-tile would contribute (n-2) \times 2^n points, plus 4 times some undetermined number.
  7. In particular, when n = 12, a 4096-tile would contribute 10 \times 2^{12} = 40,960 points, plus 4 times some undetermined number.

In summary, for the above board, there are:

  • Three 4-tiles (for 4 times some undetermined number),
  • Two 8-tiles (for 2 \times 8 = 16 points plus 4 times some undetermined number),
  • One 16-tile (for 32 points plus 4 times some undetermined number), and
  • One 4096-tile (for 40,960 points plus 4 times some undetermined number).

Adding, this board will have 16 + 32 + 40,960 = 41,008, plus 4 times some undetermined number.

What is this undetermined number? It is the number of 4-tiles that are formed by combined two 2-tiles throughout the course of the game thus far. Since t is the number of 2-tiles that have appeared and there are three 2-tiles on the board above, we conclude that t-3 2-tiles have been combined into (t-3)/2 4-tiles throughout the course of the game, resulting in 4 \times (t-3)/2 = 2(t-3) points. Therefore, we have the second equation

41,008 + 2(t-3) = 44,148

Let’s start solving:

2(t-3) = 3,140

t -3 = 1570

t = 1573

Substituting into the first equation:

2 \times 1573 + 4f = 4146

3146 + 4f = 4146

4f = 1000

f = 250

So we conclude that 1573 2-tiles and 250 4-tiles were introduced to the board. Stated another way, about 86.3% of the new tiles were 2-tiles, while about 13.7% of the new tiles were 4-tiles. Also, since two tiles were on the board before any moves were made, a total of 1573 + 250 - 2 = 1821 moves were needed to reach the above board.

One thought on “2048 and algebra (Part 5)

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 )

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.