v0.4.9e — five of six playtest bugs: one button per train, and a load that has to go somewhere
Gameplay testing on 0.4.9d returned six reports. Five are fixed; the sixth could not be reproduced and is written up in TODO.md with the two questions that would pin it down. TWO TRAINS AT ONE PLATFORM ANSWERED TO ONE BUTTON. `porter.board` and `porter.detrain` carried no tray, so there was one button per platform however many trains stood at it and the reducer filled the first empty coach on the A/D tracks. `check` and the reducer were not even asking the same question: `check` skipped a train whose card refuses passenger work and the reducer did not. Both intents now carry an optional `trayId`, one function resolves the train and the coach for check/execute/reduce alike, `legal.ts` offers one candidate per train, and the label names it. A LOAD COULD BE MADE AND BROKEN WITHOUT GOING ANYWHERE. A Freight House could unload the boxcar it had just loaded; a platform could detrain the passengers it had just boarded. Full Revenue at both ends for a movement that never happened. Jesse's rule: a load made anywhere in an Office Area may not be broken anywhere in that Office Area, ever — it has to be carried to another district. The load carries the seat that made it (`RollingStock.origin`), stripped by `pooled` at every yard push. Measured at -0.60 +/- 0.10 Revenue a game (t = -6.1) over 400 paired deals: 78 worse, 3 better, 319 unchanged — free Revenue coming off the board, not a nerf. THE GROCER'S WAREHOUSE SHIPPED AND THE REFINERY RECEIVED. Both were `flow: 'both'` on the reading that "Freight House" was a collective term for exactly those two, and therefore what §9.3 described. The engine has dealt a Freight House CARD since before v0.4.9, so §9.3 names it and the argument goes. The card set agrees: all three Refinery modifiers grant +1 outbound. Refinery outbound-only, Grocer's inbound-only, Freight House the one two-way industry — which leaves exactly the one same-district pairing the rule above refuses. NOT REPRODUCED: cars left behind when backing up over them. Five layouts tried, including cars spotted at an industry; every one couples the lot. Three are pinned in `apply.test.ts`. One way to create such cars was closed anyway — `flyingSwitch` wrote its cut past `carsOn`. Both published replays that had gone dead were re-recorded; a rules change retires a save, and `harness.test.ts` is what catches it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011nbvwWMef8CuEP6t5cgkTv
This commit is contained in:
co-authored by
Claude Opus 5
parent
f9c4d9fa92
commit
7c35e002af
@@ -3193,6 +3193,105 @@ describe('two crews switching are told apart', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('two trains at one platform are told apart (v0.4.9e)', () => {
|
||||
/**
|
||||
* REPORTED from the v0.4.9d playtest: "operating two trains in a station — the select button does
|
||||
* not work. Regardless of which you pick, it is always one train, not the other."
|
||||
*
|
||||
* `porter.board` and `porter.detrain` carried no tray, so there was ONE button per platform however
|
||||
* many trains were standing at it, and the reducer filled whichever tray came first out of
|
||||
* `adOccupancy`. Clicking a roster chip changed what the board drew and nothing else — which is
|
||||
* exactly what "the select button does not work" describes.
|
||||
*
|
||||
* Driven through `actionMenu` rather than `legalActions` because the second half of the failure was
|
||||
* at this layer: the menu collapses identical labels within a crew, and "board passengers at (0,0)"
|
||||
* describes both trains.
|
||||
*/
|
||||
const twoAtPlatform = (): { game: Game; trays: string[] } => {
|
||||
const game = newGame(4242);
|
||||
const s = game.state;
|
||||
const area = areaOf(s, 0);
|
||||
const f = area.grid.get(`${area.officeCoord.row},${area.officeCoord.col}`)!.facility!;
|
||||
// A Station's worth of platform: Porters, slots, and two fares waiting.
|
||||
f.allows = { outbound: true, inbound: true };
|
||||
f.porters = 4;
|
||||
f.capacity = { outbound: 2, inbound: 2 };
|
||||
f.outboundBox = [{ type: 'coach', loaded: true }, { type: 'coach', loaded: true }];
|
||||
const trays: string[] = [];
|
||||
for (const trainNumber of [7, 9]) {
|
||||
const id = s.freeTrays.pop()!;
|
||||
s.trays.set(id, {
|
||||
id, trainNumber, trainIsExtra: false, engineAt: 0,
|
||||
consist: [{ type: 'coach', loaded: false }],
|
||||
direction: 'east', facing: 'e',
|
||||
position: { at: 'grid', seat: 0, coord: area.officeCoord },
|
||||
movesUsed: 0,
|
||||
} as never);
|
||||
area.adOccupancy.push(id);
|
||||
trays.push(id);
|
||||
}
|
||||
s.clock.phase = 'loadUnload';
|
||||
s.clock.currentActor = 0;
|
||||
return { game, trays };
|
||||
};
|
||||
|
||||
it('offers boarding once per train, with the train named on the button', () => {
|
||||
const { game } = twoAtPlatform();
|
||||
const labels = actionMenu(game)
|
||||
.direct.flatMap((g) => g.actions)
|
||||
.map((a) => a.label)
|
||||
.filter((l) => /^board passengers/.test(l));
|
||||
assert.equal(labels.length, 2, `expected one button per train, got ${JSON.stringify(labels)}`);
|
||||
assert.ok(labels.some((l) => /Train 7/.test(l)), `no button names Train 7: ${JSON.stringify(labels)}`);
|
||||
assert.ok(labels.some((l) => /Train 9/.test(l)), `no button names Train 9: ${JSON.stringify(labels)}`);
|
||||
});
|
||||
|
||||
it('boards the train whose button was pressed', () => {
|
||||
const { game, trays } = twoAtPlatform();
|
||||
const { options } = actionGroups(game);
|
||||
const nine = options.findIndex(
|
||||
(o) => o.type === 'porter.board' && (o as { trayId?: string }).trayId === trays[1],
|
||||
);
|
||||
assert.ok(nine >= 0, 'no boarding option names the second train');
|
||||
submit(game, options[nine]!);
|
||||
assert.equal(game.state.trays.get(trays[1]!)!.consist[0]!.loaded, true, 'Train 9 did not get them');
|
||||
assert.equal(game.state.trays.get(trays[0]!)!.consist[0]!.loaded, false, 'Train 7 was filled instead');
|
||||
});
|
||||
|
||||
it('will not detrain the passengers it has just put aboard', () => {
|
||||
// The other half of the same playtest: "passenger stations — passengers just boarded cannot be
|
||||
// immediately unloaded." They could, for a Porter action and full Revenue, without the train
|
||||
// moving an inch.
|
||||
const { game, trays } = twoAtPlatform();
|
||||
const board = actionGroups(game).options.find(
|
||||
(o) => o.type === 'porter.board' && (o as { trayId?: string }).trayId === trays[0],
|
||||
)!;
|
||||
submit(game, board);
|
||||
const detrains = actionGroups(game).options.filter((o) => o.type === 'porter.detrain');
|
||||
assert.equal(detrains.length, 0, 'detraining was still offered for passengers who boarded here');
|
||||
assert.equal(
|
||||
check(game.state, 0, { type: 'porter.detrain', at: areaOf(game.state, 0).officeCoord, trayId: trays[0]! }),
|
||||
'LOADED_IN_THIS_DISTRICT',
|
||||
);
|
||||
});
|
||||
|
||||
it('says on the coach that it was loaded here', () => {
|
||||
// The printed game turns the chip upside down in the tray; this is the screen's version of that.
|
||||
const { game, trays } = twoAtPlatform();
|
||||
submit(game, actionGroups(game).options.find(
|
||||
(o) => o.type === 'porter.board' && (o as { trayId?: string }).trayId === trays[0],
|
||||
)!);
|
||||
const f = view(game);
|
||||
const office = f.cells.find((c) => c.kind === 'office')!;
|
||||
const train = office.trains.find((t) => t.trayId === trays[0]);
|
||||
assert.ok(train, 'the boarded train is not on the Office card');
|
||||
assert.ok(
|
||||
train!.cars.some((c) => /loaded here/.test(c)),
|
||||
`the coach does not say where it was loaded: ${JSON.stringify(train!.cars)}`,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('the Superintendent ruling names the train it is ruling on', () => {
|
||||
/**
|
||||
* REPORTED from play: "when the Superintendent has to rule on a train to allow or hold, it should
|
||||
|
||||
Reference in New Issue
Block a user