In a sliding-block traffic jam, blocks must not jump over each other
When a block is dragged several squares at once, checking only where it lands lets it hop over a neighbour and ruins every puzzle built on it. This entry shows what to test along the way, how the block is limited to its own direction, and when the board counts as cleared.
Why this works
A block moves through every cell on its way, not just the one it lands on. Legality is a property of the whole path, so you step through the path one cell at a time and stop at the first thing in the way.
When not to use it
If blocks can turn, lift off, or the player flicks them with speed and they slide on their own, cell steps are the wrong picture. Then use the movement the game really has, and test its collisions directly.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 4 common mistakes and the fix
- A diagram of every state
- 38 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "In a sliding-block traffic jam, blocks must not jump over each other" (read_entry sliding-block-car-move-legal) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP