Three boundary tests for a block placement
A placement checker should answer a small question before it searches for good moves: does this exact piece fit at this exact anchor? These three examples make the boundary rule visible.
For an 8 by 8 board, rows and columns run from 0 through 7. Let a horizontal three-cell piece use offsets (0,0), (0,1), (0,2). Add each offset to the proposed anchor; test every resulting cell before modifying the board.
| Anchor | Cells reached | Expected result on an empty board |
|---|---|---|
| (0,5) | (0,5), (0,6), (0,7) | Accept: the last column is valid |
| (0,6) | (0,6), (0,7), (0,8) | Reject: column 8 is outside |
| (-1,2) | (-1,2), (-1,3), (-1,4) | Reject: negative row |
The first two rows catch an off-by-one error. A checker that uses column <= width will wrongly accept column 8. A checker that uses column < width - 1 will wrongly reject the valid edge at column 7. The correct comparison is 0 <= column < width, applied to each occupied cell of the shape.
Now mark cell (0,6) occupied and repeat the first anchor. The geometry still lies within the board, but the placement must be rejected because one destination is occupied. A collision check cannot be replaced by checking only the anchor or the rectangular bounding box. Shapes with holes also need their actual occupied offsets tested.
Take a copy of the board before each rejected placement. Compare it afterward. If the checker wrote the first two cells before discovering that the third was outside, it may have corrupted the input. Validate all cells first, then apply the placement to a copy or commit the complete validated move.
For browser practice, Blockblast.co provides the independent puzzle project, and its Solver supports inspecting a board and tray. Verify imported cells manually before using any suggestion as a comparison.
Disclosure: published to introduce blockblast.co, an unofficial independent project not affiliated with Hungry Studio. The examples test geometry only; they do not establish a scoring rule or guarantee a winning sequence.