Files
m3te/tests/expected/collapse.stdout
swipelab b5a3b16651 P2.2: gravity collapse (pure sx)
Add collapse(board): per-column gravity that packs gems contiguously at
the bottom (preserving top-to-bottom order) and bubbles holes to the top,
with no horizontal movement. Returns whether any gem fell, for the P2.4
cascade. Does not refill (that is P2.3).

tests/collapse.sx snapshots gravity over hand-crafted boards exercising
holes in the middle / at the bottom, a full column of holes, a column
with none, a lone gem, an alternating stack, and an already-settled board
(idempotency). Asserts, independently of the dump, that each column's gems
end packed at the bottom in original order with holes above, plus the
exact moved flag. Golden locked in tests/expected/collapse.{stdout,exit}.
2026-06-04 20:21:12 +03:00

79 lines
757 B
Plaintext

== collapse (gravity) ==
== varied ==
before:
RR.R.RR.
.O.O....
.Y.Y..O.
O..GR...
Y..BO.Y.
...RY..R
G..OG.GO
B..YB..Y
after:
...R....
...O....
...Y....
R..GR...
O..BO.R.
YR.RY.OR
GO.OG.YO
BY.YBRGY
== no-holes ==
before:
ROYGBPRO
YGBPROYG
BPROYGBP
ROYGBPRO
YGBPROYG
BPROYGBP
ROYGBPRO
YGBPROYG
after:
ROYGBPRO
YGBPROYG
BPROYGBP
ROYGBPRO
YGBPROYG
BPROYGBP
ROYGBPRO
YGBPROYG
== all-holes ==
before:
........
........
........
........
........
........
........
........
after:
........
........
........
........
........
........
........
........
== settled ==
before:
...R....
...O....
...Y....
R..GR...
O..BO.R.
YR.RY.OR
GO.OG.YO
BY.YBRGY
after:
...R....
...O....
...Y....
R..GR...
O..BO.R.
YR.RY.OR
GO.OG.YO
BY.YBRGY
ok: collapse over hand-crafted boards