mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 19:56:43 +00:00
TrainStationMapAdapter.cost(node) uses node.getPassengerDemandScore() so higher passenger demand and level → slightly lower traversal cost:
const demand = node.getPassengerDemandScore(); return 1 / (1 + 0.25 * demand);
This commit is contained in:
@@ -264,7 +264,11 @@ export class TrainStationMapAdapter implements GraphAdapter<TrainStation> {
|
||||
}
|
||||
|
||||
cost(node: TrainStation): number {
|
||||
return 1;
|
||||
// Favor higher-demand stations slightly by reducing their traversal cost.
|
||||
const demand = node.getPassengerDemandScore(); // ~0..level
|
||||
const baseCost = 1;
|
||||
const alpha = 0.25; // tuning knob
|
||||
return baseCost / (1 + alpha * demand);
|
||||
}
|
||||
|
||||
position(node: TrainStation): { x: number; y: number } {
|
||||
|
||||
Reference in New Issue
Block a user