Puzzles: rated training on Lichess Puzzles, with Themes, Hints and a History #440
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
spec
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#449 Include the Puzzle rating and Attempts in the account data export
amaurycoudr/chess-project
Reference
amaurycoudr/chess-project#440
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem Statement
Solution
User Stories
Access
Solving
Puzzle rating
Retry, Hint, solution
Choosing the next Puzzle
Themes
History and Replay
Accounts and data
Operator
Seams
apps/e2e(e2e). Covers 1, 9, 11, 15, 39, 43 in a real browser: a new spec signs in, solves a Puzzle, fails one, sees both in the History, replays one unrated.Implementation Decisions
Domain and docs
GLOSSARY.md), new terms: Puzzle (a FEN, a solution line, a fixed rating and deviation, Themes), Theme (a tag on a Puzzle; the curated Themes are those a Player can pick), Puzzle rating (an Account's Glicko-2 rating, deviation and volatility; always "Puzzle rating", never bare "rating", to leave room for Game ratings), Attempt (an Account's first, rated try at a Puzzle: pending, solved or failed), Replay (any later try; unrated, no Attempt), Hint (highlights the piece to move; fails an Attempt). Flagged ambiguity: Attempt vs Replay.Puzzle source and loading
Game.fromFenand each Move legal) and dropped if it fails.db:puzzlescommand in the API, upserting by Lichess id. Puzzles are product data, not demo data: it runs on every stack, outside the devtools gate (ADR 0039), next to the migrations in each stack's deploy.Lichess line shape
Schema (Drizzle, committed SQL migration, ADR 0031)
Selection
Move checking
status()), which also solves the Puzzle. A correct Move that does not end the line returns the opponent's reply.Glicko-2 module
API contract (
puzzlerouter in@chess/contracts, oRPC)next({ theme? })→ the served Puzzle: id, start FEN, the opponent's first Move, the Player's Color, whether it is an Attempt or a Replay, and the Account's Puzzle rating (with provisional flag). Themes of the Puzzle are not sent before it is resolved, since they give the motif away.move({ puzzleId, move, line? })→ correct (with opponent reply, or solved), or wrong (with the right Move); a resolved Attempt also returns the rating change and new Puzzle rating.lineonly for a Replay.hint({ puzzleId, line? })→ the square of the piece to move; on a pending Attempt it fails it first.solution({ puzzleId, line? })→ the remaining line; fails a pending Attempt. Giving up is the same call.replay({ puzzleId })→ the Puzzle from its start as a Replay.history({ cursor?, failedOnly? })→ a page of Attempts: Puzzle id, start FEN, Puzzle rating, state, rating change, resolved at, last replayed at; cursor-paginated like the Game list.rating()→ the Account's Puzzle rating and provisional flag.UNAUTHORIZEDotherwise). New errors, each inREFUSAL_STATUS: Puzzle not found, no Puzzle left, not replayable (no Attempt yet), Move refused (illegal Move or stale line), unknown Theme.Front
puzzlesslice (ADR 0011), one page file per route (ADR 0043): Puzzles (/puzzles, with the Theme as a search parameter), History (/puzzles/history, with the failed-only filter and cursor), and a Replay route for one Puzzle.beforeLoadguard the account page uses (spec #409), remembering the destination.movableBythe Player's Color, orientation, last Move, checked King; the Hint highlight uses the existing marks. The click logic is the existing pure click resolver.ADRs touched: 0001 (engine facade), 0011, 0012, 0019, 0021, 0025, 0026, 0027, 0030, 0031, 0038, 0039, 0043, 0044. New: the Puzzle rating ADR.
Testing Decisions
rpc-games.integration.test.ts,rpc-game-reads.integration.test.ts(pagination, cursor errors),rpc-demo-seed.integration.test.ts(loading data then reading it),rpc-account-data.integration.test.ts(deletion),rpc-clock.integration.test.ts(an injected root source). Test Puzzles are small hand-written lines in a fixture, not the committed sample.router.test.tsx(mountRouter), the board harness, the route-guard tests from #409.play.spec.ts,my-games.spec.ts,accounts.spec.ts; the e2e stack loads Puzzles, and the injected random source makes the served one known.Out of Scope
Further Notes
to-tickets, thenimplement-spec. A natural order: schema and loader → Glicko-2 module, ADR and glossary → rated training API → Puzzles page → Hints and solution → Themes → History and Replay → e2e.mentioned in issue #441
mentioned in issue #442
mentioned in issue #443
mentioned in issue #444
mentioned in issue #445
mentioned in issue #446
mentioned in issue #447
marked this issue as related to #441
marked this issue as related to #442
marked this issue as related to #443
marked this issue as related to #444
marked this issue as related to #445
marked this issue as related to #446
marked this issue as related to #447
mentioned in issue #448
mentioned in issue #449
mentioned in merge request !554
mentioned in merge request !555