A profile for rows is a sequence of bits. Instead of storing an array of booleans, you compress this into a single integer from to .
For example, with , profile (binary ) means rows and have protruding cells, while row is clear. This lets you use where ranges over all profiles. Bitmasks make state transitions fast: you can check and modify individual bits with AND, OR, and XOR operations in constant time.