Repository navigation
docs: three-player cuttle (cutthroat) architecture and Phase 1 spec - #1490
itsalaidbacklife wants to merge 5 commits into
Conversation
Design doc for a 1v1v1 "Cutthroat" variant. No code changes. Covers the architecture decisions (share Game/GameStateRow/Match rather than forking; share effect helpers and fork only the game-loop policy), the settled rules decisions, and a fully specified Phase 1 of two-player-safe groundwork. Phase 1 is independently valuable: it fixes defects that already exist but are unobservable at two players, where the alternation they rely on is accidentally correct. Notably jack ownership is derived by parity at pack time rather than stored, so a three-player stack is structurally inexpressible, and several resolve helpers identify a one-off's victim by inverting the resolver's pNum. Also records that the legacy jack suffix does not mean what GameStateRow.js and game-state-api.md claim: the emitted list is the true ownership sequence shifted one position, which has gone unnoticed because the suffix is parsed and discarded. Correcting that documentation is part of the work. Includes an exhaustive sweep of two-player assumptions across api/ and src/, classified by file and line, as an implementation checklist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…indings Glasses now reveal every other player's hand to all players, persisting as under rules 5.0.0. With the four's reveal and the empty-deck reveal also public, cutthroat has no private knowledge, so revealed state stays one global set and two-player behavior is unchanged. The rule lives in update-revealed-cards.js (handled in 1e), not in socket fan-out as 1f previously claimed. Re-ran the two-player assumption sweep as a per-file coverage check. The pattern grep had missed two shapes with no ternary or modulo: pairwise-by-name code (update-revealed-cards.js) and seat enumeration. The latter includes two fail-open seat checks, get-game.js and spectate/join.js, which would put a seated third player in the spectator room with full visibility of every hand and the deck order. Phase 2 now calls for a single seatOf helper and treats a seated player in the spectator room of a live game as an error. Also adds a rules-page line for glasses to the first release, and fixes a paragraph in Phase 4 that an earlier edit had split. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At two players the empty-deck reveal is a convenience for information a player could already deduce: every card not on the field, in the scrap or in their own hand must be in the opponent's. At three players only the union of the two opponents' hands is deducible, not the split, so revealing would add information. Two-player behavior is unchanged. Adds a revealHandsOnEmptyDeck rule-set flag. The reveal is implemented in two independent places, update-revealed-cards.js and the deckIsEmpty branch of hideOpponentHand in create-socket-events.js, and both must read the flag; gating only the first would still leak every hand through the second. The 1f note previously said to leave hideOpponentHand alone, which now applies only to its glasses branch. Also records the guiding distinction behind the reveal decisions: card effects carry over to three players, while conveniences for deducible information carry over only if the deduction does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
| > poor query experience, and a distinction never recorded cannot be retrofitted; collapsing two | ||
| > versions later is trivial by comparison. | ||
| > | ||
| > Patch, not major or minor: of the three tiers that file defines, only patch ("doesn't change |
There was a problem hiding this comment.
Nit: I would argue that this change is not backwards-compatible, so should be a major change. If this were rolled out and a bug discovered, it would not be possible to roll back, only roll forwards with a fix.
Although this seems to be referring to a file I'm not familiar with, so this codebase might do version numbering differently
|
|
||
| "Return the stolen card to its original owner" is the rule; `jackCount % 2 === 1` is a two-player | ||
| *encoding* of it. Note also that `six.js:37-38` applies the transform pairwise | ||
| (`scrapRoyalsAndSwapStolenPoints(p0, p1)` then `(p1, p0)`), which does not generalize. |
There was a problem hiding this comment.
This function name overall feels like a code smell to me. I think that if a card doesn't have a Jack on it, it should end up with its originating player without any additional work.
I think I read above that the original player of a card will be encoded-- if that's the case, does that warrant reworking this function?
| - **Win thresholds.** Currently duplicated in three places: | ||
| `check-game-state-for-win-sync.js:22-38`, `GameView.vue:880-893`, `ScoreGoalToolTip.vue:72`. | ||
| - **Hand limit.** `utils/GameConstants.json` is a single global. | ||
| - **Stalemate threshold.** `check-game-state-for-win-sync.js:51` uses `numPasses >= 3`, with |
There was a problem hiding this comment.
Doesn't this remain the same? In two player, it's a stalemate if I pass, you pass, and then I pass (3 passes). In three player, it's a stalemate if P0 passes, P1 passes, and P2 passes (also 3 passes)?
See line 32:
| Stalemate | All three players passing consecutively (one full round). |
| (`deckExhaustAnswer` never mentions it), so experienced players will expect it without having | ||
| read anywhere that it exists. | ||
|
|
||
| **Phase 5 — jokers**, if in scope, as an independent `ruleVariants` flag. Larger than it looks: |
There was a problem hiding this comment.
Very much not in-scope, right?
There was a problem hiding this comment.
Actually for balance reasons I think it's important cutthroat include jokers. The reduced wincon threshold makes a single king cause check, and otherwise there aren't quite enough answers to them. We could potentially add them in a follow up, but my plan had been to launch with them
| **All rules questions are resolved** -- see the settled-decisions table. One non-rules item | ||
| remains outstanding: | ||
|
|
||
| 1. **Rematch series name format.** `${p0.username} VS ${p1.username} ${w}-${l}-${s}` has no |
There was a problem hiding this comment.
Other options include:
- Alphabetically sort by username (
A vs B vs C) - Sort by user ID ascending
players.map( p => p.username ).join(' VS '), since the array of player is stable, right?
Review fixes: - Pack, not the serializer, decides which owner suffixes to write. An unstacked Two in pXPoints and a counter Two in twos are identical in memory, so a context-free serializer cannot tell which needs a suffix. Pack's points branch stays, with a new job. - The ownership invariant is precise rather than blanket. saveGamestate validates before packing, so a freshly played card still has a null owner. - 1c declares a legacy read rule for oneOffTargetPNum, and the spec gains a standing rule that every new gamestate column declares one. - Counter priority excludes the stack-top owner from the candidates, so it has a stopping rule. 1c's counter-Queen check shares the same stackTopOwner. - 1a splits into 1a-read and 1a-write. The current reader throws on suffixed strings, so reverting a combined change after any new-format row was written would break live games. - The Six drops its pairwise swap and returns each point card to its owner. - The stalemate threshold is left alone: it is three passes in both variants. Jokers are in scope at launch. Adds the attachment model: stacks never nest, and jacks and jokers are both stealers attached to the card being controlled, so face cards can now carry stacks. The grammar covers them from 1a-read, so the storage format changes once. Ids XR and XB at rank 14, plus the ten confirmed interactions and the engine and client work. Glasses audience is reopened as a decision to make during Phase 1, before 1e. Also records an existing bug found along the way: counter/validate.js never checks that the counter is a Two. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… owners Storage format: the top stealer's owner suffix is no longer written. A stack sits in its controller's column, so the suffix only repeated the column. This is the minimum encoding, n suffixes for n stealers, the same count the legacy format writes. The serializer omits it structurally and stays context-free; unpack fills it in from the column. The reader still accepts a suffix there. Hand cards now carry an owner, filled in from their column by unpack. Every play from a hand takes the card from the player's own hand, so it reaches the field with its owner. Only the Seven moves, which play from the deck, set owner explicitly. That removes the brief null owner on freshly played cards, so the field invariant is strict again. Moves never clear owner; pack writes it only for stacked cards and twos. Also: - Define "column" as a per-player column, distinct from shared slots. - Snapshot slots such as targetCard and oneOffTarget are informational and never reconstructed. The pack guard skips them, and moves from the serializer into pack, since it depends on the slot. Without that, a legacy oneOffTarget on a paused game would make the next counter move throw. - Record that the column-less pack path writes "JH-undefined" for a card with two attachments, and state the counter bug's impact plainly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Issue number
No issue — this PR is the spec that the implementation issues will reference. Merging it
first gives those issues stable section anchors to link to, and lets the decisions be reviewed
independently of any code.
What this is
A design doc for a 1v1v1 "Cutthroat" variant (
docs/three-player-cuttle.md). Docs only; no codechanges. It follows the precedent of
docs/game-state-api.md— a durable architecture doc insource, with small issues for the individual tasks.
Rules as written live in
src/translations/en.jsonunderrules.3Players.Architecture decisions
Game,GameStateRowandMatchrather than forking; extendGamewithplayerCountand
ruleVariants, whichutils/rulesVersion.jsalready anticipates.simply disabled in cutthroat, ~2 genuinely differ, and ~18 are identical — the real variance is
in turn order, priority, victory, dealing and stalemate, none of which are effect helpers.
Matchis ranked-only infrastructure and is untouched.Phase 1 is independently valuable
Phase 1 contains no three-player behavior. It ships against two-player rules with the existing
suite as the gate, and fixes defects that already exist but cannot be observed at two players,
where the alternation they rely on is accidentally correct:
(
convert-card-to-str.js:18-22), so a stack where two different opponents each jacked the samecard is structurally inexpressible. A point card's original owner is likewise only recoverable
by parity, which
resolve/six.js:29depends on to return a stolen card.(
resolve/four.js:27-29says so in a comment). Under clockwise counter priority the resolver isno longer necessarily the victim.
Worth a careful read
The doc records that the legacy jack suffix does not mean what
GameStateRow.js:16andgame-state-api.md:145claim. Verified against the encoder: the emitted list is the trueownership sequence shifted one position, not each jack's controller. It drifted because
convert-str-to-card.js:126-128parses the suffix and discards it — write-only data. Correctingthat documentation is part of the work.
There is also an appendix sweeping every two-player assumption across
api/andsrc/, classifiedby file and line, to serve as an implementation checklist.
Please check the following
npm run test:unit: 57 client + 151 sails, all passingnpm run lintcleanPlease describe additional details for testing this change
Nothing to test at runtime; there are no code changes. Review is of the decisions themselves.
The places I would most want a second opinion:
counts are in the doc; the counter-argument is isolating cutthroat balance churn from ranked
two-player.
rulesVersion5.0.1 for a storage-format change (1a, "Reading legacy rows"). Decoding staysstructural and versionless; the bump exists so game data analysis can bucket by encoding.
declines cleared each time the stack grows, backed by a new
passedPrioritycolumn.Note this PR still needs a
version-patchlabel — theCheck Version Labelcheck has no pathexemption for docs-only changes.
🤖 Generated with Claude Code


Confidence Score: 5/5
This documentation-only PR appears safe to merge.Summary
Adds a docs-only architecture and phased implementation plan for three-player Cutthroat.
The four supplied previous threads are addressed in the current text. No new actionable issues were found. Runtime tests were not run for this documentation-only review.
Reviews (5) · Last reviewed commit: "docs(three-player): omit the top stealer..." · Reviewed by Greptile