make turnout description more clear. fix curves from breaking running track.
This commit is contained in:
@@ -406,6 +406,20 @@ export function allReachable(
|
||||
// Placement
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Does this card carry the through route — an east-west road straight across it?
|
||||
*
|
||||
* The Running Track is the road trains run on, Limits to Limits, and every card standing in it has
|
||||
* to pass traffic along the row. A curve does not: it has one road, from an east or west edge round
|
||||
* to a 45° leg, and dropping one into the running row DEAD-ENDS the main there. Straights, turnouts,
|
||||
* Limits signs, the Office and industries all carry it.
|
||||
*/
|
||||
export function carriesThroughTrack(card: TrackCard): boolean {
|
||||
return connectionsFor(card).some(
|
||||
([a, b]) => (a === 'e' && b === 'w') || (a === 'w' && b === 'e'),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gap 4a — a placed card must connect to existing track, and "connect" means `joins`: ports meeting
|
||||
* AND, on a north or south edge, 45° legs on the same diagonal.
|
||||
@@ -433,6 +447,10 @@ export function canPlaceAt(area: OfficeArea, coord: GridCoord, card: TrackCard):
|
||||
// with a Limits card stranded mid-track. The district below the Running Track is unbounded.
|
||||
if (coord.row === area.runningRow) {
|
||||
if (coord.col < area.limitsWest.col || coord.col > area.limitsEast.col) return false;
|
||||
// And it must not BREAK the Running Track. A curve laid here has no east-west road, so the main
|
||||
// stops dead at it — the bot did exactly this, turning the west end of its own Running Track
|
||||
// into a stub and cutting the Office off from the Limits.
|
||||
if (!carriesThroughTrack(card)) return false;
|
||||
}
|
||||
|
||||
const ports: Port[] = ['n', 's', 'e', 'w'];
|
||||
|
||||
Reference in New Issue
Block a user