Skip to content

Add game mode switcher with per-game sessions and statistics - #53

Merged
austin-smith merged 6 commits into
mainfrom
game-mode-switcher
Jul 13, 2026
Merged

austin-smith merged 6 commits into
mainfrom
game-mode-switcher

Conversation

@austin-smith

Copy link
Copy Markdown
Owner

What Changed

  • New GameMode identity: every playable configuration (Klondike 1/3-card, Spider 1/2/4 suits, FreeCell, TriPeaks, Pyramid, Yukon) is a distinct game with its own save slot and statistics bucket, ordered by game-type popularity everywhere
  • Board header shows the current game as a felt-set title (KLONDIKE · 3-CARD, qualifier dimmed) that opens a centered drill-in picker: a gallery of six games with schematic board art, mode rows for multi-mode families, and a "Won" badge as the only status marker
  • Switching stashes the outgoing session and resumes the target's — timers freeze while stashed, statistics never record a switch, and the switch aborts if the stash fails to persist
  • Draw-mode and suit-count options moved out of Settings into the picker; the macOS Game menu gets game switching with ⌘1–⌘6
  • One-shot migrations: saved-game records re-key to per-mode slots; pooled Klondike and Spider statistics split into per-mode buckets (marked with removal TODOs)
  • Fixed cross-variant view re-evaluation crashes (Pyramid, Spider, and TriPeaks boards indexed variant-sized state arrays during switches)
  • Statistics reset now reaches stashed sessions; restored paused sessions resume correctly; Esc dismisses the picker; short windows scroll the picker

Why

Game switching was buried at the bottom of Settings and destroyed the game in progress — the abandoned game was recorded as a loss and its board lost forever. With six games (and more planned), switching needed to be first-class, safe, and identity-preserving.

Validation

  • Full macOS unit suite passes, including new coverage: activation/stash-resume semantics, record and statistics migrations, tracking invalidation for stashed sessions, and mismatched legacy draw-count bucketing
  • New macOS UI tests pass: Esc dismissal, short-window reachability (pinned 900×420 window, scroll to last game and switch)
  • Simulator verification across all six games: switch round-trips restore identical boards with frozen timers; no crash reports after the board-view fixes

UI Changes

Felt-set game title with dimmed mode qualifier on the board; drill-in game picker overlay with per-game schematic board art; stat strip flattened to typographic tiles; header title moved to its own row on all platforms

every playable mode (klondike draw counts, spider suit counts, single-mode
variants) is now a first-class game with its own save slot and statistics
bucket. switching games stashes the outgoing session and resumes the
target's exactly where it left off, with no statistics penalty. the
switcher is a felt-set title on the board opening a drill-in picker;
per-mode options leave settings. one-shot migrations carry legacy saves
and pooled klondike/spider statistics forward. also fixes cross-variant
view re-evaluation crashes during switches and unifies the header layout.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e2aa61a01c

ℹ️ 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".

Comment thread ComputerSolitaire/Views/Shared/ContentView.swift Outdated
the seven-segment scope picker could not scale past a handful of games
and hid cross-game comparison. statistics now opens as an overview —
aggregate highlights plus one row per game with games played and win
rate — drilling into each game's full breakdown, where the mode
sub-picker (draw counts, suit counts) remains. opening mid-game deep
links to the current game's detail.
settings write to storage immediately while payloads save on a debounced
autosave, so the stored mode can lag the legacy single-slot save by one
change. the record migration now reports the mode of the game it moved
out of the legacy slot and first hydration opens that game, re-syncing
the stored selection — matching the old builds' payload-first restore.
@austin-smith

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75e029e7a4

ℹ️ 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".

Comment thread ComputerSolitaire/Views/Shared/ContentView.swift Outdated
@austin-smith

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b74fea6bd8

ℹ️ 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".

Comment thread ComputerSolitaire/Views/Shared/ContentView.swift Outdated
the pooled klondike/spider bucket splits assign history to the mode in
active use. the game migrated out of the legacy single slot is the mode
the old build would itself reconcile to on relaunch (payload-first
write-back), so its qualifier steers its family's split; stored settings
still steer the other family's.
@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. Breezy!

Reviewed commit: 81e61f4219

ℹ️ 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 2783501 into main Jul 13, 2026
2 checks passed
@austin-smith
austin-smith deleted the game-mode-switcher branch July 13, 2026 07:15
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.

1 participant