Add Canfield game variant - #63
Merged
Merged
Conversation
strict classic rules: a thirteen-card reserve with compulsory space fills, foundations built up by suit from a dealt base rank with wrap in both directions, whole-pile tableau moves only, and a draw-three stock with unlimited redeals onto locked foundations. hints follow cached improving lines from a bounded best-first planner whose exhausted search — taps and recycles included — proves a dead position; the probe baseline is 25.0% following every hint vs 1.2% random over 500 deals with zero loops and zero revisits. every other variant's persistence rules now reject cards stranded in the new reserve field, and the macos game menu no longer crashes assembling a digit shortcut for a tenth variant.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #51.
What Changed
GameStategains areservepile (back-compatible decoding) andSelection.Sourcea.reservecase; the shared foundation rule gains a state-aware path for Canfield's base-rank starts. Every other variant's persistence rules now reject cards stranded in the reserve field, mirroring the existing foreign-field guards.CanfieldPlanner, a bounded best-first search over moves and stock taps with a recycle-aware position hash, followed as cached improving lines. Because a tap on the spent stock recycles, an exhausted search is a proof the game is over, so hints go silent there instead of churning a dead stock; only truncated verdicts fall back to a tap.recycleWastefrom the Klondike session file to the shared stock section now that two variants recycle, and fixes a macOS Game menu crash assembling aCharacter("10")keyboard shortcut for a tenth variant (⌘1–⌘9, then⌘0).docs/rules/canfield.md), README rows, in-app rules/terms/scoring, statistics, screenshot fixture, and the hint-probe wiring and ledger row.Why
Canfield (Demon in Britain) is a classic reserve-based patience the app was missing (#51). The implementation follows the printed classic sources over the relaxations common in software — whole-pile moves only, no worrying back, compulsory reserve fills — with the deliberate choices documented in the rules doc.
Validation
all 500study reproduces every existing variant's ledger figure exactly, so the shared-code changes are behavior-preserving outside Canfield.UI Changes