Notice when a match-three board has no move left and find a hint
After pieces fall, a board can look full of colour and still offer no swap that makes a line, and the player sits stuck with no way out. This entry shows how to detect that dead end quickly, which swaps to try, and how the same search gives a hint.
Why this works
A move exists if some swap makes a run, and the number of swaps is small enough to try them all. Trying each swap on a copy and looking only at the lines it touches finds both the hint and the dead end.
When not to use it
If pieces can be moved more freely than by neighbour swaps, such as sliding whole rows or tapping groups, the neighbour search finds the wrong moves. Search the moves your game really offers, and no others.
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
- 45 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 "Notice when a match-three board has no move left and find a hint" (read_entry match-board-deadlock-and-hint) 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