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.
82 lines
1.6 KiB
Plaintext
82 lines
1.6 KiB
Plaintext
== level (turn / goal state machine) ==
|
|
== start-in-progress ==
|
|
RRPPOGRG
|
|
PGPOPRRO
|
|
YYBBYRYB
|
|
GBYYRGGP
|
|
OGBRRORY
|
|
BYRRPRBG
|
|
YOYYROBB
|
|
OROBPPRB
|
|
score 0 target 1500 moves_remaining 30 status in_progress
|
|
== win-transition ==
|
|
RROGOGOG
|
|
GGROGOGO
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
before: score 0 target 30 moves_remaining 5 status in_progress
|
|
after: legal true awarded 30 reshuffled false
|
|
after: score 30 moves_remaining 4 status won
|
|
RBRGOGOG
|
|
GGOOGOGO
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
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
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
OGOGOGOG
|
|
GOGOGOGO
|
|
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
|
|
BPROYGBP
|
|
GBPROYGB
|
|
YGBPROYG
|
|
OYGBPROY
|
|
ROYGBPRO
|
|
PROYGBPR
|
|
before: matches 0 legal_swaps 0 has_legal_swap false
|
|
reshuffled true matches 0 legal_swaps 9
|
|
after: score 0 moves_made 0
|
|
BGGYORYR
|
|
RRYGOPBY
|
|
YRYBPRGB
|
|
OOBGBPRG
|
|
RPRPYRPO
|
|
OBBPOOPG
|
|
OBGGOPGY
|
|
YPRYBORP
|
|
== restart ==
|
|
dirty: score 500 moves_made 7 status in_progress
|
|
after restart: score 0 moves_made 0 moves_remaining 30 status in_progress
|
|
RRPPOGRG
|
|
PGPOPRRO
|
|
YYBBYRYB
|
|
GBYYRGGP
|
|
OGBRRORY
|
|
BYRRPRBG
|
|
YOYYROBB
|
|
OROBPPRB
|
|
re-enabled: (3,0)-(3,1) accepted true legal true moves_made 1
|
|
ok: level / turn-goal state machine
|