Spielerando

Find every row and column of three or more in a match-three board

Spotting three in a row sounds like one loop, yet boards with crossing lines, long runs and empty gaps produce double counting and missed pieces. This entry shows a scan that returns each piece once, keeps the line lengths for special rewards, and never matches empty spaces.

Why this works

A match is a run, and a run is a property of a line, so scan each line for runs. A piece can sit in two runs at once, and that is why you count and pay by the pieces removed, not by the runs.

When not to use it

If your game matches by shape, by touching groups of any size, or along diagonals, a scan along straight lines will miss matches. Then search for connected groups of the same piece instead, and decide the minimum yourself.

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
  • 30 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 "Find every row and column of three or more in a match-three board" (read_entry match-run-detection-l-and-t-shapes) 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