# BOOM! All Clear for Mr. T

In Tetris 99, Mr. T loves performing All Clears, which happen when a piece clears all lines in the playing field. Being a gentleman, he also tries to minimize the total damage he sends to his opponents in the process.

Rules:

• The total damage sent by a piece is the sum of all applicable bonuses:

• An All Clear adds 4 damage.
• When a piece clears multiple lines, a bonus is applied based on the number of lines cleared:

+-------+--------+
| Lines | Damage |
+-------+--------+
|   2   |    1   |
|   3   |    2   |
|   4   |    4   |
+-------+--------+

• When a piece clears a line and all of the last $$n$$ pieces also cleared lines, an $$n$$-combo bonus is applied based on $$n$$:

+-------+--------+-------+--------+
| Combo | Damage | Combo | Damage |
+-------+--------+-------+--------+
|   1   |    1   |   6   |    3   |
|   2   |    1   |   7   |    4   |
|   3   |    2   |   8   |    4   |
|   4   |    2   |   9   |    4   |
|   5   |    3   |  10+  |    5   |
+-------+--------+-------+--------+

• To generate the random piece sequence, the 7 tetriminos are placed in a bag and randomly drawn without replacement. This process repeats for the entire game.

• Mr. T does not use hold or soft drop (pieces are never slid or rotated under each other), and no one ever attacks him. In practise, this means that all the pieces are dropped from above, in the order they occurred.

Now, suppose Mr. T just performed an All Clear.

1. How little damage could he have sent to his opponents this game?

2. How few pieces could he have used to achieve this minimum?

• Umm.. All Clear only adds $4$ instead of $10$? And.. Combo only stops at $5$ and not more? I just knew that :o – athin Mar 29 at 12:34
• @athin It does in Tetris 99. But note that it does not eliminate other bonuses like in other games (where even a tetris PC only sends 10). I believe the upper end of the combo table to be accurate, albeit probably unnecessary for the problem. – noedne Mar 29 at 12:35
• Ah ok, btw is it a total damage since the beginning of the game being asked or just the total damage when performing the All Clear? – athin Mar 29 at 12:40
• @athin Since the beginning of the game. – noedne Mar 29 at 12:41
• Is that how pieces are randomly chosen in the actual game? Because if you could drop pieces in any random order, it would trivially be done with 5 pieces - a square and 4 long pieces, dealing only 4 damage from the All Clear on the second line clear, but then the other pieces are never used, not sure if this was a requirement. – Darrel Hoffman Mar 29 at 14:42

Since a single line doesn't do damage, it is possible to do

no other damage apart from the 4 damage from the all clear.

To achieve this, there are a couple of requirements:

* to avoid the multirow bonus, the last piece must be a horizontal line, and
* to avoid the combo bonus, the next to last piece must not be needed to clear an earlier row, which means that it also must be a horizontal line.

To get these pieces one after the other

The bag must get refilled just before the final piece.

For this to occur so that the final piece also clears the board, we get these constraints on the number of pieces $$X$$:

$$X \equiv 1 \;(\bmod\; 7 \;)$$
$$X \times 4 \equiv 0 \;(\bmod\; 10\;)$$

Given these, the smallest $$X$$ that satisfies both requirements is

15 pieces.

This is a small enough number that it should be relatively easy to find an entire game leading up to the "all clear". Here's a possible game I found after a quick search:

I made sure this position is reachable without combo bonuses by ensuring that each layer has at least two pieces that do not extend to a lower layer. The yellow dashed lines separate the different bagfuls from one another.

(A later, less quick search seems to indicate that I may have been very insightful and/or lucky in my search, since the possible games reaching this particular all-clear don't seem to be that common at all.)

• This is exactly what I'm trying right now but still I couldn't find it.. – athin Mar 29 at 13:26
• Great solve, and nice write-up! I don't think there are too many solutions that work (I only found about a dozen). – noedne Mar 29 at 18:54

As an upperbound, I can attack as little as

$$5$$ damage

with

$$10$$ pieces in total

by following configurations: