-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Update checkGameEnd() in BeleagueredCastleScene.ts to use hasValuableMoves() instead of (or in addition to) hasNoMoves() for loss detection. If there are legal moves but none of them are valuable, the game should end just as it does when there are no legal moves at all.
Implementation Approach
- Import the new
hasValuableMovesfunction fromBeleagueredCastleRules.ts. - In
checkGameEnd(), change the loss condition fromhasNoMoves(state)to!hasValuableMoves(state)(which already handles the case when there are zero moves, since that also means no valuable moves). - Alternatively, keep
hasNoMovesand add an additional condition:hasNoMoves(state) || !hasValuableMoves(state). - The overlay message should still be appropriate ('No Moves Available' or similar -- could be updated to 'No Useful Moves' but this is optional).
- Ensure transcript finalization records the correct outcome ('loss').
Note: The isTriviallyWinnable check happens before the loss check. If the game is trivially winnable, auto-complete starts. The valuable moves check only matters for the loss branch.
Acceptance Criteria
- Game ends when only non-valuable moves remain (same as no moves)
- Win detection and auto-complete detection are unaffected
- Overlay, transcript finalization, and game-ended event fire correctly
- Undo from the no-moves overlay still works (restores previous state)
Reactions are currently unavailable