Catch 5App
Could my grandmother's card game live on a phone, and teach someone new to play it?
Parked Development closed; the family plays it.
A Swift and SwiftUI app for playing and learning Catch 5: a standalone rules engine, computer opponents, interactive tutorials, strategy explanations, and save and resume.
264 tests · CI runs on GitHub
The problem
Catch 5 is my family's card game: Pitch with Fives, two partnerships, first to 25, with the family's own house rules, like a 9-and-out bid the dealer may not match. It came down from my grandmother, and it lives in the heads of the people at the table.
Someone new to the family was learning it. At a real table that means four people telling you what to play. I wanted a patient table instead: one that works offline at any hour, lets you take a move back, and explains why a card was right or wrong.
That set the engineering problem. A phone can close the app mid-hand, three computer players must never peek at hidden cards, and every explanation has to match the play it explains.
What I built
- A rules engine with no UI code: dealing, bidding, tricks, scoring, computer players and saving. It imports only the Swift standard library and Foundation, so its tests run on a Mac without a simulator.
- A SwiftUI iPhone app on top, in MVVM. Views talk only to one view model, and that view model is the only UI type that touches the engine.
- Three computer seats on Easy or Standard, or pass-and-play on one phone.
- Hints, a hand review that explains every play, undo, save and resume, and How to play lessons and rule trials that run on the same engine as the game.
- A Swift package with no third-party dependencies, for iOS 17+ and macOS 14+.
Built with Claude Code agents under my direction: 101 of the 133 commits carry a Co-Authored-By: Claude trailer. I set the house rules, played it at the family table and in narrated play-throughs, and turned what I saw into fixes. I keep a numbered log of more than 100 design decisions and why each was made.
Decisions, and what broke
A save is a replay log, not a snapshot
A save holds the shuffled deck, the dealer and every accepted move. Opening the app replays each move through the same rule methods a tap uses, so a resumed game can't show a position the rules would not allow. Undo is the same replay, one move shorter. The cost showed up when a new trump-opening rule arrived: an old game that broke it fails replay, so it is set aside instead of loaded, and every save carries a version.
The computers can't see hidden cards
A computer seat gets a PlayerView: its own cards plus public facts, with no field for anyone else's hand. Its choice goes through the same checked apply as a human tap. A test swaps a hidden opponent card for one from the stock and checks that the decision does not change.
Explanations come from the code that plays
The Standard player's move and its reason come out of one strategy function, so a hint can't drift from the play. Legal cards are sorted into a fixed order first, so the way a hand happens to be arranged can't change the answer. A test replays a whole match and checks every explanation against the card actually played.
Measure the bidding, then change it
At the table the computers kept opening strong hands too low. Three fixes to the point arithmetic moved the benchmark by noise or not at all, so the bidding switched to the family's own floors for each suit shape. The cost, more contracts played and more of them missed, is recorded beside the gain.
A pause that didn't hold
A computer could play while a menu covered the table, because a turn that was already waiting woke up and acted. Every cover now folds into one paused flag that is part of the turn task's identity, so opening a cover cancels the task instead of asking it to check. A test holds the pause while any cover remains.
Proof
- 264 tests, 0 failures
- 93 on the rules engine and 171 on the view model, all in Swift Testing. GitHub runs them on every push to main. CI runs on GitHub
- Win rate 0.647 to 0.675
- The new bidding against a frozen copy of the old computer player, in a mirrored benchmark that swaps the hands between partnerships to cancel out luck. A second seed range went from 0.625 to 0.653, and underbids against the floors fell from 481 to 84. A re-run on 12 October 2026 reproduced the 0.647 baseline exactly.
- Public code
- The repository, the house rules and these screenshots are public. github.com/cmurphy1140/catch-5
Not shown yet
It is not on the App Store; the family plays it, and product work is parked. Nothing yet measures how well a new player learns from it, and the win rate is a benchmark against the earlier computer player, not against people.
What this taught
Separating the rules engine from the interface let the same game logic drive both play and the interactive rule trials, instead of duplicating rules in each.
Built with Swift · SwiftUI



