Skip to content

docs: three-player cuttle (cutthroat) architecture and Phase 1 spec - #1490

Open
itsalaidbacklife wants to merge 5 commits into
mainfrom
feature/three-player-cuttle-spec
Open

itsalaidbacklife wants to merge 5 commits into
mainfrom
feature/three-player-cuttle-spec

Conversation

@itsalaidbacklife

@itsalaidbacklife itsalaidbacklife commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Resolves #

What this is

A design doc for a 1v1v1 "Cutthroat" variant (docs/three-player-cuttle.md). Docs only; no code
changes.
It follows the precedent of docs/game-state-api.md — a durable architecture doc in
source, with small issues for the individual tasks.

Rules as written live in src/translations/en.json under rules.3Players.

Architecture decisions

  • Share Game, GameStateRow and Match rather than forking; extend Game with playerCount
    and ruleVariants, which utils/rulesVersion.js already anticipates.
  • Share the effect helpers and fork only the game-loop policy. Of the 24 move directories, 4 are
    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.
  • Cutthroat ships casual-only; Match is 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:

  • Jack ownership is never stored. It is derived by alternating at pack time
    (convert-card-to-str.js:18-22), so a stack where two different opponents each jacked the same
    card is structurally inexpressible. A point card's original owner is likewise only recoverable
    by parity, which resolve/six.js:29 depends on to return a stolen card.
  • Several resolve helpers identify a one-off's victim by inverting the resolver's pNum
    (resolve/four.js:27-29 says so in a comment). Under clockwise counter priority the resolver is
    no longer necessarily the victim.

Worth a careful read

The doc records that the legacy jack suffix does not mean what GameStateRow.js:16 and
game-state-api.md:145 claim
. Verified against the encoder: the emitted list is the true
ownership sequence shifted one position, not each jack's controller. It drifted because
convert-str-to-card.js:126-128 parses the suffix and discards it — write-only data. Correcting
that documentation is part of the work.

There is also an appendix sweeping every two-player assumption across api/ and src/, classified
by file and line, to serve as an implementation checklist.

Please check the following

  • Do the tests still pass? — npm run test:unit: 57 client + 151 sails, all passing
  • Is the code formatted properly? — npm run lint clean
  • For New Features:
    • Have tests been added to cover any new features or fixes? — n/a, docs only
    • Has the documentation been updated accordingly? — this PR is documentation

Please 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:

  1. Sharing the effect helpers rather than forking per mode (Architecture decisions). The
    counts are in the doc; the counter-argument is isolating cutthroat balance churn from ranked
    two-player.
  2. rulesVersion 5.0.1 for a storage-format change (1a, "Reading legacy rows"). Decoding stays
    structural and versionless; the bump exists so game data analysis can bucket by encoding.
  3. The counter-priority model (settled decisions + Phase 3). Clockwise in ascending pNum, with
    declines cleared each time the stack grows, backed by a new passedPriority column.

Note this PR still needs a version-patch label — the Check Version Label check has no path
exemption for docs-only changes.

🤖 Generated with Claude Code

Confidence Score: 5/5 · This documentation-only PR appears safe to merge.RetriggerView in GreptileConfidence 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 repository now has a phased plan for adding 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

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>
Comment thread docs/three-player-cuttle.md Resolved
Comment thread docs/three-player-cuttle.md Resolved
Comment thread docs/three-player-cuttle.md Resolved
Comment thread docs/three-player-cuttle.md Resolved
@itsalaidbacklife itsalaidbacklife added documentation Improvements or additions to documentation version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1) labels Nov 14, 2026
itsalaidbacklife and others added 2 commits November 14, 2026 11:46
…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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

Comment thread docs/three-player-cuttle.md Outdated
- **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

@byarmis byarmis Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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). |

Comment thread docs/three-player-cuttle.md Outdated
(`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:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very much not in-scope, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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

Comment thread docs/three-player-cuttle.md Outdated
**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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

itsalaidbacklife and others added 2 commits November 22, 2026 10:03
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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation version-patch An update that warrants a bumping the project's patch version (e.g. 4.0.0 => 4.0.1)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants