Skip to content

Add TriPeaks game variant - #52

Merged
austin-smith merged 2 commits into
mainfrom
tripeaks-variant
Jul 13, 2026
Merged

austin-smith merged 2 commits into
mainfrom
tripeaks-variant

Conversation

@austin-smith

@austin-smith austin-smith commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Closes #43.

What Changed

  • New TriPeaks variant following the established per-variant kit: TriPeaksGeometry (three overlapping peaks — face-down rows of 3/6/9 over a face-up base row of 10, with shared boundary base cards), GameRulesTriPeaks (play any uncovered card one rank above or below the waste top, suit ignored, ranks wrapping K↔A↔2; face-down cards flip automatically once uncovered), GameSessionTriPeaks, AutoMoveAdvisorTriPeaks, GamePersistenceTriPeaks, and TriPeaksPlanner.
  • Scoring uses the conventional chain scheme: the n-th consecutive discard scores n, a stock flip costs 5 and resets the chain, clearing each of the first two peaks pays 15 and the third (always the board clear) pays 30, plus the standard win time bonus. The stock allows a single pass with no recycles.
  • Hints come from an exact solver: a plays-first depth-first pass over a collision-free 37-bit packed position (board mask, draws used, waste-top rank) with an exact transposition set. One pass yields a winning line, or on unwinnable deals both a proof and the exact max-clear line, which hints then follow. HintPlanner caches lines per position like the other variants.
  • Shared integration: GameVariant.tripeaks plus the corresponding cases across state, session, interaction, persistence validation (including stranded-card guards in every other variant's validator), tap policy, statistics, rules screen, and the settings switcher.
  • StockView/WasteView moved from Views/Klondike/ to Views/Shared/StockWasteViews.swift — they serve Klondike, Spider, Pyramid, and now TriPeaks. The TriPeaks waste is a match target rather than a mover, so WasteView gained an isTapEnabled knob that also drops the VoiceOver button trait and declared interactivity when off.
  • Hint probe: seeded TriPeaks deal, hint-following player with a strict revisit gate, random control, and recorded baselines.
  • Rules documentation: docs/solitaire-rules-tripeaks.md in the established per-variant format (implemented rules, explicit rule choices vs disagreeing sources, solver notes, measured baselines), linked from the README variant table.

Why

TriPeaks is one of the most-played solitaire variants, rounds are fast, and its small perfect-information deals suit the solver-backed hint system unusually well — hints are verified lines rather than heuristics, including flip timing, which is most of the strategy.

Validation

  • Full unit test suite passes (five new TriPeaks suites: geometry, rules, session, persistence, planner — including probe-verified winning and proved-unwinnable seeds).
  • Hint probe over 500 seeded deals: 95.4% wins following every hint vs 0.0% for the random control, zero stalemate loops, zero action caps; lost deals still clear a median 27 of 28 cards. Solver sweep over 10,000 deals: 95.6% proved winnable, 0.2% proved unwinnable, 4.1% undecided at budget; bestLine median 0.07 ms. Baselines recorded in the probe ledger.
  • Simulator end-to-end: dealt board, tap-to-play with auto-flip, chain and flip scoring verified against the HUD, stock-tap hint highlight, and a complete 44-move hint-guided game to the win cascade.

UI Changes

  • New three-peak board and stock/waste top row, win cascade launching from the waste, TriPeaks sections in Rules & Scoring, a TriPeaks statistics scope, the settings Game Type chip, and a bundled App Store screenshot fixture.
  • Known pre-existing issue, deferred: the Game Type chip row and Statistics scope picker truncate titles on compact iPhone widths now that six variants share the fixed row.

three-peak layout with rank-adjacent wrap matching, chain scoring, single-pass stock, and exact solver-backed hints validated by the hint probe
@austin-smith

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: f28a7702bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@austin-smith
austin-smith merged commit f220e6b into main Jul 13, 2026
2 checks passed
@austin-smith
austin-smith deleted the tripeaks-variant branch July 13, 2026 04:18
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 TriPeaks game variant

1 participant