sots-engine/tests/game_sim
alex 0ebc222f45 lane N: the population -> base-output term, live-verified
Reads the whole colony output chain off the instruction stream (every range
disassembled to the next function start) and compares two of its functions
against the running game.

The population -> output law is linear and is carried by the executable:
output points per head are typeOutputModifier x 1.8 / 500000, and the
three-row population-type table is built in code rather than loaded, so the
imperial (1.0) and civilian (0.33f) modifiers are facts about the binary.

A system's total output is a SUM of three terms, not one multiplicative
chain. The station bonus scales only the imperial term and morale only the
civilian one, so OutputModifiers no longer carries either; they belong to
GroupOutputInputs. The function previously described as the base-output term
is the over-harvest RESOURCE demand, and it is corrected in place.

Live on VM140, both hooks in compare mode over two species and two workloads:
GroupOutput 13,105 calls / 0 divergences; ComputeTotalOutput 11,252 calls /
1 divergence of one ulp, in a value its caller rounds to an integer. Both
functions declare a whole-object Guard: 0 undeclared writes in 24,357 calls,
which is what makes the side-effect-free claim a measurement.

sim::Narrow forces the double rounding a 32-bit x87 build otherwise skips;
without it every civilian row came out one ulp low.

Also fixes ComputeBankruptcyLimits' elimination divisor, which was the
decimal -0.15 rather than the image's widened float -0.15000000596046448.
The two disagree for every maximum income divisible by 3 and for essentially
every empire above ~3,000,000.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ARBgSooAfokKUy6wKUKEyZ
2026-09-08 12:11:36 -04:00
..
build_and_run.sh game/sim: strategic formulas as pure functions (economy, research, colony, movement), 356 checks 2026-09-07 17:28:45 -04:00
check.h b4: colony + movement hooks; 22 formula corrections (growth curve has no capacity term, range margin +0.05f, ties-to-even rounding); 3 verified signatures 2026-09-08 00:57:55 -04:00
CMakeLists.txt U: the SetResearched unlock cascade, and the prediction for the run that checks it 2026-09-08 06:26:00 -04:00
mini_json.h game/sim: strategic formulas as pure functions (economy, research, colony, movement), 356 checks 2026-09-07 17:28:45 -04:00
smoke_real_save.cpp game/sim: strategic formulas as pure functions (economy, research, colony, movement), 356 checks 2026-09-07 17:28:45 -04:00
test_colony.cpp lane N: the population -> base-output term, live-verified 2026-09-08 12:11:36 -04:00
test_economy.cpp lane N: the population -> base-output term, live-verified 2026-09-08 12:11:36 -04:00
test_movement.cpp movefleet: reproduce the original's float32 normalise; 8 of 45 live divergences -> 0 2026-09-08 03:50:04 -04:00
test_research.cpp b3: research hook + RNG-snapshot compare design; fix draw mapping to y/(2^32-1), NextInt inclusive, float32 odds, spend floor, decay constants 2026-09-07 23:14:08 -04:00
test_techgraph.cpp U: the SetResearched unlock cascade, and the prediction for the run that checks it 2026-09-08 06:26:00 -04:00