# 2048 and algebra (Part 2)

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?

To study this question, here’s a graphic showing the first nine moves in a typical game of 2048. I’ve included black circles to highlight the new 2-tiles and 4-tiles that are placed with each successive move, and I’ve added dark red ovals to indicate when two tiles are about to be combined in the next move.

Clearly, for these 9 moves, the computer introduced nine 2-tiles and two 4-tiles (including the two tiles that began the game in the initial position.) So here’s the question: is there a way, from looking only at the final board (with three 2-tiles, one 4-tile, and one 16-tile) and without looking at any of the prior history of the game, to calculate the number of 2-tiles and 4-tiles that were introduced?

In this post, I introduce the first of two insights that will allow us to answer these questions using algebra. (The second insight will be discussed in tomorrow’s post.) To study this question, let’s begin with the final board (with a score of 44 points) and look at how the tiles on the final board were formed.

Clearly, the three 2-tiles do not contribute anything to the final score. Net contribution: 0 points.

The one 4-tile on the final board (marked with a green circle) hypothetically could have either been a new tile that was introduced by the computer or else formed by combining two 2-tiles. In this case, we see that this particular 4-tile was indeed formed by adding two 2-tiles on Move 8. Net contribution: 4 points.

Handling the one 16-tile on the final board is a little more interesting. To begin, this 16-tile was formed from adding two 8-tiles on Move 8. Net contribution: 16 points.

Each of these 8-tiles were formed by adding two 4-tiles (one on Step 4, the other on Step 7). Net contribution: $2 \times 8$, or another 16 points.

Two of the four tiles were formed by adding two 2-tiles (on steps 3 and 6). The other two four tiles were introduced by the computer (on steps 0 and 3) and were moved around the board prior to combining with another 4-tile. Net contribution: $2 \times 4$, or 8 points.

So the total score is 4 points from making 4-tile on the final board and 16+16+8 = 40 points from making the 16-tile on the final board, for a total of 44 points.

This way of thinking about the game… how many points were added for making each tile on the final board… is one of two insights necessary to use algebra to solve for the prior history of the game. After discussing the second insight tomorrow, we’ll be ready to discuss the algebra of 2048.