P3.1: base match scoring by run length (pure sx)
Add a run-enumeration path and base scoring to the pure-sx model, scoring one resolution round's clears purely by maximal-run length. - find_runs(board) enumerates each maximal H/V run (len >= 3) with its length, parallel to find_matches/MatchMask (left untouched so every clear/cascade caller is unaffected). - run_score(len): length 3 -> 30, 4 -> 60, 5+ -> 100 (named constants). - score_round(board): sum of run_score over the current runs (read-only, must be called before the round's clear). L/T rule: each maximal run scores independently by its own length, so an overlapping L/T scores horizontal + vertical (shared corner counts toward both runs). - Board gains a running `score` field (init zeroes it) and add_round_score accumulates a round's base points into it; the cross-round combo multiplier off Cascade.depth is left for P3.2. - tests/score.sx golden over hand-crafted single-round boards asserts exact points for len-3/4/5 runs, disjoint runs (sum), an overlapping L/T, and a no-match board (0).
This commit is contained in:
1
tests/expected/score.exit
Normal file
1
tests/expected/score.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
84
tests/expected/score.stdout
Normal file
84
tests/expected/score.stdout
Normal file
@@ -0,0 +1,84 @@
|
||||
== score (base match scoring) ==
|
||||
== len3-run-30 ==
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GORRROGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
--
|
||||
1 runs
|
||||
H len 3 at fixed 3 start 2
|
||||
points 30
|
||||
== len4-run-60 ==
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GORRRRGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
--
|
||||
1 runs
|
||||
H len 4 at fixed 3 start 2
|
||||
points 60
|
||||
== len5-run-100 ==
|
||||
OGOGOGOG
|
||||
GRRRRRGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
--
|
||||
1 runs
|
||||
H len 5 at fixed 1 start 1
|
||||
points 100
|
||||
== disjoint-30+60+100 ==
|
||||
RRRGOGOG
|
||||
GOGOGOGO
|
||||
GOBBBBOG
|
||||
OGOGOGOG
|
||||
GPPPPPGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
--
|
||||
3 runs
|
||||
H len 3 at fixed 0 start 0
|
||||
H len 4 at fixed 2 start 2
|
||||
H len 5 at fixed 4 start 1
|
||||
points 190
|
||||
== overlap-LT-per-run-120 ==
|
||||
OGOGOGOG
|
||||
GRRRGOGO
|
||||
OROGOGOG
|
||||
GRGOGOGO
|
||||
OGOGOGOG
|
||||
GOGYYYGO
|
||||
OGOGYGOG
|
||||
GOGOYOGO
|
||||
--
|
||||
4 runs
|
||||
H len 3 at fixed 1 start 1
|
||||
H len 3 at fixed 5 start 3
|
||||
V len 3 at fixed 1 start 1
|
||||
V len 3 at fixed 4 start 5
|
||||
points 120
|
||||
== no-match-0 ==
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
--
|
||||
0 runs
|
||||
points 0
|
||||
ok: base scoring over hand-crafted boards
|
||||
Reference in New Issue
Block a user