Add Yukon game variant - #42
Merged
Merged
Conversation
KlondikePlanner and FreeCellSolver carried byte-identical private binary heap implementations, and the upcoming Yukon planner would have added a third. Behavior-preserving: identical comparator and algorithm, verified by identical solve/win-rate probe results pre- and post-migration.
Implements issue #23. Yukon: all 52 cards dealt across seven piles (no stock/waste), Klondike landing rules, and the defining rule that any face-up card moves together with every card stacked on it regardless of order. Rules verified against the three sources linked in the issue. - Game/Yukon/ mirrors the existing per-variant structure: deal, rules, advisor hooks, session scoring (Klondike-style), persistence rules. - YukonPlanner: bounded best-first search over cached improving lines (FreeCell-style keyed lines; per-move re-search oscillates because Yukon moves are reversible). Staged move generation: rollback-free first, full move set including foundation rollbacks only when the first stage exhausts, so a nil hint is an honest verdict and rollback-only rescues are still found. Hints are strict: first move of a verified improving line, or silence. - Probe baselines (500 seeds, release build): 61.8% hint-following win rate vs 0% for greedy-tap and random baselines, zero hint loops, zero exact-state revisits; p95 hint latency ~0ms via cached lines. - Shared code consolidated where variants converged: king-anchored landing rule, face-down tap/flip handlers, stockless configuration, GameState.isWon, advisor king-transfer/flip helpers. - Statistics gain a variant-neutral high score for stockless variants; Klondike keeps its per-draw-mode fields. Layout validation now rejects saves with cards stranded in unrendered free cells. - VoiceOver: tableau accessibility now follows each variant's real pickup rule; exposed face-down tops are elements in Yukon too. - Marketing screenshot fixture, rules document, and README entry.
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 #23.
What Changed
Adds Yukon as a third game variant alongside Klondike and FreeCell, with the same first-class treatment: solver-backed hints, persistence, statistics, scoring, auto-finish, accessibility, tests, rules documentation, and a marketing screenshot fixture.
Rules (verified against the three sources linked in #23 — Wikipedia, cardgames.io, 247solitaire, which agree):
Architecture mirrors the existing per-variant structure (
Game/Yukon/,Views/Yukon/,ComputerSolitaireTests/Yukon/). The one shared-core seam is a fifthAutoMoveAdvisorvariant hook,variantAllowsTableauPickup(Klondike/FreeCell delegate to the existing sequence check verbatim). Where variants genuinely converged, logic was consolidated instead of copied: sharedBinaryHeap(first commit, mechanical), king-anchored landing rule, face-down tap/flip handlers, stockless session configuration, advisor king-transfer/flip helpers, andGameState.isWon.Hint system (
YukonPlanner+ cached lines inHintPlanner):HintPlannercaches each improving line keyed by position (FreeCell's pattern) because Yukon's reversible moves make per-move re-search oscillate.HintPlanner).Statistics:
GameStatisticsgains a backward-compatible variant-neutralhighScorefor stockless variants (FreeCell/Yukon); Klondike keeps its per-draw-mode fields, and the stats screen now only shows draw-mode rows on the Klondike tab.Why
Yukon plays like Klondike's wilder sibling and was the requested next variant (#23). The hint system follows the repo's solver-backed standard rather than heuristics, per the measured-baselines tradition.
UI Changes
New Yukon board (top row is four foundations over tableau columns 4–7; no stock/waste), a Yukon card in Settings, Yukon arms in Rules & Scoring, a Yukon statistics scope, and a single "High Score" row replacing the two Klondike draw-mode rows on FreeCell/Yukon stats tabs.
Validation
Note: probe harnesses are intentionally not committed, matching the existing hint-quality-baseline workflow; figures above are reproducible from
GameStateFixtures.seededYukonDeal.