Run the bot simulator
Goal: compare strategies on the current game rules.
You need Node, the repository’s playwright dev dependency and a Chromium browser.
-
From the repository root, install Playwright and a browser once:
npm iandnpx playwright install chromium. -
If you already have a Chromium binary, tell the script where it is with the
PW_CHROMIUMenvironment variable. Without it, Playwright uses its own download.Terminal window PW_CHROMIUM=/path/to/chromium node sim/run.js 5 -
Run it with the number of game days as the argument (the default is 5):
Terminal window node sim/run.js 5One game day takes a few seconds of real time. A one-day run finished in about six seconds.
-
Read the summary printed at the end. Each of the five bots (Logger, Forester, Miller, Entrepreneur and Casual) gets a line:
== Miller: worth 30880, lumber 1875, proved up at 17.3h, cleared 61, standing 2, roads 1Below it come the buildings, the businesses with their earnings, and the sawmill state. The last line lists each market’s status, seller count and price.
-
Open
sim/results.jsonfor the full data. Every run overwrites it.
Net worth is lumber plus buildings at cost (cabin, barn, woodsheds, sawmill levels, business costs and roads at 200 each) plus logs held at 80 bd ft each. Snapshots happen every three game hours. Each bot has a series array of {h, lumber, sunk, worth}, and a final object with the end state and an events list of key moments.
The older result files kept for comparison are results-before-balance-fixes.json, results-after-balance-fixes.json, results-v16-5day.json and results-latest-1day.json. Run the simulator before and after a rule change and compare worth.
What can go wrong
Section titled “What can go wrong”The older README says the script hard-codes a sandbox path for the browser. The current script only uses a custom browser when PW_CHROMIUM is set. If you see “Executable doesn’t exist”, run npx playwright install chromium or set PW_CHROMIUM.
results.json is overwritten on every run and is not tracked by git. Copy it to a dated name if you want to keep a run. The four named result files in the folder are the ones kept in git.
Bots do not farm or buy Reserve stands. They share mill yards and count each other’s businesses as competitors, but each plays its own town.
A short run favors bots that spend little. Run at least five days before judging balance.