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
+94
-27
@@ -262,19 +262,20 @@ describe('Local Operations: drawing (§6.2)', () => {
|
||||
assert.equal(check(s, 0, { type: 'draw.end' }), null, 'the turn cannot be ended even at the limit');
|
||||
});
|
||||
|
||||
describe('a train card is never discarded (Gitea#6)', () => {
|
||||
describe('which train cards may be discarded (Gitea#9, superseding Gitea#6)', () => {
|
||||
/**
|
||||
* Jesse's ruling, v0.4.9e playtest: "Players are not allowed to discard Train cards. They may
|
||||
* keep the card in their hand for multiple stages and even multiple days, but they may not
|
||||
* discard it. If a player has three train cards in their hand, and they draw a fourth, then they
|
||||
* must play one of those cards."
|
||||
* Gitea#6's ruling, v0.4.9e playtest, was that NO train card may be discarded. Gitea#9 narrows
|
||||
* it — Jesse, 2026-08-24: "Timetabled trains are at the choice of the player: they can either
|
||||
* play or discard. If someone else wants to pick it up, they are more than able to. The reason:
|
||||
* I don't want, if you decide to play a game longer than five days, to decide that maybe there
|
||||
* are too many trains, the stations are jammed, and the railroad doesn't need any more."
|
||||
*
|
||||
* Extras count too — an Extra is a train, even though it runs once and ends in the Salvage Yard
|
||||
* where a Timetabled card joins the timetable for the rest of the game.
|
||||
* So a Timetabled train is discardable, an EXTRA still is not — it never joins the timetable, so
|
||||
* it cannot be what jams it — and whether the Timetabled half applies is a New Game setting,
|
||||
* because the reasoning is about long games and a five-Day game may want Gitea#6's pressure.
|
||||
*
|
||||
* Note there is no new FORCING mechanism, and deliberately so: the corner is what the two
|
||||
* existing rules produce together. Nothing discardable plus "you may not end the turn over the
|
||||
* limit" leaves exactly one legal way on, and playing a train is unconditionally legal.
|
||||
* Note there is still no FORCING mechanism, and deliberately so: the corner is what the two
|
||||
* existing rules produce together whenever the setting is off.
|
||||
*/
|
||||
const handOf = (s: GameState, kinds: string[]): string[] => {
|
||||
// Hand-pick cards of the wanted kinds straight out of the catalogue, so the test does not
|
||||
@@ -292,35 +293,74 @@ describe('Local Operations: drawing (§6.2)', () => {
|
||||
return picked;
|
||||
};
|
||||
|
||||
it('refuses the discard, for a Timetabled train and for an Extra alike', () => {
|
||||
/** The same game with the setting turned off — Gitea#6's rule, still reachable. */
|
||||
const strictGame = (): GameState =>
|
||||
createGame({
|
||||
id: 'g',
|
||||
seed: 77,
|
||||
config: { ...config, houseRules: { ...(config.houseRules ?? {}), discardTimetabled: false } },
|
||||
playerNames: ['Jesse'],
|
||||
});
|
||||
|
||||
it('lets a Timetabled train be discarded, and still refuses an Extra', () => {
|
||||
const s = game();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const [timetabled, extra, track] = handOf(s, ['timetabledTrain', 'extraTrain', 'track']);
|
||||
assert.equal(
|
||||
check(s, 0, { type: 'card.discard', cardId: timetabled!, toSlot: 0 }),
|
||||
'TRAINS_ARE_NEVER_DISCARDED',
|
||||
null,
|
||||
'Gitea#9 allows this and it was refused',
|
||||
);
|
||||
assert.equal(
|
||||
check(s, 0, { type: 'card.discard', cardId: extra!, toSlot: 0 }),
|
||||
'TRAINS_ARE_NEVER_DISCARDED',
|
||||
'an Extra never joins the timetable, so Gitea#9 does not reach it',
|
||||
);
|
||||
// And everything else is still discardable — the rule is about trains, not about discarding.
|
||||
assert.equal(check(s, 0, { type: 'card.discard', cardId: track!, toSlot: 0 }), null);
|
||||
});
|
||||
|
||||
it('never offers the discard, so the bot needs no rule of its own', () => {
|
||||
it('puts the discarded train where a rival can pick it up', () => {
|
||||
// The other half of the ruling — "if someone else wants to pick it up, they are more than able
|
||||
// to" — needed no machinery, because a discard already goes face-up onto a Department pile.
|
||||
const s = game();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const [timetabled] = handOf(s, ['timetabledTrain', 'track']);
|
||||
const offered = legalActions(s, 0).filter(
|
||||
(i) => i.type === 'card.discard' && i.cardId === timetabled,
|
||||
);
|
||||
assert.deepEqual(offered, [], 'a train discard was offered as a legal action');
|
||||
assert.ok(applyIntent(s, 0, { type: 'card.discard', cardId: timetabled!, toSlot: 1 }).ok);
|
||||
const pile = s.decks.departments[1]!;
|
||||
assert.equal(pile[pile.length - 1], timetabled, 'the train is not face-up on the pile');
|
||||
});
|
||||
|
||||
it('leaves PLAYING a train as the only way out of a hand of four trains', () => {
|
||||
it('offers the discard as a legal action, so the bot can take it', () => {
|
||||
const s = game();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const [timetabled, extra] = handOf(s, ['timetabledTrain', 'extraTrain', 'track']);
|
||||
const offered = legalActions(s, 0).filter((i) => i.type === 'card.discard');
|
||||
assert.ok(
|
||||
offered.some((i) => i.type === 'card.discard' && i.cardId === timetabled),
|
||||
'a Timetabled train was not offered as a discard',
|
||||
);
|
||||
assert.ok(
|
||||
!offered.some((i) => i.type === 'card.discard' && i.cardId === extra),
|
||||
'an Extra was offered as a discard',
|
||||
);
|
||||
});
|
||||
|
||||
it('keeps Gitea#6 reachable when the setting is off', () => {
|
||||
const s = strictGame();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const [timetabled, extra, track] = handOf(s, ['timetabledTrain', 'extraTrain', 'track']);
|
||||
for (const id of [timetabled!, extra!]) {
|
||||
assert.equal(
|
||||
check(s, 0, { type: 'card.discard', cardId: id, toSlot: 0 }),
|
||||
'TRAINS_ARE_NEVER_DISCARDED',
|
||||
);
|
||||
}
|
||||
assert.equal(check(s, 0, { type: 'card.discard', cardId: track!, toSlot: 0 }), null);
|
||||
});
|
||||
|
||||
it('leaves PLAYING a train as the only way out of a hand of four, setting off', () => {
|
||||
const s = strictGame();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const four = handOf(s, ['timetabledTrain', 'timetabledTrain', 'timetabledTrain', 'extraTrain']);
|
||||
assert.ok(four.length > HAND_LIMIT, 'this test needs a hand over the limit');
|
||||
|
||||
@@ -337,11 +377,26 @@ describe('Local Operations: drawing (§6.2)', () => {
|
||||
assert.equal(check(s, 0, { type: 'draw.end' }), null, 'playing a train did not free the turn');
|
||||
});
|
||||
|
||||
it('a hand of four Extras is the corner that survives Gitea#9 with the setting ON', () => {
|
||||
// Gitea#9 does not reach an Extra, so the deadlock-that-is-not-a-deadlock is still real in a
|
||||
// default game — worth pinning, since it is now the ONLY way to reach it.
|
||||
const s = game();
|
||||
applyIntent(s, 0, { type: 'localOps.choose', option: 'draw' });
|
||||
const four = handOf(s, ['extraTrain', 'extraTrain', 'extraTrain', 'extraTrain']);
|
||||
assert.equal(check(s, 0, { type: 'draw.end' }), 'HAND_LIMIT');
|
||||
for (const id of four) {
|
||||
assert.equal(check(s, 0, { type: 'card.discard', cardId: id, toSlot: 0 }), 'TRAINS_ARE_NEVER_DISCARDED');
|
||||
}
|
||||
assert.ok(applyIntent(s, 0, { type: 'card.play', cardId: four[0]! }).ok);
|
||||
assert.equal(check(s, 0, { type: 'draw.end' }), null);
|
||||
});
|
||||
|
||||
it('lets a train be held across Stages and into the next Day', () => {
|
||||
// "They may keep the card in their hand for multiple stages and even multiple days." Nothing
|
||||
// sweeps a hand at a Stage or Day boundary, and this is what says so out loud.
|
||||
// sweeps a hand at a Stage or Day boundary, and this is what says so out loud. An Extra is
|
||||
// used, because it is the card that still cannot be got rid of any other way.
|
||||
const s = game();
|
||||
const [timetabled] = handOf(s, ['timetabledTrain', 'track']);
|
||||
const [extra] = handOf(s, ['extraTrain', 'track']);
|
||||
const startDay = s.clock.day;
|
||||
|
||||
// Play out Stages by taking whatever ends the current turn, until the Day turns over.
|
||||
@@ -357,24 +412,36 @@ describe('Local Operations: drawing (§6.2)', () => {
|
||||
|
||||
assert.ok(s.clock.day > startDay, `the Day never turned (stopped at ${s.clock.day}/${s.clock.stage})`);
|
||||
assert.ok(
|
||||
(s.decks.hands.get(0) ?? []).includes(timetabled!),
|
||||
(s.decks.hands.get(0) ?? []).includes(extra!),
|
||||
'the train did not survive being held into the next Day',
|
||||
);
|
||||
assert.equal(
|
||||
check(s, 0, { type: 'card.discard', cardId: timetabled!, toSlot: 0 }),
|
||||
check(s, 0, { type: 'card.discard', cardId: extra!, toSlot: 0 }),
|
||||
'TRAINS_ARE_NEVER_DISCARDED',
|
||||
'a Day boundary made a train discardable',
|
||||
'a Day boundary made an Extra discardable',
|
||||
);
|
||||
});
|
||||
|
||||
it('tells the player on the card itself, and on the button when every card is a train', () => {
|
||||
it('tells the player on the card itself which of the two rules applies', () => {
|
||||
// The Gitea#2 lesson: a rule the player cannot see is a board with nothing to click and no
|
||||
// reason given.
|
||||
// reason given. Since Gitea#9 there are TWO reasons, so the card has to say which.
|
||||
const s = game();
|
||||
handOf(s, ['timetabledTrain', 'extraTrain', 'track']);
|
||||
const f = snapshot(s, [], null);
|
||||
// `hand` is reversed for display, so compare as a set rather than by position.
|
||||
assert.deepEqual([...f.handDiscardable].sort(), [false, false, true]);
|
||||
assert.deepEqual([...f.handDiscardable].sort(), [false, true, true]);
|
||||
const said = f.handKeepWhy.filter((w): w is string => w !== null);
|
||||
assert.equal(said.length, 1, 'exactly one card in this hand may not be discarded');
|
||||
assert.match(said[0]!, /An Extra is never discarded/);
|
||||
|
||||
const strict = strictGame();
|
||||
handOf(strict, ['timetabledTrain', 'extraTrain', 'track']);
|
||||
const sf = snapshot(strict, [], null);
|
||||
assert.deepEqual([...sf.handDiscardable].sort(), [false, false, true]);
|
||||
assert.ok(
|
||||
sf.handKeepWhy.some((w) => w !== null && /never discarded in this game/.test(w)),
|
||||
'the setting being off is not explained on the card',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user