From e6736e469886aa2ae83b051a8255b7dec722248f Mon Sep 17 00:00:00 2001 From: scamiv <6170744+scamiv@users.noreply.github.com> Date: Fri, 21 Nov 2025 18:30:20 +0100 Subject: [PATCH] Simplify fare calculation logic by separating length and congestion components for better clarity. --- src/core/game/Railroad.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/game/Railroad.ts b/src/core/game/Railroad.ts index 51c474eb2..37a8ef13c 100644 --- a/src/core/game/Railroad.ts +++ b/src/core/game/Railroad.ts @@ -38,15 +38,12 @@ export class Railroad { return this.tiles.length; } - /** - * Dynamic fare based on railroad length and current busyness. - * Longer railroads cost more, but overcrowded edges become less profitable. - * Uses integer math to keep amounts precise. - */ getFare(): bigint { - const baseFare = BigInt(this.getLength() * 100); // Base fare proportional to length - const busynessFactor = Math.max(1, 10 - this.trainCount); // 10,9,...,1 (capped) - return (baseFare * BigInt(busynessFactor)) / 10n; + const lengthFare = BigInt(this.getLength() * 100); // Base fare proportional to length + // Busy railroads should be more expensive: each train adds a congestion premium + const congestionFactor = BigInt(1 + this.trainCount); // 1,2,3,... + const congestionFare = (lengthFare * congestionFactor) / 10n; + return lengthFare + congestionFare; } }