P2.4: cascade resolution loop (pure sx)
Add the settle loop a swap triggers: resolve(board) runs rounds of
detect -> clear -> collapse -> refill until a round finds no match,
returning a Cascade { depth, cleared } so P3 can read per-round
cleared-cell counts and the combo-driving depth. resolve_step exposes
one round. Termination follows from eventually reaching no-match; no
artificial round cap.
tests/cascade.sx: a fixed-seed hand-crafted board where clearing the
initial BBB lets gravity pack col 0 into a fresh vertical RRR, so the
loop chains two rounds; snapshots each per-round board and the final
depth, asserts the final board is stable and that public resolve
reproduces the manual loop, plus a depth-0 control on an unchanged
checkerboard. Locked in tests/expected/cascade.{stdout,exit}.
This commit is contained in:
1
tests/expected/cascade.exit
Normal file
1
tests/expected/cascade.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
30
tests/expected/cascade.stdout
Normal file
30
tests/expected/cascade.stdout
Normal file
@@ -0,0 +1,30 @@
|
||||
== cascade (resolution loop) ==
|
||||
start:
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
RGOGOGOG
|
||||
BBBOGOGO
|
||||
RGOGOGOG
|
||||
ROGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
round 1: cleared 3 cells
|
||||
RBRGOGOG
|
||||
OGOOGOGO
|
||||
GOGGOGOG
|
||||
RGOOGOGO
|
||||
RGOGOGOG
|
||||
ROGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
round 2: cleared 3 cells
|
||||
RBRGOGOG
|
||||
PGOOGOGO
|
||||
YOGGOGOG
|
||||
RGOOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
OGOGOGOG
|
||||
GOGOGOGO
|
||||
cascade depth 2
|
||||
ok: cascade resolves to a stable board
|
||||
Reference in New Issue
Block a user