Skip to content

Add Yukon game variant - #41

Closed
austin-smith wants to merge 2 commits into
mainfrom
add-yukon-variant
Closed

austin-smith wants to merge 2 commits into
mainfrom
add-yukon-variant

Conversation

@austin-smith

Copy link
Copy Markdown
Owner

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 all three sources linked in #23 — Wikipedia, cardgames.io, 247solitaire, which agree):

  • Seven piles, all 52 cards dealt (1 face-up; then n−1 face-down under 5 face-up per pile); no stock or waste.
  • Klondike landing rules (build down, alternating colors; Kings only on empty piles), but any face-up card moves together with every card stacked on it, regardless of order — only the moving group's bottom card must fit.
  • Foundations by suit Ace→King; exposed face-down cards flip; Klondike-style scoring plus the win time bonus.

Architecture mirrors the existing per-variant structure (Game/Yukon/, Views/Yukon/, ComputerSolitaireTests/Yukon/). The one shared-core seam is a fifth AutoMoveAdvisor variant hook, variantAllowsTableauPickup (Klondike/FreeCell delegate to the existing sequence check verbatim). Where variants genuinely converged, logic was consolidated instead of copied: shared BinaryHeap (first commit, mechanical), king-anchored landing rule, face-down tap/flip handlers, stockless session configuration, advisor king-transfer/flip helpers, and GameState.isWon.

Hint system (YukonPlanner + cached lines in HintPlanner):

  • Bounded best-first search; HintPlanner caches each improving line keyed by position (FreeCell's pattern) because Yukon's reversible moves make per-move re-search oscillate.
  • Staged move generation: a rollback-free search first; the full move set including foundation→tableau rollbacks only when the first stage exhausts its graph — so rollback-only rescues are found, and a nil hint is an honest verdict, not a guess.
  • Hints are strict: every hint is the first move of a verified improving line, or silence (FreeCell keeps its nudge fallback deliberately — its solver misses are usually winnable positions; Yukon's are not, and the asymmetry is documented in HintPlanner).

Statistics: GameStatistics gains a backward-compatible variant-neutral highScore for 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

  • Full unit suite passes (macOS); iOS and macOS builds clean. 24 new/extended tests: deal shape, landing/pickup rule matrix, unordered group moves through the session, same-pile drop rejection, flip-on-expose, scoring deltas, persistence round-trip and layout rejection (incl. stranded free-cell cards), auto-finish candidacy/simulation, planner determinism, loop-freedom of cached lines, rollback-rescue and rollback-only-position hints, truncation vs. exhaustion semantics, deadlock verdicts, and an end-to-end hint-following win on a probe-verified seed.
  • Release-build probe harness (repo tradition, out-of-tree), 500 seeded deals: 61.8% hint-following win rate vs 0% for both greedy-tap and random baselines (theoretical winnability ≈80%); zero hint loops, zero exact-state revisits; p95 hint latency ≈0ms via cached lines (max ~380ms one-off at the search deadline).
  • Klondike/FreeCell regression probes are bit-identical pre/post heap migration and shared-code consolidation (FreeCell 97/100 solves, Klondike draw-1 41/100 on fixed probe seeds).
  • Manual simulator check of the staged Yukon board (deal shape, foundation alignment, HUD).

Note: probe harnesses are intentionally not committed, matching the existing hint-quality-baseline workflow; figures above are reproducible from GameStateFixtures.seededYukonDeal.

🤖 Generated with Claude Code

austin-smith and others added 2 commits July 12, 2026 09:04
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.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@austin-smith
austin-smith deleted the add-yukon-variant branch July 12, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Yukon game variant

1 participant