Repository navigation
Disable puzzles with too few alternative moves so they're no longer served - #786
Conversation
|
@copilot resolve the merge conflicts in this pull request |
|
@copilot Add a column in puzzle table for date of insertion. For existing puzzles, check in changelog.html for an appropriate date, that would be around 3 years ago. |
Co-authored-by: benckx <8626080+benckx@users.noreply.github.com>
Added changeSet |
…lidation' into copilot/add-puzzle-check-loop-validation
# Conflicts: # webapp/src/main/resources/templates/about/changelog.html
|
@copilot resolve the merge conflicts in this pull request |
…eck-loop-validation # Conflicts: # webapp-dao-migration/src/main/resources/liquibase-changelog-generation.xml # webapp-dao-migration/src/main/resources/liquibase-changelog.xml # webapp/src/main/resources/public/css/puzzles.css Co-authored-by: benckx <8626080+benckx@users.noreply.github.com>
Merged
|
Some puzzles start in check with only forced replies, letting players get stuck in a perpetual-check loop when they deviate from the recorded solution (e.g.
3oY3UwhN,ohT0nTBS). This adds a way to detect such puzzles, flag them, and exclude them from assignment.Schema
0108adds a nullabledisabled_attimestamp topuzzle(a puzzle is disabled whendisabled_atis set); regenerated the codegen changelog.Detection
PuzzleSolvabilityValidator.hasEnoughMovesAtEachPlayerStep(...)(located in thescripts/puzzlespackage, not the service layer): replays setup + solution moves and requires ≥MIN_LEGAL_MOVES_PER_STEP(3) legal moves at every player turn. The player is the side to move after setup; opponent turns are skipped.DisablePuzzlesWithoutEnoughMovesscript (in thescripts/puzzlespackage) iterates all puzzles and setsdisabled_at = now()for those that fail the check.Serving
PuzzleCachekeeps a booleanenabledper entry, derived fromdisabledAt == null.PuzzleCache.randomIdnow selects only from enabled entries. The cache still loads disabled puzzles, since they're needed for by-id lookups and played-puzzle history.UI
enabledflag is now surfaced throughPuzzleResponseand the client-sidePuzzleDto. The puzzles page shows a warning icon next to the puzzle id when a disabled puzzle is loaded (e.g. via a by-id link), with a tooltip explaining it is no longer served.Rating
processOutcomechecks the puzzle'senabledflag from the cache and applies a no-op transfer (ratings left unchanged) when the puzzle is disabled.Notes
randomIdthrowsNoSuchElementException, already handled upstream as "Puzzle cache not ready yet".