A fold is a rigid 180° rotation. If it leaves a gap inside a column, that column's cells are pressed together.
N M; then M lines T X.T: 0=LA, 1=LU, 2=RA, 3=RU. Constraint per step: 1 ≤ X < current columns.
Highlighted = the cells folded in the current step. Use the box above to animate any test case.