Case study
Gambit
A daily chess mate puzzle. Every position is a forced mate in two to four with exactly one solving first move, proved twice before it ships.
- Platform
- iOS
- Stack
- SwiftUI · SceneKit · Swift solver
- Status
- Unreleased
- Scale
- 100 tests · a library gated by a reachability audit
The problem
A daily puzzle is only worth solving if it is unambiguous. A mate puzzle with two solving first moves teaches the player that the app is guessing, and a puzzle that mates faster than advertised is worse — it means the position was never checked.
The decision worth defending
Prove it, then prove it again
Every puzzle is verified twice: once by the generator that produced it, and once from its FEN alone by a separate integrity suite that runs as the gate before it ships. The two paths share no code, which is the entire point — a bug in the generator cannot certify its own output.
Decisions
-
Offline first, and completely
There are no network calls anywhere in the app. The library ships in the bundle.
-
The opponent always plays the most stubborn defence
Anything less turns a mate in three into a mate in two by accident.
-
A specialised mate-in-one leaf
The leaf is most of the search tree, only a checking move can mate, and the question about the resulting position is just “any legal reply?” — so it never builds the move array the general loop did.
-
Uniqueness only needs 0, 1 or “more than one”
The scan for mating keys stops at two and skips the rest of the root list. Together with the leaf, and with independent per-worker random streams, this made the deep generator about three thousand times faster than the naive one.
-
Independent worker streams
The old seeding added a multiple of the generator’s own gamma per worker, which yields the same sequence shifted. Every worker was walking one stream and finding one set of puzzles.
Where it stands
Built, playable, and not yet released. The marketing, privacy and support pages live on this domain — Apple rejects submissions whose support and privacy URLs 404, so they resolve before the listing does.
Screens