deadhead-space-freight-tycoon/packages/sim/balance/measure-service.ts

25 lines
1.1 KiB
TypeScript

import { simulate } from "./simulate";
// Away service balance by hand (Step 27.7): `tsx balance/measure-service.ts <hours away>`.
// Independent fleets with events on and auto-repair at the default threshold.
const SEEDS = [12345, 777, 4242, 99, 2026, 31337, 8];
const HOURS = Number(process.argv[2] ?? 8);
const window = (worldSeed: number, mode: "active" | "away") =>
simulate({
worldSeed,
policy: "lighter-first",
durationMs: (3 + HOURS) * 3_600_000 + 3_600_000,
scenario: { atMinute: 180, minutes: HOURS * 60, mode },
});
for (const seed of SEEDS) {
const away = window(seed, "away");
const active = window(seed, "active");
const ratio = away.scenarioEarnings! / active.scenarioEarnings!;
console.log(
`seed ${seed}: away ${away.scenarioEarnings} / active ${active.scenarioEarnings} = ${(ratio * 100).toFixed(0)}%, ` +
`bookings ${away.service.bookings}, services ${away.service.started}, ` +
`most low-hull trips ${away.service.maxLowHullTrips}, repairs ${away.events.windowRepairSpend} cr, ` +
`violations ${away.violations.map((v) => `${v.rule} ${v.detail}`).join("; ") || "none"}`,
);
}