The Mathematics of Tetris (2011)
math.stackexchange.com
math.stackexchange.com
The first (And accepted) answer, shows how important it is to account for edge cases! It also shows why legal contracts can be very long.
.....TTT..
......T...
......T...
.......... .XXXXXXXXX
..XXXXXXXX
.XXXXXXXXX
and if you can put a T piece inside of the gap on the left.More generally, any odd number of line clears will reverse the parity of all remaining blocks above, which can be an odd number.