v0.4.7 — the switching game: track order, the cut on your own card, and four rules
Eight play reports and one design that had been written up and not built. The
through-line is switching: what a card can hold, which end of a train a cut comes
off, which way a train meets cars standing on the line, and what the board and the
log say about all of it.
TRACK ORDER FOR STANDING CARS, AND THE CUT ON YOUR OWN CARD
Two reports turned out to be one root cause. `TrackCard.standing` claimed "in track
order (§A.3)" and had no defined orientation at all, while `CrewTray.consist` does
(nose first, relative to facing) — so every transfer between them was a conversion
nothing performed. §A.3 says what it should be: cars occupy the track "in the same
order they originally held, left-to-right". Left-to-right is west-to-east, and that
is now the defined orientation of `standing` and of an industry track through
`carsOn`. It is the board's orientation, not the train's, so it does not change when
a different train touches the card.
- Setting out is batch-invariant. Four cars at once, four singles and two pairs
parked three different orders, one of them physically impossible. Successive
cuts off the same end stack up towards the engine, so the insertion point is the
train's own place in the row.
- Approaching a cut from either end now mirrors. `couples` is built nearest-first
along the direction of travel and reverses onto the nose, so the farthest car met
ends up nose-most — which is what makes a run-around worth its Move.
- A train no longer drives through its own cut. The walk began at the neighbour of
the start square and never read the start card, so a crew could set cars out and
pull straight away from them. Coupling is mandatory (§A.4) and your own square is
no exception; the cut counts against the four-car limit. Setting out off the end
you are not leaving by still works.
`CrewTray.standingWest` records where a train stands among the cars on its card — a
train may set out off both ends on one square, so which side a cut is on is not
recoverable from the array alone.
On the board, the cut is drawn split at the train — west cars left, east cars right,
engine in the gap — and each car's tooltip says whether it stands ahead of or behind
the engine. The history says which end a cut came off, and a move's button separates
"takes your own boxcar back off this card" from cars found standing on the line.
Decided: taking your own cut back on the square you are standing on is UNDOING the
drop. It is exempt from trains 3/4's per-location freight budget, X13's "drop but not
pick up" and X22's "empties only", and it refunds the budget the drop spent.
Otherwise a legal-looking drop becomes silently one-way.
Measured, 200 paired seeds, developer bot: -0.55 revenue (t = -3.63), freight revenue
1.11 -> 0.56. That cost is the bot's, not the rule's — its trains run engine-first,
so at a stub industry it sets a car out between itself and the only way out, and the
correct play is §A.5's facing-point move, which is the cross-turn planning TODO.md
already records as out of reach of any bot. Filtering self-recoupling moves out of its
options took recoupling from 625 of 1,029 set-outs to 101 of 677, and all 101 that
remain are that case. Read the number as a bot measurement, not a balance one.
THE SUPERINTENDENT'S RULING NAMES THE TRAINS IT IS ABOUT
Reported: the Superintendent could not tell which train he was clearing. The heading
asks the question now — "may Train 6 follow Train 4 onto the same Mainline card?" —
and the trains moved to the FRONT of each button, because the button splits its label
at the first em-dash and showed only the head.
AN INDUSTRY TRACK HOLDS FOUR CARS, LIKE EVERY OTHER CARD
Reported at undo 188: "we wanted to drop two cars, but were only allowed to drop one."
An industry track was built as long as its box count, so a one-box industry had room
for one car. Box count is how much WORK an industry can hold, not how much RAIL it
has. Ordinary track was the other exception, unbounded; both are gone and every card
holds four.
THE FREIGHT AGENT MAY STAGE A LOAD BEFORE THE CAR IS THERE
§6.3 asks nothing of the industry track — the empty car belongs to §9.3's Load the
car, which is the Laborer's action. The gate now lives only there, so cargo can wait
on the dock while the car to ship it in is still being switched in. Nothing can jam:
a load in a green box is waiting, not stuck.
THE TRUCK DOCK UNLOADS, AND BRINGS NOBODY
+1 inbound, no Laborer. It printed +1 outbound and +1 Laborer, which made it a
longer-host-list copy of Forklifts. Beside Packing Sheds it now does nothing at all,
and the hand tooltip says so before it is played.
Also in this release, from the days before: Mainline card tooltips computed from the
crossing rule; an Extra starts from the Division Point its number sends it to; a
modifier's suppressed grant comes back when a Whistle Post is upgraded; the Oil
Refinery and the Grocer's Warehouse ship as well as receive, per the card reference;
and the dormant defences name the attack they answer. `.claude/` is now gitignored —
it holds Claude Code's worktrees, i.e. a second checkout of this repository.
570 tests, typecheck clean. The three published replays were re-recorded twice —
legality changed, so bot play changed. Full detail in CHANGELOG.md.
This commit is contained in:
+50
-22
@@ -151,7 +151,10 @@ export function divisionSvg(nodes: DivisionView[]): string {
|
||||
cap: n.capacity,
|
||||
tip: dp
|
||||
? 'A Division Point — the end of the line. Trains both enter and leave the Division here (odd numbers run west, even run east), and queue without limit'
|
||||
: `${n.label} — Mainline${n.gradeUp ? `, climbs ${n.gradeUp === 'east' ? 'east' : 'west'}` : ''}${n.modifiers.length ? ` · ${n.modifiers.join(' · ')}` : ''}`,
|
||||
: `${n.label} — Mainline${n.gradeUp ? `, climbs ${n.gradeUp === 'east' ? 'east' : 'west'}` : ''}${n.modifiers.length ? ` · ${n.modifiers.join(' · ')}` : ''}` +
|
||||
// What the card actually DOES. The name alone left Hilly and Uncontrolled Siding as
|
||||
// words with no gameplay attached — reported exactly that way.
|
||||
(n.what ? `\n\n${n.what}` : ''),
|
||||
seat: null,
|
||||
// A Division Point is one region — the queue trains enter and leave the Division through.
|
||||
regions: dp ? 1 : (n.regions ?? 0),
|
||||
@@ -563,7 +566,7 @@ export function officeSvg(
|
||||
}
|
||||
}
|
||||
// MEN | AT | WORK — one physical sign, worked left to right loading and right to left
|
||||
// unloading. The spotted car sits past WORK, on the siding drawn below.
|
||||
// unloading. The spotted car sits past WORK, standing on the card itself.
|
||||
for (let i = 0; i < f.maw.length; i++) {
|
||||
out += box(bx, by, f.maw[i] !== null, 'bs-maw', ['M', 'A', 'W'][i]);
|
||||
bx += cellW + 2;
|
||||
@@ -623,21 +626,45 @@ export function officeSvg(
|
||||
}
|
||||
}
|
||||
|
||||
// Standing room, drawn as the printed squares: filled means occupied.
|
||||
//
|
||||
// `Math.max(1, …)` applies only to an industry, whose track is at least one car long. A Passenger
|
||||
// Facility has NO industry track — passengers board straight off the platform — so a Depot was
|
||||
// being drawn a siding slot it cannot spot a car on.
|
||||
const spots = cell.facility
|
||||
? cell.facility.kind === 'passenger'
|
||||
? cell.facility.trackCap
|
||||
: Math.max(1, cell.facility.trackCap)
|
||||
: cell.cars.length;
|
||||
for (let i = 0; i < Math.min(spots, 4); i++) {
|
||||
const filled = i < cell.cars.length;
|
||||
const carTip = filled
|
||||
? `${cell.cars[i]} standing here`
|
||||
: 'an empty space on this track — a car may be spotted here';
|
||||
/**
|
||||
* THE CARS STANDING HERE — NO PRINTED SIDING BEHIND THEM.
|
||||
*
|
||||
* An industry card used to draw one empty square per unit of its capacity, which read as a
|
||||
* siding of a particular length printed on the card. No industry card prints one. Worse, the
|
||||
* length came from the box count, so a one-box industry drew a single square and looked like it
|
||||
* could only ever hold one car — which is exactly what the engine was wrongly enforcing.
|
||||
*
|
||||
* Every card, industry or not, now draws what is actually standing on it and nothing more. Four
|
||||
* is the ceiling everywhere (`MAX_CONSIST`), so the row cannot overflow the card.
|
||||
*
|
||||
* The 4 is written out rather than imported: this function's SOURCE is serialized into the
|
||||
* standalone replay page, where module imports are not in scope. Referencing the constant threw
|
||||
* `MAX_CONSIST is not defined` in the rendered HTML while typechecking perfectly here.
|
||||
*/
|
||||
/**
|
||||
* WHICH SIDE OF THE ENGINE THE CUT IS ON.
|
||||
*
|
||||
* Reported from play: "right after dropping my cars I need to be able to see if those cars are
|
||||
* ahead or behind the train." They were drawn as one strip starting at the left edge whether a
|
||||
* train was on the card or not, so the picture could not say.
|
||||
*
|
||||
* `cars` runs WEST TO EAST and `standingWest` is how many of them are west of the train, so the
|
||||
* row is split there: the west cars stay left-aligned, the east cars are pushed over to the
|
||||
* right-hand end, and the gap between them is where the engine is standing. Whether that gap
|
||||
* means "ahead" or "behind" is the engine's facing, which the tooltip says in words rather than
|
||||
* leaving the player to work out from the compass.
|
||||
*/
|
||||
const split = cell.train ? Math.max(0, Math.min(cell.cars.length, cell.standingWest ?? 0)) : 0;
|
||||
const shown = Math.min(cell.cars.length, 4);
|
||||
for (let i = 0; i < shown; i++) {
|
||||
// With no train on the card there is no gap to leave, so the whole cut stays left-aligned.
|
||||
const westOfEngine = cell.train ? i < split : true;
|
||||
const side = !cell.train
|
||||
? 'standing here'
|
||||
: (cell.train.facing === 'e') === westOfEngine
|
||||
? 'standing BEHIND the engine — it would couple onto the tail backing up'
|
||||
: 'standing AHEAD of the engine — it would couple onto the nose pulling forward';
|
||||
const carTip = `${cell.cars[i]} ${side}`;
|
||||
/**
|
||||
* WHICH CAR IS STANDING HERE, not just that one is.
|
||||
*
|
||||
@@ -666,7 +693,7 @@ export function officeSvg(
|
||||
// A caboose is never "loaded" in the freight sense (carLabel says so), so it is drawn solid:
|
||||
// it is a car that is doing its job, not an empty waiting for one.
|
||||
const loaded = /^loaded/.test(car) || /caboose/.test(car);
|
||||
const cls = filled ? ` bs-occ bs-car-${type}${loaded ? ' bs-loaded' : ' bs-mt'}` : '';
|
||||
const cls = ` bs-occ bs-car-${type}${loaded ? ' bs-loaded' : ' bs-mt'}`;
|
||||
/**
|
||||
* LOADED OR EMPTY, TOLD THE SAME WAY THE TRAY TELLS IT.
|
||||
*
|
||||
@@ -678,10 +705,11 @@ export function officeSvg(
|
||||
* Now the card matches the tray — solid face for loaded, hollow for empty — and every slot
|
||||
* carries the car's own words as a tooltip, so "loaded hopper" is one hover away.
|
||||
*/
|
||||
out += `<rect class="bs-slot${cls}" x="${8 + i * 30}" y="${H - 26}" width="26" height="15" rx="2" data-tip="${esc(carTip)}"/>`;
|
||||
if (filled) {
|
||||
out += `<text class="bs-carlab${loaded ? ' bs-lab-ld' : ''}" x="${21 + i * 30}" y="${H - 15}" text-anchor="middle" data-tip="${esc(carTip)}">${esc(type)}</text>`;
|
||||
}
|
||||
// West cars run rightwards from the left edge; east cars run leftwards from the right edge, so
|
||||
// the engine's place in the row is the gap left between them.
|
||||
const sx = westOfEngine ? 8 + i * 30 : W - 34 - (shown - 1 - i) * 30;
|
||||
out += `<rect class="bs-slot${cls}" x="${sx}" y="${H - 26}" width="26" height="15" rx="2" data-tip="${esc(carTip)}"/>`;
|
||||
out += `<text class="bs-carlab${loaded ? ' bs-lab-ld' : ''}" x="${sx + 13}" y="${H - 15}" text-anchor="middle" data-tip="${esc(carTip)}">${esc(type)}</text>`;
|
||||
}
|
||||
|
||||
if (cell.enhancements.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user