Files
m3te/tests/expected/clear.stdout
swipelab 6e2a57f3a2 P2.1: holes never match in find_matches
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).
2026-06-04 20:08:26 +03:00

117 lines
1.1 KiB
Plaintext

== clear (detect -> clear) ==
== horizontal-3 ==
before:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GORRROGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
after:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GO...OGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
== vertical-3 ==
before:
OGOGOGOG
GOGOGOGO
OGOGOBOG
GOGOGBGO
OGOGOBOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
after:
OGOGOGOG
GOGOGOGO
OGOGO.OG
GOGOG.GO
OGOGO.OG
GOGOGOGO
OGOGOGOG
GOGOGOGO
== disjoint-runs ==
before:
OGOGOGOG
RRROGOGO
OGOGOGOG
GOGOGOGO
OGOGOGYG
GOPPPOYO
OGOGOGYG
GOGOGOGO
after:
OGOGOGOG
...OGOGO
OGOGOGOG
GOGOGOGO
OGOGOG.G
GO...O.O
OGOGOG.G
GOGOGOGO
== L-and-T ==
before:
OGOGOGOG
GRRRGOGO
OROGOGOG
GRGOGOGO
OGOGOGOG
GOGYYYGO
OGOGYGOG
GOGOYOGO
after:
OGOGOGOG
G...GOGO
O.OGOGOG
G.GOGOGO
OGOGOGOG
GOG...GO
OGOG.GOG
GOGO.OGO
== no-matches ==
before:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
after:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
== holes-no-match ==
before:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GO...OGO
OGOGOGOG
G.GOGOGO
O.OGOGOG
G.GOGOGO
after:
OGOGOGOG
GOGOGOGO
OGOGOGOG
GO...OGO
OGOGOGOG
G.GOGOGO
O.OGOGOG
G.GOGOGO
ok: clear over hand-crafted boards