find_matches walked maximal same-type spans without excluding `.empty`, so a line of 3+ holes (left by a prior clear) was reported as a match. After any vertical 3-clear or L/T clear the board carries such a line, so find_matches / clear_matches returned non-zero on a board with no real gem match — which would prevent the P2.4 cascade from ever stabilising. Fix at the source: a run is only a match if its gem type is not `.empty`. Holes already break runs of real gems (a hole differs from every gem), so this is the only change needed and every caller (P1.3 legality, P2.4 cascade) is now correct. Regression in tests/clear.sx: a holes-only board yields zero matches and clear_matches 0, and re-clearing a holed board returns 0. Other goldens are unchanged (no board without holes is affected).
1.1 KiB
1.1 KiB