v0.7.1 — a caboose is not a load, a Day that says it ended, and a train you may throw away
Four issues off the Gitea tracker, all of them things a player saw at the board. Reasoning for every item, and what was verified how: CHANGELOG.md. - Gitea#8: X22 Pee-Dee refused every caboose, including the one it was made up with, so setting it out stranded the train. All six cabooses are minted loaded because §2.2's "coloured is loaded, white is empty" doubles as a piece count in the supply table; one read of the flag took that literally. A caboose carries the crew, not freight, so it is never a load. - Gitea#10: a Day turns over inside the phases that run themselves, so it passes between one click and the next — and both transient signals fade before a player reading the board notices. A modal stops and waits, carrying the standings, the Days left and the combined target. Suppressed on the first frame, on Undo stepping back across a rollover, and on the Day the game ends. - Gitea#9, which SUPERSEDES Gitea#6 from three days ago: a Timetabled train may be tossed face-up to a Department slot, where a rival may pick it up — the second half of the ruling needed no code, since that is where every discard already goes. An Extra still may not. A New Game setting on this line (discardTimetabled, on by default), the plain rule on the 0.4.9 line. - Gitea#2 is not an engine bug: the rules are implemented exactly, and running the coach pool dry is Jesse's ruling to keep — "part of the strategy". What was wrong is that the game said nothing. A blocked platform now gives its reason, from the engine's own predicate, including how many coaches are stranded in Classification and what brings them back. The same four ship as v0.4.9g on the playtest line. Closes #2 Closes #8 Closes #9 Closes #10 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FLnYR4XtXQNamYJXGYT8oC
This commit is contained in:
co-authored by
Claude Opus 5
parent
603d38602c
commit
441447648d
+61
-19
@@ -417,14 +417,42 @@ export function canDetrain(s: GameState, player: PlayerIndex, at: GridCoord, tra
|
||||
}
|
||||
|
||||
/**
|
||||
* A Timetabled or Extra train card (§6.2, Gitea#6) — the one place that decides what "a train card"
|
||||
* means, so the rule, the UI's reason text and any test all ask the same question.
|
||||
* A Timetabled or Extra train card (§6.2) — the one place that decides what "a train card" means.
|
||||
*/
|
||||
export function isTrainCard(s: GameState, cardId: CardId): boolean {
|
||||
const kind = s.cards.get(cardId)?.kind.kind;
|
||||
return kind === 'timetabledTrain' || kind === 'extraTrain';
|
||||
}
|
||||
|
||||
/**
|
||||
* WHY THIS CARD CANNOT BE THROWN AWAY, or `null` if it can (§6.2, Gitea#9 superseding Gitea#6).
|
||||
*
|
||||
* The one place that answers the question, so `check`, the hand panel and the blocked "End Local
|
||||
* Operations" button all give the same reason rather than three hand-written approximations of it.
|
||||
* Gitea#6 made every train card unconditionally undiscardable; Gitea#9 narrows that:
|
||||
*
|
||||
* - a TIMETABLED train is discardable unless the `discardTimetabled` house rule is off. Jesse's
|
||||
* reasoning is about a long game whose timetable has filled up — "the stations are jammed and
|
||||
* the railroad doesn't need any more. You can toss it";
|
||||
* - an EXTRA is never discardable. It never joins the timetable, so it cannot jam it, and the
|
||||
* rule it would otherwise dodge is the hand limit.
|
||||
*
|
||||
* Returns the sentence rather than a code because it is written for a player, and the two cases
|
||||
* fail for genuinely different reasons — "not in this game" and "not ever".
|
||||
*/
|
||||
export function keepReason(s: GameState, cardId: CardId): string | null {
|
||||
const kind = s.cards.get(cardId)?.kind.kind;
|
||||
if (kind === 'extraTrain') {
|
||||
return 'An Extra is never discarded. It runs once and ends in the Salvage Yard, so it can only ' +
|
||||
'be played — hold it for as many Stages and Days as you like.';
|
||||
}
|
||||
if (kind === 'timetabledTrain' && !houseRules(s.config).discardTimetabled) {
|
||||
return 'A train card is never discarded in this game. The only way it leaves your hand is onto ' +
|
||||
'the timetable — hold it for as many Stages and Days as you like.';
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* WHERE AN EXTRA STARTS AND WHICH WAY IT RUNS — the one answer `check`, `execute` and the reducer
|
||||
* all use, so a placement can never be checked against one square and made on another.
|
||||
@@ -563,6 +591,21 @@ function freightWorkedKey(trayId: TrayId, at: GridCoord): string {
|
||||
|
||||
const isFreight = (c: RollingStock): boolean => c.type !== 'coach' && c.type !== 'caboose';
|
||||
|
||||
/**
|
||||
* IS THIS CAR CARRYING A LOAD? A CABOOSE NEVER IS, whatever its `loaded` flag says.
|
||||
*
|
||||
* `ROLLING_STOCK_SUPPLY` mints all six cabooses as `{ loaded: 6, empty: 0 }` because §2.2's
|
||||
* "a coloured car is loaded, a white car is empty" is doing double duty there as a PIECE COUNT,
|
||||
* and a caboose has no white version — there is no such thing as an empty one to make up a train
|
||||
* from. Every other reading of `.loaded` in this file is already scoped to a coach or to a named
|
||||
* car type, so the flag's second meaning only ever escaped here.
|
||||
*
|
||||
* Reported as Gitea#8: X22 Pee-Dee, whose whole card is "may only pick up MTs", could not couple a
|
||||
* caboose at all — including the one it was made up with. Drop it and it was stranded, which made
|
||||
* the train unplayable rather than merely restricted.
|
||||
*/
|
||||
const carriesLoad = (c: RollingStock): boolean => c.loaded && c.type !== 'caboose';
|
||||
|
||||
/**
|
||||
* May this train work these freight cars on this square?
|
||||
*
|
||||
@@ -662,7 +705,7 @@ function refusesThisOffice(s: GameState, player: PlayerIndex, tray: CrewTray): b
|
||||
* this works out whether a card is the reason. Without it a Military train standing at the platform
|
||||
* reported "no train at the Office", which is both wrong and unhelpful.
|
||||
*/
|
||||
function passengerRefusal(
|
||||
export function passengerRefusal(
|
||||
s: GameState,
|
||||
player: PlayerIndex,
|
||||
at: GridCoord,
|
||||
@@ -777,7 +820,7 @@ export function check(s: GameState, player: PlayerIndex, i: Intent): RejectionCo
|
||||
*/
|
||||
if (rules.noSwitching) return 'PICKUP_NOT_ALLOWED';
|
||||
if (rules.dropOnly) return 'PICKUP_NOT_ALLOWED';
|
||||
if (rules.pickUpEmptiesOnly && fresh.some((c) => c.loaded)) return 'EMPTIES_ONLY';
|
||||
if (rules.pickUpEmptiesOnly && fresh.some(carriesLoad)) return 'EMPTIES_ONLY';
|
||||
const freight = fresh.filter(isFreight).length;
|
||||
if (freight > 0 && !freightBudgetLeft(s, player, tray, i.to, freight)) return 'FREIGHT_WORKED_HERE';
|
||||
}
|
||||
@@ -881,30 +924,29 @@ export function check(s: GameState, player: PlayerIndex, i: Intent): RejectionCo
|
||||
}
|
||||
|
||||
/**
|
||||
* §6.2, AS RULED BY JESSE (Gitea#6): A TRAIN CARD MAY NOT BE DISCARDED. EVER.
|
||||
* §6.2 — WHICH TRAIN CARDS MAY BE THROWN AWAY (Gitea#9, superseding Gitea#6).
|
||||
*
|
||||
* It may be held for as many Stages and Days as the player likes — the hand limit is the only
|
||||
* pressure on it — but it never goes onto a Department pile. The consequence is the point of the
|
||||
* rule and needs no machinery of its own: a player holding four train cards has nothing
|
||||
* discardable, and `draw.end` already refuses while the hand is over the limit, so the only way
|
||||
* to conclude the turn is to PLAY one. Playing a train card is unconditionally legal (see
|
||||
* `card.play`'s `timetabledTrain` case, which refuses only a board placement), so that corner
|
||||
* can never lock a player in.
|
||||
* `keepReason` holds the rule; this asks it. A Timetabled train is discardable unless the
|
||||
* `discardTimetabled` house rule is off, and an Extra never is.
|
||||
*
|
||||
* Extras count. They are trains — Jesse's ruling in the same breath — even though an Extra runs
|
||||
* once and ends in the Salvage Yard while a Timetabled card joins the timetable for the rest of
|
||||
* the game.
|
||||
* WHERE THE DISCARD GOES IS THE OTHER HALF OF THE RULING. "If someone else wants to pick it up,
|
||||
* they are more than able to" — a discard goes face-up on a Department pile, which is exactly
|
||||
* where a rival can draw it from, so the second half needed no machinery at all.
|
||||
*
|
||||
* `legal.ts` enumerates candidates and filters them through here, so the discard option simply
|
||||
* stops being offered for these cards; the bot needs no separate rule and already reaches for
|
||||
* `card.play` before it reaches for a discard.
|
||||
* The corner Gitea#6 created still exists when the setting is off, and is still deliberate: a
|
||||
* player holding four undiscardable trains has one way forward, which is to PLAY one. `draw.end`
|
||||
* refuses while the hand is over the limit, and playing a train card is unconditionally legal
|
||||
* (`card.play`'s `timetabledTrain` case refuses only a board placement), so it can never lock.
|
||||
*
|
||||
* `legal.ts` enumerates candidates and filters them through here, so an undiscardable card
|
||||
* simply stops being offered; the bot needs no separate rule.
|
||||
*/
|
||||
case 'card.discard': {
|
||||
if (!inPhase(s, 'localOps')) return 'WRONG_PHASE';
|
||||
const hand = s.decks.hands.get(player) ?? [];
|
||||
if (!hand.includes(i.cardId)) return 'CARD_NOT_IN_HAND';
|
||||
if (i.toSlot < 0 || i.toSlot > 2) return 'SLOT_EMPTY';
|
||||
if (isTrainCard(s, i.cardId)) return 'TRAINS_ARE_NEVER_DISCARDED';
|
||||
if (keepReason(s, i.cardId) !== null) return 'TRAINS_ARE_NEVER_DISCARDED';
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user