A Deeper look into Tetris

Optimal stacking in the favourite, albeit frustrating, puzzle game of Tetris relies on much more than finger speed, writes student actuary Cuong Duong.

First-year math lectures were never my thing – after begrudgingly noting down one abstract concept after another, I craved any sort of application that would prevent me from dozing off. In particular, my mind often wandered to the optimization strategies used in everyone’s favourite, albeit frustrating, puzzle game – Tetris.

Tetris seems simple enough; the objective of the game is to stack pieces (made from four square blocks) atop one another to clear rows, with a four row clear called a “Tetris”. In newer versions of the game, a popular single-player mode known as Sprint requires players to clear 40 rows as quickly as possible. To a regular observer, faster clear times for this mode seem to depend solely on finger speed, but the fastest players actually pay more attention to the efficiency of their key presses.

The “theorem” used by these players’ states that every piece can be placed in a certain position (and a certain orientation) on the grid with at most two left/right movements. Surely, if the grid is 10 units wide, and the minimum width of a piece is two, this shouldn’t be possible! Let’s consider this case: we want to move the green piece to the outline.

Tetris1

The intuitive process would be to rotate the piece, tap right three times, then drop, because this would allow the piece to travel the minimum distance. But how quickly the piece reaches its destination will depend heavily on how quickly the right arrow is pressed.

When pieces are able to slide rapidly across the grid by holding either left or right, a quicker way to perform this movement is in fact:

Tetris2

By letting the piece slide to the wall, it takes less time than two right key presses, and even though the piece is travelling a longer distance, it still reaches its destination in a shorter time. The “theorem” is also shown to be true – we have achieved the position using two movements (right and left are only pressed once each).

Now let’s extend this idea of efficiency to two-player multiplayer VS modes. Here, any rows cleared on one person’s field will be added on as “garbage” to their opponent’s field (picture shown); and the aim of the game is to force one’s opponent to the top of their field.

Received 4 rows of “garbage” (grey blocks) from opponent.
Received 4 rows of “garbage” (grey blocks) from opponent.

A logical and the most common approach to winning is to send as many rows as possible, as quickly as possible, in order to overwhelm the opponent.

Although this generally works, consider a case where we, and our opponent, have stacked four rows ready to clear. In adopting the aforementioned mindset, both parties would send their rows at the same time, meaning the attacks “cancel” out and neither field is affected.

However, the ideal move for us is to continue stacking and wait for our opponent to send their four rows first.

Why? A close look at the “garbage” in the diagram reveals an open column which allows the garbage to be cleared easily. Therefore, after clearing our own rows, we will be able to clear the garbage with a single line piece and effectively send that garbage back to the opponent.

If we compare the number of pieces it took our opponent to set up their “Tetris” vs. the one line piece used on our garbage to perform the same feat, the latter is much more efficient – less pieces are being used to send the same number of rows.

Additionally, as we will be sending our own rows at the same time, the large “spike” in rows being added to the opponent’s field would push their field extremely close to the top. With one efficient move, we’ve almost won the game.

Don’t believe these strategies work? Log on to Tetris Friends or Tetris Battle and try them out! After enough experience playing the game and uncovering its mechanics, you may find yourself developing your own optimization strategies.

CPD: Actuaries Institute Members can claim two CPD points for every hour of reading articles on Actuaries Digital.