GAME LAB 02 · MOVE / ROTATE / COLLIDE
Falling blocks.
Thinking in matrices.
The field is a matrix. Each piece is another matrix. Explore how they meet, rotate, and become one.
01 / THE FIELD MATRIX
0 · empty; 1–7 · figure IDs, preserved after locking.
02 / THE SAME DATA, DRAWN
pixels = COLORS[cells]
The book stores glass[0] (fixed) and glass[1] (active). The combined field chooses the active value where it is nonzero; each resulting ID indexes COLORS. Switching the numeric layer does not change the rendered game.
Point to either field to inspect the matching cell. Coordinates start at 0.
How does a full row disappear?
Keep rows that contain at least one zero. Put equally many empty rows at the top. Both views are redrawn from that resulting matrix. Use the line-clear puzzle to inspect this in two downward steps.
A simplified JavaScript learning model of falling-block mechanics. Python is not executed. No wall kicks or advanced competitive rules.