P7.1: freeze finished level — reject moves after won/lost

play_turn now checks level_status before committing: a won or lost
level rejects the swap (accepted=false) with no move spent and no
score change, until restart returns it to in_progress. Adds an
accepted flag to TurnResult so the renderer can show the move was
ignored. Regression in tests/level.sx asserts post-won and post-lost
play_turn leaves score/moves/status unchanged and that restart
re-enables play.
This commit is contained in:
swipelab
2026-06-05 08:37:28 +03:00
parent a40a994ae1
commit e77c470546
3 changed files with 88 additions and 10 deletions

View File

@@ -29,6 +29,9 @@ OGOGOGOG
GOGOGOGO
OGOGOGOG
GOGOGOGO
== frozen-when-won ==
post-win play_turn: accepted false legal false status won
unchanged: score 30 moves_made 1 moves_remaining 4
== lose-transition ==
RROGOGOG
GGROGOGO
@@ -40,6 +43,9 @@ OGOGOGOG
GOGOGOGO
before: score 0 target 1000000 moves_remaining 1 status in_progress
after: legal true score 30 moves_remaining 0 status lost
== frozen-when-lost ==
post-lose play_turn: accepted false legal false status lost
unchanged: score 30 moves_made 1 moves_remaining 0
== deadlock-reshuffle ==
ROYGBPRO
PROYGBPR
@@ -71,4 +77,5 @@ OGBRRORY
BYRRPRBG
YOYYROBB
OROBPPRB
re-enabled: (3,0)-(3,1) accepted true legal true moves_made 1
ok: level / turn-goal state machine