diff --git a/findings/subsystems/income-term.md b/findings/subsystems/income-term.md index a0d21df..d31b5b4 100644 --- a/findings/subsystems/income-term.md +++ b/findings/subsystems/income-term.md @@ -63,9 +63,17 @@ out[3] = _ftol2( TradePointsToMoney( [ebp-0x28] + [ebp-0x40] + [ebp-0x18] ) ) with * `[ebp-0x40]` = `round(round(ComputeTotalOutput(SRoh)) × SRt)` — the **trade points**; -* `[ebp-0x28]` = leftover **science** points, non-zero only when the repair block ran; +* `[ebp-0x28]` = the trade share of the leftover **ship-construction** points, non-zero only + when the build queue and the repair pass left some over; * `[ebp-0x18]` = leftover **terraforming** points, itself fed by leftover **industry** points. +**Correction (lane C3).** This section originally called `[ebp-0x28]` "leftover **science** +points". There is no science channel in this function: `OutputRates+4` is the ship-construction +slider `SRsc`, 0x00746830 turns it into construction points, and the leftover is what the build +queue (0x008251e0) and the ship-repair pass (0x00751590) did not spend. Research is bought with +money at the empire level, not produced per system. `strategic-turn-internals.md` §3.3 had this +right. See `output-turn-path.md`. + `round` is 0x008e5660 (`fistp`/`fild`, ties to even); the outer conversion is the truncating `_ftol2`. Under the max-income rate vector all three of science, terraform and industry points are `round(T × 0) = 0`, and §2.4 shows both cascade sources are then zero, so @@ -112,9 +120,10 @@ Three corrections to `formula-gaps.md` Q3, which had this block as MEDIUM confid always `≥ 0`. `leftoverTerraform = 0 − min(0, ceil(that)) = 0`. (This corrects the implication in `output-term.md`'s "unspent terraforming points cascade into the money channel": they do cascade, but only when the terraform channel is actually funded.) -* Science: `out[7] = 0x00746830(sys, 0.0)`; with zero science points the repair block's guard - `esi > 0` fails and `[ebp-0x28]` keeps the `fldz` written at 0x00751d5f. *Inferred* — that - 0x00746830 returns 0 for an argument of 0 is read from its shape, not proven here. +* Construction: `out[7] = 0x00746830(sys, 0.0)`; with zero construction points nothing is left + over and `[ebp-0x28]` keeps the `fldz` written at 0x00751d5f. **Lane C3 upgraded this from + inferred to instruction-verified**: 0x00746830 with an argument of 0 returns + `ftol(k x (b x 0) + 0) = 0` on both its branches, so the guard really does fail. ### 2.5 `PopIncome(t)` — 0x0074d760 (instruction-verified) @@ -386,7 +395,15 @@ save's. Measured with `--commit-blocked=T31 --ai-player 1`: **0 closed, 0 regres and 108 -> 103, unchanged from the baseline). The same numbers hold with every other blocked phase committed alongside it. -### 6.2 P01 `ComputeBudget` -- NOT unblocked, and the roadmap's item 1 was wrong about this +### 6.2 P01 `ComputeBudget` -- NOT unblocked by THIS lane (closed by lane C3) + +> **Update, lane C3 (same day).** Everything this section says is right, and the turn path is +> now read and modelled: see `output-turn-path.md`. The one thing it did not anticipate is that +> the leftover construction points come back to the **trade** channel, so on a corpus where +> every build queue is empty the two paths give the same money to within one trade point -- +> which makes the `BnkEl` oracle an indirect check on the turn path after all. P01/P02 are +> committed and closed one leaf on each reference pair. + `ComputeBudget` has two modes and they take their per-system money from **different functions** (0x008631fd, the `[ebp+0xc]` test): @@ -400,7 +417,7 @@ else { OutputRates r; ComputeOutput(s, &r); money = r.out[3] } // 0x that path the science, construction and terraform channels are funded, which means: * the repair pass inside `ComputeOutputFromRates` runs (it is **not** side-effect free -- it repairs - ships in orbit), so its leftover science points can be non-zero; + ships in orbit), so leftover construction points can be non-zero; * the unspent-industry and unspent-terraforming cascades into the money channel are live, and §2.4's proof that both are zero **does not apply**; * the build queue's consumption of construction points is in the same call. diff --git a/findings/subsystems/output-term.md b/findings/subsystems/output-term.md index 62cf8f9..834dee1 100644 --- a/findings/subsystems/output-term.md +++ b/findings/subsystems/output-term.md @@ -35,7 +35,7 @@ The real population→output term is `PopOutput(0) + PopOutput(1) + SlaveOutput( | addr | name | conv / boundary | note | |---|---|---|---| -| 0x00751bb0 | `ServerSystem::ComputeOutputFromRates(int out[12], OutputRates* rates)` | thiscall, ends 0x00751fa8 | **repairs ships in orbit** — not compare-safe | +| 0x00751bb0 | `ServerSystem::ComputeOutputFromRates(int out[12], OutputRates* rates)` | thiscall `ret 8`, ends 0x00751fa0 | **repairs ships in orbit** — not compare-safe | | 0x00750480 | `ServerSystem::ComputeTotalOutput(double SRoh)` | thiscall `ret 8`, ends 0x007505a5 | **side-effect free** — the compare target | | 0x00747d30 | `ServerSystem::StripMineFraction()` | thiscall, returns float, ends 0x00747ddd | | | 0x007483b0 | `ServerSystem::OverHarvestDemand(double SRoh)` | thiscall `ret 8`, ends 0x007484c4 (Ghidra size 276 = correct here) | | @@ -49,6 +49,9 @@ The real population→output term is `PopOutput(0) + PopOutput(1) + SlaveOutput( | 0x00545cc0 | `SpeciesDef(int sp)` | cdecl | table at .bss 0x00b10a00, stride 0x184, 7 rows | | 0x008e5680 | `signed_cbrt(double)` | cdecl | `x>=0 ? pow(x,1/3) : -pow(-x,1/3)`; exponent is the double 1/3 at 0x00a3a7c8 | +(Boundary corrected by lane C3: the `ret 8` is at 0x00751fa0 and 0x00751fa3..0x00751faf is +`int3` padding, so the 0x00751fa8 above was padding, not code.) + `ComputeOutputFromRates` is reached from `ComputeOutput` 0x00751fb0 (projected) and `ComputeMaxIncome` 0x007521c0 (max), which are what `ComputeBudget` 0x00863030 and `UpdateBankruptcyLimits` 0x00818600 call. diff --git a/findings/subsystems/output-turn-path.md b/findings/subsystems/output-turn-path.md new file mode 100644 index 0000000..ff4aa01 --- /dev/null +++ b/findings/subsystems/output-turn-path.md @@ -0,0 +1,505 @@ +# `ComputeOutput` on the turn path (lane C3, 2026-09-08) + +`ServerSystem::ComputeOutput` 0x00751fb0 and the whole of `ComputeOutputFromRates` +0x00751bb0 — the money `ComputeBudget` actually sums during a turn, as opposed to the +projected-mode `ComputeMaxIncome` that lane E1 closed at 25/25 on the `BnkEl` oracle. + +Evidence: own `objdump -d` pass over `Sword of the Stars.exe`. Both ranges disassembled to +the **next function start** and the real boundary found (rule 17). Field names per +`findings/objects/struct-recovery.md`. Everything marked *instruction-verified* is read off +the instruction stream; everything marked *inferred* is not. + +This supersedes two labels in earlier notes: + +* `income-term.md` §2.2 calls `[ebp-0x28]` "leftover **science** points". There is no science + channel in this function. `OutputRates+4` is the **ship-construction** slider `SRsc`, the + helper at 0x00746830 turns it into **construction points**, and the "leftover" is what the + build queue and the ship-repair pass did not spend. `strategic-turn-internals.md` §3.3 had + this right; the income lane's paraphrase did not. +* `output-term.md` §1 gives `ComputeOutputFromRates`'s end as 0x00751fa8. The `ret 8` is at + **0x00751fa0**; 0x00751fa3..0x00751faf is `int3` padding. E1's 0x00751fa0 is correct. + +--- + +## 1. The call chain + +| addr | name | conv / boundary | note | +|---|---|---|---| +| 0x00751fb0 | `ServerSystem::ComputeOutput(int out[12])` | thiscall `ret 4`, ends 0x00752070 | Ghidra size 192 = correct | +| 0x00751bb0 | `ServerSystem::ComputeOutputFromRates(int out[12], OutputRates*)` | thiscall `ret 8`, ends 0x00751fa0 | **repairs ships in orbit** | +| 0x00747390 | `NormaliseOutputRates(float rates[4], ServerSystem*, float* pinned)` | **cdecl** | pinned = null → trade | +| 0x00750480 | `ServerSystem::ComputeTotalOutput(double SRoh)` | thiscall `ret 8` | lane N; side-effect free | +| 0x00746830 | `ServerSystem::ConstructionPoints(double consShare)` → int | thiscall `ret 8`, ends 0x00746883 | shipyard-station bonus | +| 0x00815c10 | `ServerSystem::StationCount(ServerPlayer*, int kind)` | cdecl-through-thiscall | **kind 1** here (shipyards) | +| 0x008251e0 | `BuildQueue::TotalConstructionLeft()` → int | thiscall `ret 0`, 23 bytes | Σ `conleft` over the order list | +| 0x00751590 | `ServerSystem::RepairShipsInOrbit(int points, bool estimateOnly)` → int | thiscall `ret 8`, ends 0x007517b5 | **the side effect**; returns points LEFT | +| 0x00745d60 | `ServerSystem::IdealSuitability()` → double | thiscall `ret 0`, ends 0x00745dc0 | §2.6 | +| 0x00746890 | `ServerSystem::TerraformPointsNeeded()` → double | thiscall `ret 0`, ends 0x0074690d | §2.5 | +| 0x0074c6f0 | `ServerSystem::CivilianConsumption()` → int | **reads `esi` as `this`** | resource ledger only | +| 0x007483b0 | `ServerSystem::OverHarvestDemand(double SRoh)` | thiscall `ret 8` | lane N | +| 0x007505b0 | `ServerSystem::TradePointsToMoney(double trade)` → double | thiscall `ret 8` | lane E1 | +| 0x008e5660 | `round(double)` | cdecl | `fistp`/`fild`, ties to **even** | +| 0x00925220 | `_ftol2` | — | truncating | +| 0x009dd1e4 | `ceil` (MSVCR100) | IAT | | +| 0x0083a5b0 | `TradeManager::SystemRouteIncome(mgr, sys, ServerPlayer*, int* a, int* b)` | `ret 0x10` | fills `out[4]`,`out[5]` | +| 0x007460b0 | `SystemRepairDemandForOwner(ServerPlayer*)` → int | **reads `ebx` as `sys`** | fills `out[6]` | + +Two non-standard conventions worth flagging (both would be silently wrong if taken as +`__thiscall`): 0x0074c6f0 takes its `this` in **ESI** and 0x007460b0 takes the system in +**EBX**. Both are compiler-local helpers that inherit a register the caller happens to hold. + +--- + +## 2. The formula + +### 2.1 `ComputeOutput(out)` — 0x00751fb0 (instruction-verified) + +``` +if (out == 0) return +memset(out, 0, 48) // 12 dwords; slots 10 and 11 are FLOATS +if (sys->PID /*+0x100*/ == 0) return +ComputeOutputFromRates(out, &sys->Rts) // sys+0x88 -- the system's OWN sliders, unnormalised +if (sys->[0x230] != 0) return // a byte; NOT on the wire +mgr = server->vtbl[2]() // server = sys->+0x10, the RAW StrategyServer base +TradeManager::SystemRouteIncome(mgr, sys, sys->PID, &a, &b) +out[4] = a ; out[5] = b +out[6] = SystemRepairDemandForOwner(sys->PID) // 0x007460b0, `sys` arrives in EBX +``` + +**`out[3]` — the money — is written entirely inside `ComputeOutputFromRates`.** Nothing after +that call touches it, so the trade-route and repair-demand slots are reporting only. + +`ComputeBudget` 0x00863030 confirms this at 0x008631fd: + +``` +for s in player->systems: + if (s->Abdn /*+0xc4*/) continue + if (projected) money = ComputeMaxIncome(s) // 0x007521c0 + else { int o[12]; ComputeOutput(s, o); money = o[3]; } // [ebp-0xe0 + 0xc] + if (money > 0) income += money // budget+0x04 + if (money < 0) expense += -money // budget+0x1c +``` + +### 2.2 The `OutputRates` memory layout (instruction-verified) + +`ServerSystem+0x88`, 0x1c bytes, seven dwords. The **memory** order is not the wire order: + +| offset | field | who reads it | +|---|---|---| +| +0x00 | `SRt` trade | trade points, and the leftover weight | +| +0x04 | `SRsc` **ship construction** | construction points | +| +0x08 | `SRtf` terraform | zeroed by normalisation when `Suit == IdealSuitability()` | +| +0x0c | `SRi` infrastructure | zeroed by normalisation when `f32(Infra + ibon) >= 1` | +| +0x10 | `SRoh` over-harvest | `ComputeTotalOutput` / `OverHarvestDemand` | +| +0x14 | `SRs` | not read here (slave death rate) | +| +0x18 | `SRnr` (int) | not read here | + +The suppressions are read off `NormaliseOutputRates` 0x00747390: `[edi+0x8] := 0` under the +`Suit == IdealSuitability()` branch and `[edi+0xc] := 0` under `1.0 <= f32(ibon + Infra)`. +The wire order (`SRs, SRt, SRsc, SRtf, SRi, SRoh, SRnr`) is a serialiser choice. + +### 2.3 `ComputeOutputFromRates(out, rates)` — 0x00751bb0 (instruction-verified) + +``` +memset(out, 0, 48) +if (sys->PID == 0) return +r = *rates // 7 dwords copied to the stack: the caller's +NormaliseOutputRates(&r, sys, 0) // struct is never modified + +T = round( ComputeTotalOutput(r.SRoh) ) // ties to even, kept as a double +tradePts = round( T * r.SRt ) +consPts = round( r.SRsc * T ) +terraPts = round( r.SRtf * T ) +infraPts = round( r.SRi * T ) +out[0] = ftol(T) + +// --- resource ledger (independent of everything below) ------------------------- +need = ftol(OverHarvestDemand(r.SRoh)) + CivilianConsumption() +resAvail = sys->Res + (PID->[0x138] ? sys->MRes + sys->ARes2 : 0) +out[2] = min(resAvail, max(need, 0)) +out[1] = min(out[2], ftol(OverHarvestDemand(r.SRoh))) + +// --- construction --------------------------------------------------------------- +queueNeed = sys->BQ ? BuildQueue::TotalConstructionLeft(sys->BQ) : 0 +out[7] = ConstructionPoints(consPts) // ftol(c + stations*BONUS*c) +out[8] = min(queueNeed, out[7]) +rem = max(out[7] - out[8], 0) +out[9] = 0 +if (rem > 0): + left = RepairShipsInOrbit(rem, /*estimateOnly=*/false) + out[9] = rem - left + rem = left + +// --- the leftover redistribution ------------------------------------------------- +Ltrade = Lterra = Linfra = 0.0 +if (rem > 0): + P = (double) rem + if (r.SRsc == 1.0): // an exact == + wT = 1.0 + wF = (sys->Suit != IdealSuitability()) ? 1.0 : 0.0 + wI = (sys->Infra != 1.0) ? 1.0 : 0.0 + else: + wT = r.SRt ; wF = r.SRtf ; wI = r.SRi + S = wI + (wF + wT) // that association + Ltrade = round( wT * P / S ) + Lterra = round( wF * P / S ) + Linfra = round( wI * P / S ) + +// --- infrastructure -------------------------------------------------------------- +infraNeed = ceil( (1.0 - sys->Infra) / 3.3e-5 ) // 0x00a1f930 +poolI = Linfra + infraPts +spendI = min(poolI, infraNeed) +leftI = max(poolI - spendI, 0) +out[10] = (float) max( spendI / 500.0 * 0.01 * 1.65, 0 ) // three 80-bit steps + +// --- terraforming ---------------------------------------------------------------- +terraNeed = ceil( TerraformPointsNeeded() ) +poolF = (Lterra + terraPts) + leftI // the infra cascade lands HERE +spendF = min(poolF, terraNeed) +leftF = max(poolF - spendF, 0) +sign = (IdealSuitability() < sys->Suit) ? -1.0 : 1.0 +out[11] = (float) ( sign * (spendF * 1.5 * 1.2f * PID->TerraMod) / 20000.0 ) + +// --- money ----------------------------------------------------------------------- +out[3] = ftol( TradePointsToMoney( (Ltrade + tradePts) + leftF ) ) +``` + +Two things this makes explicit that no earlier note stated: + +1. **The infrastructure leftover cascades into the terraform pool, and the terraform + leftover cascades into money.** There is no direct industry→money edge; it is two hops. + `income-term.md` §2.4's "both cascade sources are zero" is right for the max-income rate + vector (where `infraPts = terraPts = 0` *and* both needs are `>= 0`) but says nothing + about the turn path. +2. **The construction leftover's trade share is added to the money channel.** On a colony + whose build queue is empty, every construction point the system produced comes back as + trade points. A system with `SRt = 0, SRsc = 1` and an empty queue therefore earns + **exactly as much money** as one with `SRt = 1`. That is the single most consequential + fact in this function and it is why the corpus's turn-path money is so close to its + projected money (§4). + +### 2.4 `RepairShipsInOrbit(points, estimateOnly)` — 0x00751590 (instruction-verified) + +``` +if (points == 0) return 0 +need = 0 ; cand = vector() +for i in 0 .. sys->vtbl[2]()-1: // fleets at the system + f = sys->vtbl[4](i) + if (f->[0x58] != sys->PID) continue + if (!Fleet::TestFlags(f, 0, 8)) continue + for sh in f->ships (+0xa4 .. +0xa8): + if (!Ship::TestFlags(sh, 0, 8)) continue + c = Ship::RepairCost(sh, 1) // 0x00815180 + if (c <= 0) continue + need += c + if (!estimateOnly) cand.push_back(sh) +if (estimateOnly) return max(points - need, 0) +// round robin +progress = true +while (progress && points > 0): + share = max(points / cand.size(), 1) // integer divide + progress = false + for sh in cand: + if (points <= 0) return points + take = min(Ship::RepairCost(sh, 1), share) + if (take > 0) { Ship::ApplyRepair(sh, take); progress = true; points -= take } +return points +``` + +**The round robin is equivalent to `points - min(points, need)`** and this is a proof, not an +observation: `share >= 1` always, so every ship with a positive remaining cost takes at least +one point per pass; the loop can only stop early via `progress == false`, which requires every +remaining cost to be zero. So the pass ends with `points == 0` (need was the binding +constraint) or with every cost zero (points was). The engine models it as the `min` and pins +the equivalence in a test rather than reproducing the round robin. + +`ComputeOutputFromRates` passes `estimateOnly = 0`, so **this is the B1 replace double-run +hazard**: calling the original to harvest a value repairs ships. The engine never does. + +### 2.5 `TerraformPointsNeeded()` — 0x00746890 (instruction-verified) + +``` +if (PID == 0) return 0.0 +sign = (IdealSuitability() < sys->Suit) ? -1.0 : 1.0 // 0x009e3348 = -1.0 +rate = f32(PID->TerraMod /*+0x134*/) * 1.8000000715255737 // 0x00a1f928 = (double)1.8f +d = fabs( f32(IdealSuitability() - sys->Suit) ) +return d / fabs( rate * sign / 20000.0 ) +``` + +The `fabs` is after the sign multiply, so the sign cancels and the result is always `>= 0` +(E1's §2.4 reading confirmed). Note `1.8f` here is the same number as `1.5 * 1.2f` in +`out[11]` — `1.5 * 1.2000000476837158 == 1.8000000715255737` exactly — so the point count and +the point value use one rate, folded differently. + +`TerraMod == 0` makes this `+inf`, `ceil(+inf) = +inf`, and the terraform channel then absorbs +its whole pool with nothing cascading to money. No corpus player has `TerraMod == 0` (Human +and Tarkas carry 1.0, species 4 carries 3.7), so that branch is **unexercised**. + +### 2.6 `IdealSuitability()` — 0x00745d60 (instruction-verified) + +``` +if (sys->PID == 0) return (double) sys->Suit // an unowned system is "at its ideal" +v = PID->IdealSuit /*+0xb0*/ +if (sys->indi /*+0x1c8*/) v = StrategyServer::IdealSuit(sys->server, sys->indi->indsp) +if (sys->dsu /*+0x118*/ != SENTINEL) v = sys->dsu // SENTINEL is the float at 0x00aeca6c +return v +``` + +This is **not** the same source `CalcSuitMod` uses in the money cost (E1 §2.6 reads the +server's per-species array there). Here the owner's own `IdealSuit` field is the default and +the server array is only consulted for an independent colony. In the 11-save corpus the two +agree, so the difference is instruction-verified only. + +`dsu` is `3.4028235e38` (`FLT_MAX`) on **every system of every corpus save**, so the override +never fires and the sentinel's identity is *inferred* from that (the value at 0x00aeca6c is a +data-file-loaded `GlobalConst` slot, not a `.rdata` literal, so it was not read directly). + +### 2.7 `ConstructionPoints(cons)` — 0x00746830 (instruction-verified) + +``` +if (PID == 0) return ftol(cons) +k = StationCount(sys, PID, 1) // 1 = shipyard +b = (STATION_BONUS_SHIPCON > 0) ? STATION_BONUS_SHIPCON : 0 +return ftol( k * (b * cons) + cons ) +``` + +Note the association `((b * cons) * k) + cons`, and that the bonus is ignored unless strictly +positive — the same "unloaded tuning table reads as 1.0, not 0.0" guard the output term has. + +--- + +## 3. What this needs that the max-income path did not + +| input | source | held? | +|---|---|---| +| `Rts` (5 floats) | wire, `Sys/Rts` | yes | +| `IdealSuitability()` | `Player/IdealSuit`, `Sys/dsu`, `Sim/ISsu[]` | yes | +| `Infra`, `ibon` | wire | yes | +| shipyard station count | `Sys/NumSnF` | yes (0 on every corpus system) | +| build-queue demand Σ`conleft` | wire, `Sys/BQ/ords` | yes | +| **ship repair demand in orbit** | needs `Ship::RepairCost` 0x00815180 over the fleets at the system | **NO** | +| `TerraMod` | wire, `Player/TerraMod` | yes | +| the output total | lane N | yes | + +**One input of nine is missing**, and it is the repair demand. It is zero whenever no ship in +orbit is damaged. On the two reference pairs the human's and the AI's colonies carry no fleet +at all in the input state except Ke'Dolarra (turn 2) and Koa'Vo, so the exposure is small but +not provably nil; the engine takes it as an explicit input defaulting to 0 and reports it. + +--- + +## 4. PREDICTION — written before the build + +The corpus turns out to make this function much simpler than it looks, and the predictions +below are the consequences. + +Measured facts about the corpus, from the wire (`Sys/Rts`, `Sys/dsu`, `Sys/BQ`, `Sys/NumSnF`, +`Player/IdealSuit`, `Player/TerraMod`), before any model was written: + +* every owned colony in all 11 saves has `Suit == IdealSuit` **exactly** and `Infra == 1.0` + exactly, so `NormaliseOutputRates` zeroes both `SRtf` and `SRi` on every one of them; +* consequently `infraNeed = ceil(0/3.3e-5) = 0`, `terraNeed = ceil(0/rate) = 0`, and + `infraPts = terraPts = 0`; +* no system carries a station, so the shipyard bonus is 1; +* `dsu` is `FLT_MAX` everywhere, so the ideal-suitability override never fires; +* the sliders that occur are `{t .5, sc .5}`, `{t 0, sc 1}`, `{t .04, sc .96}` and + `{.25,.25,.25,.25}`; after suppression they normalise to `{t, 1-t, 0, 0}`. + +### 4.1 What I expect + +1. **The leftover redistribution collapses to "all of it to trade" on every corpus colony.** + In the `SRsc == 1` branch the weights are `(1, 0, 0)` because suit is at the ideal and + infra is exactly 1; in the other branch they are `(SRt, 0, 0)`. Either way + `Ltrade = round(P) = P` and `Lterra = Linfra = 0`. +2. **Therefore `out[3] = ftol(TradePointsToMoney(round(T*SRt) + ftol(round(T*SRsc))))`**, and + with an empty build queue and no repairs the argument is `2*round(T/2)` for a 50/50 colony + and `T` for a pure-construction one — i.e. **within ±1 of `ComputeMaxIncome`'s `T`**. +3. **The turn path's money therefore equals the projected path's money to ±1 trade point on + this corpus.** If that is right, the `BnkEl` oracle — which constrains only the projected + path — becomes an *indirect* check on the turn path here, and only here. +4. Numerically, using the `BnkEl` the oracle saves already carry (inverted through + `ftol(maxIncome / -0.15000000596046448)`): + + | player | pair | oracle's `Sav` move | decomposition | + |---|---|---|---| + | 576 Independent Colony | 1→2 | `0 → 98871` | `99871 − 1000 maint + 0 interest` | + | 576 | 2→3 | `98871 → 198730` | `99871 + 988 interest − 1000 maint` | + | 16 human | 1→2 | `50000 → 289688` | `239188 + 500 interest`, and `239189` is the max income of the **post-growth** turn-2 colony | + | 16 human | 2→3 | `289688 → 532369` | `239785 + 2896 interest`, again post-growth | + + So `ComputeBudget` runs on the colony state **after** `S11 SystemTurn` — the strategic + driver runs the system turn at index 11 and the player driver at index 13 — and the + human's system income is the post-growth number. + +5. **What will therefore close, and what will not:** + * Player 576's income does **not** move with growth (Koa'Vo has no civilian population and + its `BnkEl` is identical in all three saves), so its `Sav` should come out **exactly** + right on both pairs. **+1 leaf per pair.** + * Player 16's income **does** move with growth, and our `S11` does not commit civilian + growth (it needs the carrying capacity). Our number will be short by **597** on pair 1 + and **596** on pair 2, so `Sav` stays wrong — but it was already wrong, so **0 regressed**. + * Player 32 (the AI) picks a research target and changes `ResRate` during the turn; that is + Rung B. Not closed. + * The 24 `turnstats` leaves need the budget **and** ship construction (lane E2's finding). + Not closed by this lane alone. + * `PvSav` is `S00`'s snapshot, not `P02`'s write, and player 32's `PvSav` is not its + pre-turn `Sav`, so it is left alone. + + **Predicted total: pair 1 closed 1 regressed 0; pair 2 closed 1 regressed 0.** +6. The two research RNG words stay out of the generator model, and for a **new** reason: the + allocation is now computable, but no player in either input state carries a research + target (`ResTNm` is empty on 16 and 32 in `turn1-state`), so `ProcessResearch` has nothing + to fund. The blocker moves from "the money is unmodelled" to "the AI's target selection + is unmodelled". + +### 4.2 Falsification — how this could be wrong, and the symptom of each + +| way it could be wrong | symptom | +|---|---| +| `OutputRates+4` is not construction but something else, so `SRsc == 1` is not what the leftover branch tests | player 576 (whose rates are `.25/.25/.25/.25`, the only four-way vector) would miss while the `{0,1}` colonies matched, or vice versa | +| the leftover weights are the **raw** sliders, not the normalised ones | 576 misses by a clean ratio (`.25` vs `.75` denominators); the `{t,1-t}` colonies are unaffected because the ratio is the same | +| `Ltrade` is *not* added to the money channel (i.e. I misread the slot reuse of `[ebp-0x28]`) | every colony's money collapses to `round(T*SRt)`, so the `{t 0, sc 1}` colonies earn **zero** and player 32's and the turn-2/3 colonies' income falls by 100 % — a very loud failure | +| the budget runs **before** `S11`, and the human's +597 has another source | player 576, whose income does not move with growth, would still match, so this is NOT separable on 576 — it is separable only on 16, where a pre-growth budget predicts `289092` and a post-growth one `289688` | +| the repair pass consumes points on a corpus colony | player 576 (Koa'Vo has one fleet in every save) misses low by the repair spend; 16's homeworld has no fleet in `turn1-state`, so a 576-only miss names this | +| the round robin is not equivalent to the `min` | only visible where `points < need`; unexercised here | +| `ConstructionPoints` truncates where I read a round | off-by-one on colonies whose `T*SRsc` is not integral — but `T` is already an integer and the sliders are exact binary fractions on most colonies, so this is nearly invisible; `{.04, .96}` (Downbelow) is the one colony that would show it, and it is not on either reference pair | +| `sys->[0x230]` gates something that feeds money | it cannot: `out[3]` is written before that test and never again | + +A run that closes player 576 and nothing else is a **weak** result and will be reported as +one: it is one leaf per pair, and it is the leaf where the missing upstream input happens not +to matter. + +--- + +## 5. The result + +Engine: `sim::ComputeSystemOutput` (`src/game/sim/colony.{h,cpp}`) plus +`sim::IdealSuitability` and `sim::RepairShipsInOrbit`, wired into `P01`/`P02` through +`BuildBudgetFeeds` in `src/app/turn.cpp`. Host `ctest` 46/46, clean-room OK, both run as +separate commands. + +``` +reference pair turn1-state -> turn2-state 209 -> 157 closed 52 regressed 0 (was 51 / 0) +second pair turn2-state -> turn3-state 108 -> 86 closed 22 regressed 0 (was 21 / 0) +``` + +**Closed 1 per pair, regressed 0 per pair.** The leaf is +`/Sim/players/Player[576 "Independent Colony"]/Sav` on both. + +### 5.1 Every prediction in §4.1, checked + +| predicted | outcome | verdict | +|---|---|---| +| the leftover redistribution collapses to "all to trade" on every corpus colony | it does; `leftoverToTrade == leftover` on all of them | HELD | +| the turn path equals the projected path to within the trade-point rounding when the queue is empty | **exactly equal on 5 of the 11 saves** — every save whose build queues are all empty | HELD | +| player 576's `Sav` comes out exactly right on both pairs | `0 -> 98871` and `98871 -> 198730`, both exact | HELD | +| player 16's `Sav` is short by the uncommitted civilian growth | `289092` against the oracle's `289688` | HELD (the amount was predicted as 597 and is **596** — see §5.2) | +| player 32 is not closed | `297492` against `92651` | HELD | +| the `turnstats` leaves are not closed | not closed | HELD | +| pair 1 closed 1 regressed 0; pair 2 closed 1 regressed 0 | exactly that | HELD | +| the two research RNG words stay out of the generator model | they do, for the predicted reason | HELD (§5.5) | + +Nothing in §4.2's falsification table fired. In particular the loudest one — "the construction +leftover does not reach money" — would have collapsed every `{SRt 0, SRsc 1}` colony's income +to zero, and those colonies price correctly. + +### 5.2 The prediction that was off, and why + +§4.1 said player 16 would be short by **597** on pair 1. It is short by **596**. The +arithmetic: our pre-growth output gives a max income of 238,592 and the post-growth one gives +239,189, a gap of 597 — but the oracle's own turn-path number is 239,188, one *below* its +projected 239,189, because `2 x round(T/2)` lost a point on the post-growth total and did not +on the pre-growth one. So the two errors partly cancel, and the residual is the growth gap +minus one trade point. The mechanism was predicted; the sign of its interaction was not. + +### 5.3 The strongest check available without a VM + +The engine now runs every owned system through **both** paths on the same colony state and +reports the difference, every run. The projected sum is the number the save's own `BnkEl` +states and that lane E1 scored 25/25 against, so a large delta is the new model failing and it +is visible on load. + +| save | landed players agreeing exactly | worst \|delta\| | explanation | +|---|---|---|---| +| `turn1-state`, `turn2-state`, `turn3-state` | 3 of 3 | 0 | every build queue empty | +| `human-turn2-orders` | 2 of 2 | 0 | every build queue empty | +| `zuul-turn15-orders` | 2 of 2 | 0 | every build queue empty | +| `human-turn3-noderoute` | 1 of 2 | **37** | queues empty; one trade point crossed a five-point block: `5 money x 5 x IncMod 1.48 = 37` | +| `zuul-turn23-fleet23` | 1 of 2 | **2035** | Gallandro's queue holds 370 points: `370 x 5 x 1.1 = 2035` | +| `zuul-turn17-orders2`, `-rollpending` | 0 of 2 | **21010** | W'kanda's queue holds 3818: `3820 x 5 x 1.1 = 21010` (the block count moves by 3820, not 3818, because of the two `mod 5` offsets) | +| `zuul-turn16-noderoute` | 0 of 2 | **36438** | W'kanda's queue holds 6626: `6625 x 5 x 1.1 = 36437.5`, and two independent truncations put it at 36438 | +| `zuul-turn5-species5` | 1 of 2 | **39160** | W'kanda's queue holds 7120: `7120 x 5 x 1.1 = 39160` | + +**Every delta decomposes, to the unit, into the build queue's construction points priced +through the money chain** — three of the four exactly, and the fourth within the one unit that +two independent truncations of a `.5` allow. That is the closest thing to an oracle this path +has, and it is a much stronger statement than "the two agree": it says the two paths differ +by *exactly the thing the disassembly says they differ by*. + +### 5.4 What this run did NOT cover — read this before quoting the numbers + +* **One leaf per pair is a weak result** and it is the one leaf where the missing upstream + input does not bite. Player 576 owns one colony with no civilian population and an empty + queue; it is the easy case. +* **The ship-repair demand is taken as 0 everywhere.** `Ship::RepairCost` (0x00815180) is + unread, so no save can supply it. Every colony with a damaged fleet in orbit therefore reads + **high**, and the corpus cannot tell us whether any does. +* **No corpus colony is off its ideal suitability, and none is below full infrastructure.** So + the terraform channel, the infrastructure channel, `infraNeed`, `terraNeed`, the + infra→terraform cascade, the terraform→money cascade and the non-trivial half of the + `SRsc == 1` leftover branch are **all unexercised by the corpus**. They are covered by host + tests written from the instruction stream, which is a much weaker claim. +* **No corpus system has a station**, so the shipyard bonus in `ConstructionPoints` — including + the "strictly positive" guard and the association this lane corrected — is unexercised. +* **`SRoh` is 0 on every save**, so the over-harvest term is unexercised here too (lane N's + finding, unchanged). +* **`dsu` is FLT_MAX everywhere**, so the ideal-suitability override is unexercised and the + sentinel's identity is inferred from that fact rather than read. +* **The build queue is exercised only on Zuul saves that are not on either reference pair.** + The two pairs the metric is measured on have empty queues throughout, so the queue edge is + checked by the §5.3 self-check and not by the leaf count. +* The `[0x230]` gate, `out[4]`, `out[5]` and `out[6]` are read but **not modelled**; nothing + downstream of `out[3]` needs them. +* **Neither `NormaliseOutputRates`' tail (past 0x007474d4) nor `CivilianConsumption`'s ratio + was read this lane.** The first is B4's; the second feeds only the resource ledger. + +### 5.5 The two budget-downstream RNG words + +They still cannot enter the generator model, and the reason has changed again. + +`income-term.md` §6.3 named them: `ProcessResearch`'s `RNG::Chance(odds)` on the funded node, +and the draw inside `OnTechResearched`'s effect callback. Both are downstream of the research +**allocation**, which is `ComputeBudget`'s research money — and that money is now computable, +because its only missing input was the per-system money this lane closed. + +What blocks them now is one step further out: **the only corpus player that reaches +`ProcessResearch` with a research target is the AI**, and its research rate (`ResRate` +0.25 → 0.8) and its target (`ResTNm` '' → 'IND_Waldo') are *its own orders, generated during +the same turn*. Feeding our budget into `ProcessResearch` would allocate against the wrong +rate. On `turn1-state` no player has a target at all, so the phase has nothing to fund and +both words cost zero on the reference pair. + +That last sentence is a claim about the **workload**, not about the phase, and rule 20 applies +to it: a word count cannot separate "`ProcessResearch` was not entered" from "it was entered +and drew nothing". An entry probe on `ProcessResearch` would settle it in minutes and is the +cheap next step. Until then the two words are best described as *unblocked in formula, blocked +in workload*, and the honest ledger entry is that the generator model is unchanged at 16 words +modelled. + +### 5.6 What is now blocked on what + +| phase | was blocked on | is blocked on | +|---|---|---| +| P01 `ComputeBudget` | the per-system money output | nothing here; `S11`'s uncommitted civilian growth upstream, and the unread ship-repair demand | +| P02 `ApplyNetToSavings` | P01 | committed; exact where the upstream is | +| P03 `RecordBudgetDerivedFields` | the budget | two player words that are still not identified on the wire — **unchanged, this lane does not help it** | +| P05 `ProcessResearch` | the allocation | the AI's own research rate and target (Rung B) | +| P06 `ResearchRefund` | P01 and P05 | P05 | +| T36 turn record | the budget **and** ship construction | ship construction (lane B6) plus the same growth gap; the money half is now available | + +The single highest-value next item this lane can name is **committing `S11`'s civilian +growth**: it is what stands between player 16's `Sav` and the oracle on both pairs, it is also +what stands between `BnkEl`/`BnkPr` and the oracle (four more leaves), and it is the same +`Pop2/PopG/PopC` and `PvPop2/PopG/PopC` leaves that are already on the remaining list. One +input — the imperial carrying capacity — gates all of it. + diff --git a/ghidra/addresses.d/lane-c3.json b/ghidra/addresses.d/lane-c3.json new file mode 100644 index 0000000..0059a3c --- /dev/null +++ b/ghidra/addresses.d/lane-c3.json @@ -0,0 +1,93 @@ +{ + "_note": "Lane C3, ComputeOutput on the turn path. Five addresses this lane read are already held elsewhere and AGREE, so they are dropped from this fragment rather than duplicated (rule 14): ServerSystem_ComputeOutput 0x00751fb0 and ServerSystem_TerraformPointsNeeded 0x00746890 (lane-e1.json), ServerSystem_ComputeOutputFromRates 0x00751bb0 and ServerSystem_NormaliseOutputRates 0x00747390 (addresses.json), Ship_TestFlags 0x00814da0 (lane-z.json). Every one was re-disassembled to the next function start this lane and the address, convention and boundary matched. One CORRECTION to a boundary that is recorded here rather than by editing another lane's row: ComputeOutputFromRates ends at its `ret 8` at 0x00751fa0 and 0x00751fa3..0x00751faf is int3 padding, so output-term.md's 0x00751fa8 is padding, not code; income-term.md's 0x00751fa0 is right. See findings/subsystems/output-turn-path.md.", + "entries": [ + { + "name": "ServerSystem_RepairShipsInOrbit", + "addr": "0x00751590", + "convention": "thiscall", + "prototype": "int (ServerSystem* sys, int points, bool estimateOnly) // `ret 8`, real end 0x007517b5 (SEH frame, /GS cookie). Returns the points NOT consumed. Walks the system's fleets through the system's own vtable (slot 2 = count, slot 4 = element), keeps those whose +0x58 equals sys->PID and that pass 0x00813ab0(0,8), and inside each keeps the ships that pass 0x00814da0(0,8) with 0x00815180(ship,1) > 0. With estimateOnly it returns max(points - totalCost, 0) and touches nothing; without it, it distributes round-robin -- share = max(points / shipCount, 1) per pass, take = min(cost, share), applied by 0x008151c0 -- until no ship takes anything or the points run out. THE ROUND ROBIN IS EQUIVALENT TO points - min(points, totalCost): share is at least 1, so every ship with a positive cost takes at least one point per pass, and the only early exit needs every remaining cost to be zero. THIS IS THE SIDE EFFECT that makes ComputeOutputFromRates unsafe to call for its value (the B1 replace double-run defect): ComputeOutputFromRates passes estimateOnly = 0", + "status": "verified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "ServerSystem_ConstructionPoints", + "addr": "0x00746830", + "convention": "thiscall", + "prototype": "int (ServerSystem* sys, double constructionShare) // `ret 8`, real end 0x00746883. Turns the ship-construction channel's rounded share into out[7]: with no owner it is ftol(share), else k = StationCount(sys, PID, 1) and b = STATION_BONUS_SHIPCON (slot 0x00af08ec) taken as 0 unless STRICTLY positive, returning ftol( k x (b x share) + share ). TRUNCATING, not rounding, and note the association -- neither is `share x (1 + b x k)`", + "status": "verified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "BuildQueue_TotalConstructionLeft", + "addr": "0x008251e0", + "convention": "thiscall", + "prototype": "int (BuildQueue* q) // 23 bytes, plain `ret`, no frame. Walks the std::list at q+0x10 from its sentinel and sums the dword at +0x18 of each node -- the order's `conleft`. This is the queue demand ComputeOutputFromRates charges against out[7] before anything cascades back to the money channel, and the ONE input of that function that a save can supply in full (Sys/BQ/ords/conleft is on the wire)", + "status": "verified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "ServerSystem_IdealSuitability", + "addr": "0x00745d60", + "convention": "thiscall", + "prototype": "double (ServerSystem* sys) // real end 0x00745dc0. The suitability the terraform channel aims at, and the value NormaliseOutputRates compares sys->Suit against with an exact ==. With no owner it returns sys->Suit itself, so an unowned system is always 'at its ideal'. Otherwise it starts from owner->IdealSuit (+0xb0), replaces that with StrategyServer::IdealSuit(sys->server, sys->indi->indsp) when the system carries an independence record (+0x1c8), and finally overrides both with sys->dsu (+0x118) whenever dsu differs from the float behind 0x00aeca6c. NOT the same source as CalcSuitMod's ideal, which is the server's per-species array unconditionally -- the two agree on every corpus save, so the difference is instruction-verified only. Every corpus system carries dsu = FLT_MAX, which is why the sentinel is READ AS FLT_MAX (inferred from the corpus, not from the data files)", + "status": "verified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "ServerSystem_CivilianConsumption", + "addr": "0x0074c6f0", + "convention": "custom", + "prototype": "int (/* ESI = ServerSystem* sys */) // real end 0x0074c80f. TAKES ITS `this` IN ESI, not ECX -- a compiler-local helper that inherits the register its caller holds; hooking or calling it as a __thiscall reads the wrong object. Returns 0 with no owner and 0 on an independent colony (+0x1c8), else derives a civilian-share ratio from three int64 population helpers (0x0074a870, 0x0074a8c0, 0x0074a920), scales CIVILIAN_RESOURCES_CONSUMED (slot 0x00ae2ea4) by it and floors the result at 1. Feeds only the resource ledger (out[1], out[2]); it is NOT on the path to out[3]", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08) -- the ESI convention and the two early returns are read from the instruction stream; the ratio's exact shape is not" + }, + { + "name": "SystemRepairDemandForOwner", + "addr": "0x007460b0", + "convention": "custom", + "prototype": "int (/* EBX = ServerSystem* sys */ ServerPlayer* owner) // real end 0x0074615a. TAKES THE SYSTEM IN EBX and the player on the stack -- the second compiler-local helper in this call graph with an inherited register. Returns 0 when either is null. Walks the system's fleets through the system's vtable (slot 2 = count, slot 3 = element), keeps those whose owner (0x0071e280) is the argument and whose +0x78 byte is set, and sums 0x00829180 over the ship vector at +0xa4..+0xa8. ComputeOutput stores the result in out[6]; nothing downstream of out[3] reads it", + "status": "verified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "TradeManager_SystemRouteIncome", + "addr": "0x0083a5b0", + "convention": "thiscall", + "prototype": "void (TradeManager* mgr, ServerSystem* sys, ServerPlayer* owner, int* a, int* b) // `ret 0x10`. Returns immediately when `sys` is null, else forwards to 0x00833a10(owner, a, b, 0, sys) with the manager still in ECX. ComputeOutput reaches it as `mgr = server->vtbl[2]()` -- a zero-argument getter whose four argument pushes were scheduled BEFORE the call, which reads as a five-argument virtual call and is not one. Fills out[4] and out[5]; nothing downstream of out[3] reads them. The name is INFERRED from the callee's neighbourhood (the trade manager's difficulty multiplier lives at 0x00833938), not from a symbol", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "ServerSystem_StationCount", + "addr": "0x00815c10", + "convention": "cdecl", + "prototype": "int (ServerSystem* sys, ServerPlayer* owner, int kind) // the station count both station bonuses read. ConstructionPoints 0x00746830 passes kind = 1 (shipyards); GroupOutput 0x0074b7a0 passes kind = 0 (the imperial output bonus). Body not read this lane; the argument order and the two kinds are read off the two call sites", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08)" + }, + { + "name": "Ship_RepairCost", + "addr": "0x00815180", + "convention": "thiscall", + "prototype": "int (StarShip* ship, int kind) // the per-ship repair demand the orbit repair pass sums and then spends against, always called with kind = 1. Body not read; this is the ONE input of ComputeOutput that no save can currently supply, and until it is read the engine takes the demand as 0 -- which reads a colony with a damaged fleet HIGH, because every point the repair pass would have taken is a point that comes back to the money channel instead", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08) -- reached from 0x00751590, body not read" + }, + { + "name": "Ship_ApplyRepair", + "addr": "0x008151c0", + "convention": "thiscall", + "prototype": "void (StarShip* ship, int points) // the write half of the orbit repair pass. Body not read", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08) -- reached from 0x00751590, body not read" + }, + { + "name": "Fleet_TestFlags", + "addr": "0x00813ab0", + "convention": "thiscall", + "prototype": "bool (StarFleet* fleet, int a, int b) // the fleet-level gate of the orbit repair pass, called as (0, 8); the ship-level counterpart is 0x00814da0 with the same arguments. Body not read", + "status": "unverified", + "source": "findings/subsystems/output-turn-path.md (lane C3 2026-09-08) -- reached from 0x00751590, body not read" + } + ] +} diff --git a/verify/results/standalone/report.txt b/verify/results/standalone/report.txt index b718eb9..aba5c61 100644 --- a/verify/results/standalone/report.txt +++ b/verify/results/standalone/report.txt @@ -1,17 +1,18 @@ # standalone vs the oracle -generated 2026-09-08T17:46:02Z binary /srv/re-lab/build/eng-rep/build-host/src/app/sots_turn +generated 2026-09-08T18:47:54Z binary /home/alex/sots-engine-c3/build-host/src/app/sots_turn -phases: 16/44 of the two turn drivers modelled, 10 committed (implemented 4, partial 6, blocked 6, stub 28) +phases: 16/44 of the two turn drivers modelled, 12 committed (implemented 4, partial 8, blocked 4, stub 28) 5/37 of the post-combat tail modelled ## turn1-state.sav -> turn2-state.sav (real End Turn) baseline (do nothing) 209 leaves diverge - after one standalone turn 158 leaves diverge - closed 51, regressed 0, byte match: no + after one standalone turn 157 leaves diverge + closed 52, regressed 0, byte match: no coverage proved on all three saves: {'input': True, 'oracle': True, 'ours': True} closed: + /Sim/Frame + + /Sim/players/Player[576 "Independent Colony"]/Sav + /Sim/systems/Sys[112 "Gamma Cephei"]/EPid + /Sim/systems/Sys[112 "Gamma Cephei"]/ETS + /Sim/systems/Sys[112 "Gamma Cephei"]/Eid @@ -65,11 +66,12 @@ phases: 16/44 of the two turn drivers modelled, 10 committed (implemented 4, par ## turn2-state.sav -> turn3-state.sav (real End Turn) baseline (do nothing) 108 leaves diverge - after one standalone turn 87 leaves diverge - closed 21, regressed 0, byte match: no + after one standalone turn 86 leaves diverge + closed 22, regressed 0, byte match: no coverage proved on all three saves: {'input': True, 'oracle': True, 'ours': True} closed: + /Sim/Frame + + /Sim/players/Player[576 "Independent Colony"]/Sav + /Sim/systems/Sys[112 "Gamma Cephei"]/ETS + /Sim/systems/Sys[112 "Gamma Cephei"]/ltis + /Sim/systems/Sys[112 "Gamma Cephei"]/ntdev @@ -92,7 +94,7 @@ phases: 16/44 of the two turn drivers modelled, 10 committed (implemented 4, par + /Summary/Turn ## what still differs on the reference pair, by subsystem - 82 /Sim/players + 81 /Sim/players 34 /Sim/systems 24 /Sim/turnstats 8 /Sim/SvSctOb @@ -131,7 +133,7 @@ phases: 16/44 of the two turn drivers modelled, 10 committed (implemented 4, par /Sim/players/Player[16 "re"]/Events/Events/.: only-in-A /Sim/players/Player[16 "re"]/Events/Events/.[0]: only-in-B /Sim/players/Player[16 "re"]/Events/Events/.[EvTurn=2]: only-in-B - /Sim/players/Player[16 "re"]/Sav: 50000 -> 289688 + /Sim/players/Player[16 "re"]/Sav: 289092 -> 289688 /Sim/players/Player[16 "re"]/Status: 0 -> 4 /Sim/players/Player[32 "Fane Lao"]/BnkEl: -1811273 -> -1815833 /Sim/players/Player[32 "Fane Lao"]/BnkPr: -896580 -> -898837 @@ -145,6 +147,6 @@ phases: 16/44 of the two turn drivers modelled, 10 committed (implemented 4, par /Sim/players/Player[32 "Fane Lao"]/PvSav: 50000 -> 38100 /Sim/players/Player[32 "Fane Lao"]/ResRate: 0.25 -> 0.800000011920929 [1.34218e+07 ulp] /Sim/players/Player[32 "Fane Lao"]/ResTNm: '' -> 'IND_Waldo' - /Sim/players/Player[32 "Fane Lao"]/Sav: 50000 -> 92651 + /Sim/players/Player[32 "Fane Lao"]/Sav: 297492 -> 92651 /Sim/players/Player[32 "Fane Lao"]/ShipRecs/srb[0]: 0 -> 1 /Sim/players/Player[32 "Fane Lao"]/ShipRecs/srb[3]: only-in-B diff --git a/verify/results/standalone/status.json b/verify/results/standalone/status.json index 3b598e3..39fbfd8 100644 --- a/verify/results/standalone/status.json +++ b/verify/results/standalone/status.json @@ -1,17 +1,17 @@ { "schema": "sots-standalone-status/1", - "generated": "2026-09-08T17:46:02Z", - "binary": "/srv/re-lab/build/eng-rep/build-host/src/app/sots_turn", + "generated": "2026-09-08T18:47:54Z", + "binary": "/home/alex/sots-engine-c3/build-host/src/app/sots_turn", "reference": { "input": "turn1-state.sav", "oracle": "turn2-state.sav", "baselineDiverging": 209, - "divergingAfterTurn": 158, - "closed": 51, + "divergingAfterTurn": 157, + "closed": 52, "regressed": 0, "byteMatch": false, "subsystems": { - "/Sim/players": 82, + "/Sim/players": 81, "/Sim/systems": 34, "/Sim/turnstats": 24, "/Sim/SvSctOb": 8, @@ -31,11 +31,11 @@ "total": 44, "verified": 0, "implemented": 4, - "partial": 6, - "blocked": 6, + "partial": 8, + "blocked": 4, "stub": 28, "modelled": 16, - "committed": 10 + "committed": 12 }, "tailPhases": { "total": 37, @@ -58,31 +58,31 @@ "note": "real End Turn", "exit": 0, "stdout": [ - "load: /srv/re-lab/build/sre/verify/results/saves/turn1-state.sav", + "load: /home/alex/sots-re/verify/results/saves/turn1-state.sav", " 591376 inflated bytes, 0 error(s), 0 warning(s)", " turn 1, frame 1, modCount 0, 8 player(s), 28 system(s), 6 fleet(s)", "roundtrip (untouched): byte-identical (591376 bytes)", "data: no root given (--data DIR / $SOTS_DATA_DIR); the tail's ship census stays unmodelled", "", "phases", - " turn drivers (the milestone's denominator): 16 of 44 modelled, 10 committed", - " verified 0 implemented 4 partial 6 blocked 6 stub 28", + " turn drivers (the milestone's denominator): 16 of 44 modelled, 12 committed", + " verified 0 implemented 4 partial 8 blocked 4 stub 28", " post-combat tail (written to the autosave, tracked separately): 5 of 37 modelled", " verified 0 implemented 1 partial 2 blocked 2 stub 32", "", "this run", - " leaves written 53", - " leaves NOT written by a blocked phase 72", + " leaves written 59", + " leaves NOT written by a blocked phase 73", " generator words consumed 16 (state loaded, left untouched)", " generator words NOT accounted (never netted off the above):", " - encounter detection draws one unit value and one bounded integer per turn on every turn measured (2 words), with no derived rule behind the count -- its bound is the product of the contact and detector counts, so it is left unmodelled", - " - the research-allocation draw is downstream of the budget, which is blocked on the per-system money output (0 or 1 word)", + " - two draws are downstream of the budget's research allocation -- ProcessResearch's completion Chance and the tech-effect callback's own roll (0 or 1 word each). The allocation needs ComputeBudget's per-system money, which is ComputeOutput with the system's OWN rate sliders; the max-income form of that money is now modelled and self-checked (see T31), but it is NOT the one this path takes", " - a successful raid roll may draw one further word to pick its target; no roll succeeded on any measured turn, so the cost of a success is 0 or 1 and undetermined", " ! the generator advanced during this run but the save keeps its original state (--commit-rng to write it)", " ! the modelled words are a LOWER BOUND on the turn's cost, so a committed generator is short by the unaccounted sites below and its drawn VALUES are not the game's", "", - "wrote /tmp/tmpezqlouzs/post-turn1-state.sav (65208 bytes gzipped, 591664 inflated)", - "metric -> /tmp/tmpezqlouzs/metric-turn1-state.sav.json" + "wrote /tmp/tmp3mqpqe52/post-turn1-state.sav (65218 bytes gzipped, 591664 inflated)", + "metric -> /tmp/tmp3mqpqe52/metric-turn1-state.sav.json" ], "coverage": { "input": true, @@ -92,14 +92,15 @@ "roots": { "input": "64b836b966299d9b72fc02244ed31e31", "oracle": "4bed514f853332b9fa35b388c3aa5558", - "ours": "d77168aa0a5bd1b8890d8c0f994aed3f" + "ours": "436ff5f87928966e36bb61318bd0b35f" }, "baselineDiverging": 209, - "divergingAfterTurn": 158, - "closed": 51, + "divergingAfterTurn": 157, + "closed": 52, "regressed": 0, "closedPaths": [ "/Sim/Frame", + "/Sim/players/Player[576 \"Independent Colony\"]/Sav", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/EPid", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/ETS", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/Eid", @@ -176,7 +177,7 @@ "/Sim/players/Player[16 \"re\"]/Events/Events/.: only-in-A", "/Sim/players/Player[16 \"re\"]/Events/Events/.[0]: only-in-B", "/Sim/players/Player[16 \"re\"]/Events/Events/.[EvTurn=2]: only-in-B", - "/Sim/players/Player[16 \"re\"]/Sav: 50000 -> 289688", + "/Sim/players/Player[16 \"re\"]/Sav: 289092 -> 289688", "/Sim/players/Player[16 \"re\"]/Status: 0 -> 4", "/Sim/players/Player[32 \"Fane Lao\"]/BnkEl: -1811273 -> -1815833", "/Sim/players/Player[32 \"Fane Lao\"]/BnkPr: -896580 -> -898837", @@ -190,24 +191,24 @@ "/Sim/players/Player[32 \"Fane Lao\"]/PvSav: 50000 -> 38100", "/Sim/players/Player[32 \"Fane Lao\"]/ResRate: 0.25 -> 0.800000011920929 [1.34218e+07 ulp]", "/Sim/players/Player[32 \"Fane Lao\"]/ResTNm: '' -> 'IND_Waldo'", - "/Sim/players/Player[32 \"Fane Lao\"]/Sav: 50000 -> 92651", + "/Sim/players/Player[32 \"Fane Lao\"]/Sav: 297492 -> 92651", "/Sim/players/Player[32 \"Fane Lao\"]/ShipRecs/srb[0]: 0 -> 1", "/Sim/players/Player[32 \"Fane Lao\"]/ShipRecs/srb[3]: only-in-B" ], "byteMatch": false, "standalone": { "schema": "sots-standalone-metric/1", - "input": "/srv/re-lab/build/sre/verify/results/saves/turn1-state.sav", - "output": "/tmp/tmpezqlouzs/post-turn1-state.sav", + "input": "/home/alex/sots-re/verify/results/saves/turn1-state.sav", + "output": "/tmp/tmp3mqpqe52/post-turn1-state.sav", "spine": { "total": 44, "verified": 0, "implemented": 4, - "partial": 6, - "blocked": 6, + "partial": 8, + "blocked": 4, "stub": 28, "modelled": 16, - "committed": 10 + "committed": 12 }, "tail": { "total": 37, @@ -220,14 +221,14 @@ "committed": 3 }, "run": { - "leafWrites": 53, - "blockedLeafWrites": 72, + "leafWrites": 59, + "blockedLeafWrites": 73, "rngWords": 16, "rngLoaded": true, "rngCommitted": false, "rngUnaccounted": [ "encounter detection draws one unit value and one bounded integer per turn on every turn measured (2 words), with no derived rule behind the count -- its bound is the product of the contact and detector counts, so it is left unmodelled", - "the research-allocation draw is downstream of the budget, which is blocked on the per-system money output (0 or 1 word)", + "two draws are downstream of the budget's research allocation -- ProcessResearch's completion Chance and the tech-effect callback's own roll (0 or 1 word each). The allocation needs ComputeBudget's per-system money, which is ComputeOutput with the system's OWN rate sliders; the max-income form of that money is now modelled and self-checked (see T31), but it is NOT the one this path takes", "a successful raid roll may draw one further word to pick its target; no roll succeeded on any measured turn, so the cost of a success is 0 or 1 and undetermined" ] }, @@ -378,7 +379,7 @@ "name": "PlayerTurn", "status": "partial", "ran": 8, - "writes": 0, + "writes": 3, "blockedWrites": 7, "rng": 0 }, @@ -386,7 +387,7 @@ "driver": "ServerPlayer::ProcessTurn", "id": "P01", "name": "ComputeBudget", - "status": "blocked", + "status": "partial", "ran": 8, "writes": 0, "blockedWrites": 0, @@ -396,9 +397,9 @@ "driver": "ServerPlayer::ProcessTurn", "id": "P02", "name": "ApplyNetToSavings", - "status": "blocked", + "status": "partial", "ran": 0, - "writes": 0, + "writes": 3, "blockedWrites": 3, "rng": 0 }, @@ -997,9 +998,9 @@ "id": "T31", "name": "UpdateBankruptcyLimits", "status": "blocked", - "ran": 0, + "ran": 8, "writes": 0, - "blockedWrites": 0, + "blockedWrites": 1, "rng": 0 }, { @@ -1071,31 +1072,31 @@ "note": "real End Turn", "exit": 0, "stdout": [ - "load: /srv/re-lab/build/sre/verify/results/saves/turn2-state.sav", + "load: /home/alex/sots-re/verify/results/saves/turn2-state.sav", " 603360 inflated bytes, 0 error(s), 0 warning(s)", " turn 2, frame 2, modCount 12, 8 player(s), 28 system(s), 7 fleet(s)", "roundtrip (untouched): byte-identical (603360 bytes)", "data: no root given (--data DIR / $SOTS_DATA_DIR); the tail's ship census stays unmodelled", "", "phases", - " turn drivers (the milestone's denominator): 16 of 44 modelled, 10 committed", - " verified 0 implemented 4 partial 6 blocked 6 stub 28", + " turn drivers (the milestone's denominator): 16 of 44 modelled, 12 committed", + " verified 0 implemented 4 partial 8 blocked 4 stub 28", " post-combat tail (written to the autosave, tracked separately): 5 of 37 modelled", " verified 0 implemented 1 partial 2 blocked 2 stub 32", "", "this run", - " leaves written 23", - " leaves NOT written by a blocked phase 66", + " leaves written 29", + " leaves NOT written by a blocked phase 67", " generator words consumed 16 (state loaded, left untouched)", " generator words NOT accounted (never netted off the above):", " - encounter detection draws one unit value and one bounded integer per turn on every turn measured (2 words), with no derived rule behind the count -- its bound is the product of the contact and detector counts, so it is left unmodelled", - " - the research-allocation draw is downstream of the budget, which is blocked on the per-system money output (0 or 1 word)", + " - two draws are downstream of the budget's research allocation -- ProcessResearch's completion Chance and the tech-effect callback's own roll (0 or 1 word each). The allocation needs ComputeBudget's per-system money, which is ComputeOutput with the system's OWN rate sliders; the max-income form of that money is now modelled and self-checked (see T31), but it is NOT the one this path takes", " - a successful raid roll may draw one further word to pick its target; no roll succeeded on any measured turn, so the cost of a success is 0 or 1 and undetermined", " ! the generator advanced during this run but the save keeps its original state (--commit-rng to write it)", " ! the modelled words are a LOWER BOUND on the turn's cost, so a committed generator is short by the unaccounted sites below and its drawn VALUES are not the game's", "", - "wrote /tmp/tmpezqlouzs/post-turn2-state.sav (66882 bytes gzipped, 603360 inflated)", - "metric -> /tmp/tmpezqlouzs/metric-turn2-state.sav.json" + "wrote /tmp/tmp3mqpqe52/post-turn2-state.sav (66882 bytes gzipped, 603360 inflated)", + "metric -> /tmp/tmp3mqpqe52/metric-turn2-state.sav.json" ], "coverage": { "input": true, @@ -1105,14 +1106,15 @@ "roots": { "input": "4bed514f853332b9fa35b388c3aa5558", "oracle": "e9c161e311f8ef8fad6f1aa1903dcf3f", - "ours": "987447a85f9fcded1afd868fca112ef6" + "ours": "5c5eb87437866b1563ff19ba4702ef32" }, "baselineDiverging": 108, - "divergingAfterTurn": 87, - "closed": 21, + "divergingAfterTurn": 86, + "closed": 22, "regressed": 0, "closedPaths": [ "/Sim/Frame", + "/Sim/players/Player[576 \"Independent Colony\"]/Sav", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/ETS", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/ltis", "/Sim/systems/Sys[112 \"Gamma Cephei\"]/ntdev", @@ -1154,7 +1156,7 @@ "/Sim/players/Player[16 \"re\"]/Events/Events/.[0]: 1 -> 2", "/Sim/players/Player[16 \"re\"]/Events/Events/.[EvTurn=3]: only-in-B", "/Sim/players/Player[16 \"re\"]/PvSav: 50000 -> 289688", - "/Sim/players/Player[16 \"re\"]/Sav: 289688 -> 532369", + "/Sim/players/Player[16 \"re\"]/Sav: 531773 -> 532369", "/Sim/players/Player[32 \"Fane Lao\"]/BnkEl: -1815833 -> -1820206", "/Sim/players/Player[32 \"Fane Lao\"]/BnkPr: -898837 -> -901002", "/Sim/players/Player[32 \"Fane Lao\"]/Events/EvNxID: 2 -> 4", @@ -1163,7 +1165,7 @@ "/Sim/players/Player[32 \"Fane Lao\"]/FNG/FNGNum: 1 -> 3", "/Sim/players/Player[32 \"Fane Lao\"]/Maint: 500 -> 1000", "/Sim/players/Player[32 \"Fane Lao\"]/PvSav: 38100 -> 80751", - "/Sim/players/Player[32 \"Fane Lao\"]/Sav: 92651 -> 135486", + "/Sim/players/Player[32 \"Fane Lao\"]/Sav: 142259 -> 135486", "/Sim/players/Player[32 \"Fane Lao\"]/ShipRecs/srb[0]: 1 -> 2", "/Sim/players/Player[32 \"Fane Lao\"]/ShipRecs/srb[3]: 1 -> 2", "/Sim/players/Player[32 \"Fane Lao\"]/ShipRecs/sri[0]: 1 -> 2", @@ -1180,17 +1182,17 @@ "byteMatch": false, "standalone": { "schema": "sots-standalone-metric/1", - "input": "/srv/re-lab/build/sre/verify/results/saves/turn2-state.sav", - "output": "/tmp/tmpezqlouzs/post-turn2-state.sav", + "input": "/home/alex/sots-re/verify/results/saves/turn2-state.sav", + "output": "/tmp/tmp3mqpqe52/post-turn2-state.sav", "spine": { "total": 44, "verified": 0, "implemented": 4, - "partial": 6, - "blocked": 6, + "partial": 8, + "blocked": 4, "stub": 28, "modelled": 16, - "committed": 10 + "committed": 12 }, "tail": { "total": 37, @@ -1203,14 +1205,14 @@ "committed": 3 }, "run": { - "leafWrites": 23, - "blockedLeafWrites": 66, + "leafWrites": 29, + "blockedLeafWrites": 67, "rngWords": 16, "rngLoaded": true, "rngCommitted": false, "rngUnaccounted": [ "encounter detection draws one unit value and one bounded integer per turn on every turn measured (2 words), with no derived rule behind the count -- its bound is the product of the contact and detector counts, so it is left unmodelled", - "the research-allocation draw is downstream of the budget, which is blocked on the per-system money output (0 or 1 word)", + "two draws are downstream of the budget's research allocation -- ProcessResearch's completion Chance and the tech-effect callback's own roll (0 or 1 word each). The allocation needs ComputeBudget's per-system money, which is ComputeOutput with the system's OWN rate sliders; the max-income form of that money is now modelled and self-checked (see T31), but it is NOT the one this path takes", "a successful raid roll may draw one further word to pick its target; no roll succeeded on any measured turn, so the cost of a success is 0 or 1 and undetermined" ] }, @@ -1361,7 +1363,7 @@ "name": "PlayerTurn", "status": "partial", "ran": 8, - "writes": 0, + "writes": 3, "blockedWrites": 4, "rng": 0 }, @@ -1369,7 +1371,7 @@ "driver": "ServerPlayer::ProcessTurn", "id": "P01", "name": "ComputeBudget", - "status": "blocked", + "status": "partial", "ran": 8, "writes": 0, "blockedWrites": 0, @@ -1379,9 +1381,9 @@ "driver": "ServerPlayer::ProcessTurn", "id": "P02", "name": "ApplyNetToSavings", - "status": "blocked", + "status": "partial", "ran": 0, - "writes": 0, + "writes": 3, "blockedWrites": 3, "rng": 0 }, @@ -1980,9 +1982,9 @@ "id": "T31", "name": "UpdateBankruptcyLimits", "status": "blocked", - "ran": 0, + "ran": 8, "writes": 0, - "blockedWrites": 0, + "blockedWrites": 1, "rng": 0 }, {