v0.8.3 — the engine half of the audit, and the deal 0.8.2 silently changed
Seven rules faults and one dealing fault, from a four-way code audit (engine, server, client, tests) read against the code before anything was acted on. Each is pinned by a test that failed first. CHANGELOG has the reasoning; this is the list. THE DEAL. 0.8.2 put the Second Section card into the deck after its save check had run and without a line in its notes. A deck one card larger shuffles differently from the same seed, so every save on the test server refused at move 3 — the boot log shows thirteen of thirteen — while the release notes said three would resume. `withSavedDeal` (was `withSavedOpening`) now sets `secondSectionCard: false` for a config that predates the setting, and the thirteen replay exactly as 0.8.2 described: three resume, ten refuse, the same ten at the same moves. THE RULES. `check` never tested that a switching tray was in the actor's own district, so a rival's train could be shunted and the rival charged the Moves. Occupancy matched on coordinates alone, so a rival's crew blocked your track. A Department draw that emptied the deck duplicated the drawn card and destroyed the refill card. The unjam cleared the first load rather than the one named. The collision floor could not fire in Stage 12. The Expedite fault was charged once per clearance question rather than once per phase. A train held at the Limits was only ever released by another arrival, never by a departure. Docs: rules.md describes each as built (and no longer says an Expedited train departs at Shift Change — that was v0.4.8's reading, corrected in v0.4.9's code and never in the document); game-state.md's collision-floor note now matches the code. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FrCWubm9GAftYCm2hWdKwK
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
6f2a8dff09
commit
4d222a7eba
+35
-13
@@ -1226,6 +1226,17 @@ export type HouseRules = {
|
||||
extraStart: ExtraStartRule;
|
||||
/** Which Office every player opens on — see `StartingOffice`. */
|
||||
startingOffice: StartingOffice;
|
||||
/**
|
||||
* WHETHER THE SECOND SECTION CARD IS IN THE DECK (Q9, one copy).
|
||||
*
|
||||
* Not a table's choice — there is no dial for it — but a fact about how the game was DEALT, kept
|
||||
* here for the same reason `startingOffice` is: the deal has to be replayable. The card went into
|
||||
* the deck in v0.8.2, after that release's save check had been run, and a deck one card larger
|
||||
* shuffles into a different order from the same seed — so every save on the test server refused
|
||||
* at move 3 under 0.8.2 while its release notes said three would resume. `withSavedDeal` sets
|
||||
* this false for a save that predates the card; everything dealt since carries it as true.
|
||||
*/
|
||||
secondSectionCard: boolean;
|
||||
/**
|
||||
* §6.2 — MAY A TIMETABLED TRAIN BE THROWN AWAY? (Gitea#9, superseding Gitea#6.)
|
||||
*
|
||||
@@ -1262,6 +1273,7 @@ export type HouseRuleOverrides = {
|
||||
extraStart?: ExtraStartRule;
|
||||
discardTimetabled?: boolean;
|
||||
startingOffice?: StartingOffice;
|
||||
secondSectionCard?: boolean;
|
||||
};
|
||||
|
||||
/** The dialog's range. Zero is a real setting: it switches an economy off so the others can be read. */
|
||||
@@ -1287,6 +1299,7 @@ export const DEFAULT_HOUSE_RULES: HouseRules = {
|
||||
* harder setting for a table that wants it.
|
||||
*/
|
||||
startingOffice: 'depot',
|
||||
secondSectionCard: true,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1306,8 +1319,9 @@ export const LEGACY_HOUSE_RULES: HouseRules = {
|
||||
// These games predate Gitea#6 as well as Gitea#9: a train card could simply be discarded. `true`
|
||||
// is what they were played under, and a replay that discards a Timetabled train needs it.
|
||||
discardTimetabled: true,
|
||||
// Every game before 2026-09-23 opened on a Whistle Post.
|
||||
// Every game before 2026-09-23 opened on a Whistle Post, from a deck with no Second Section card.
|
||||
startingOffice: 'whistlePost',
|
||||
secondSectionCard: false,
|
||||
};
|
||||
|
||||
/** A whole, valid rule set from a config that may carry none, some, or out-of-range values. */
|
||||
@@ -1329,28 +1343,36 @@ export function houseRules(config: { houseRules?: HouseRuleOverrides }): HouseRu
|
||||
extraStart: given.extraStart ?? d.extraStart,
|
||||
discardTimetabled: given.discardTimetabled ?? d.discardTimetabled,
|
||||
startingOffice: given.startingOffice ?? d.startingOffice,
|
||||
secondSectionCard: given.secondSectionCard ?? d.secondSectionCard,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* THE OPENING A SAVE THAT PREDATES THE SETTING WAS DEALT UNDER.
|
||||
* THE DEAL A SAVE THAT PREDATES THE 0.8.2 SETTINGS WAS DEALT UNDER.
|
||||
*
|
||||
* `startingOffice` is unlike every other house rule: the others change how a game PLAYS, and
|
||||
* getting one wrong stops a replay part-way where it can be seen. This one changes how the game is
|
||||
* DEALT — a different Office, and a deck with four more cards in it — so a save replayed under the
|
||||
* wrong opening is a different railroad from intent one, and the failure is silent.
|
||||
* Two of the house rules change how a game is DEALT rather than how it plays, and getting either
|
||||
* wrong does not stop a replay part-way where it can be seen — it deals a different railroad from
|
||||
* intent one, silently. `startingOffice` is a different Office and a deck with four more cards in
|
||||
* it; `secondSectionCard` is a deck one card larger, which the same seed shuffles into a different
|
||||
* order. Every game saved before 2026-09-23 opened on a Whistle Post from a deck without the
|
||||
* Second Section card, and its `houseRules` cannot say so.
|
||||
*
|
||||
* Every game saved before 2026-09-23 opened on a Whistle Post and its `houseRules` cannot say so.
|
||||
* So a saved config that names house rules but not this one gets what it was played under.
|
||||
* So a saved config that names house rules but not `startingOffice` — the settings form has named
|
||||
* it on every config written since the setting existed — gets both of what it was played under.
|
||||
* A config with no house rules at all is a fresh game, not an old save, and is left alone; so is
|
||||
* one that names the opening, in either direction.
|
||||
*
|
||||
* APPLIED ON THE REPLAY PATHS ONLY, never inside `houseRules()`. A preset, the setup form and the
|
||||
* lobby all build configs that name some rules and not others, and they mean today's default —
|
||||
* putting this in the resolver made a fresh Cutthroat game deal Whistle Posts and read as Custom.
|
||||
* APPLIED ON THE REPLAY PATHS ONLY (`configFor` in `web/game.ts`, `tryResumeSession` in
|
||||
* `server/session.ts`), never in `houseRules()` above: putting the legacy default in the resolver
|
||||
* made a fresh game deal the old railroad and read as "Custom" in the lobby.
|
||||
*/
|
||||
export function withSavedOpening<T extends { houseRules?: HouseRuleOverrides }>(config: T): T {
|
||||
export function withSavedDeal<T extends { houseRules?: HouseRuleOverrides }>(config: T): T {
|
||||
const given = config.houseRules;
|
||||
if (!given || given.startingOffice !== undefined) return config;
|
||||
return { ...config, houseRules: { ...given, startingOffice: 'whistlePost' } };
|
||||
return {
|
||||
...config,
|
||||
houseRules: { ...given, startingOffice: 'whistlePost', secondSectionCard: given.secondSectionCard ?? false },
|
||||
};
|
||||
}
|
||||
|
||||
/** What the dialog calls each option, in the order it offers them. */
|
||||
|
||||
Reference in New Issue
Block a user