A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: Social cohesion is the morale indicator, fed by work and food, with low-cohesion and low-support situations (refs #728) (#857)
Berie32a73da465f
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 7b0ace27b..25e274bcc 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,6 +27,11 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBMVP"). Its stability still follows public approval and still weights the coalition votes; the legacy loop keeps itscollapse. R-GOV-002 pins what the GDD orders cost in Attention: each has a price, the unit orders are free, and arefused order is refunded. No golden moves: no reference run's stability falls below 0.2.+- Social cohesion is now the `morale` indicator, shown as "Social cohesion" (refs #728; GDD Phase 2 PR 4, D-C1).+ The cities' employed share and `food_supply` feed it through the effects web beside homes and safety, so idle workers+ and a Food shortage lower it (Q-NAT-2). "Low social cohesion" and "Low international support" are new situations,+ on below 30% and off above 45%. Phase 1's separate cohesion value, its `coh=` hash line and its two weights are gone;+ the top bar's meter reads `morale`. The new numbers are labelled design values. Every golden is re-pinned.- The Negev's sand is a warmer orange, toward promo 02 (refs #709, #695, #388; the owner chose this step on 16 October2026): the desert ground colour has less blue (`MapPalette`), re-baked into `BiomeColours.bytes` and the minimap relief.The #519 grade is unchanged.diff --git a/content/model.yaml b/content/model.yamlindex 00019cacb..61ef36d24 100644--- a/content/model.yaml+++ b/content/model.yaml@@ -1,7 +1,9 @@# Game design values (not historical facts): indicators run 0..1. Every indicator, policy, effect and situation has a# `name`: the display name Cause text shows the player (required; ids never reach the screen).indicators:- - { id: morale, base: 0.55, name: Morale }+ # morale is the GDD's Social cohesion (D-C1, decided 15 October 2026; Reading 2, #375): the id stays, so no event file+ # changes, and the player sees it as Social cohesion (R-NAT-001). intl_standing is International Support (R-NAT-003).+ - { id: morale, base: 0.55, name: Social cohesion }- { id: food_supply, base: 0.40, name: Food supply }- { id: housing, base: 0.35, name: Housing }- { id: security, base: 0.30, name: Security }@@ -20,14 +22,22 @@ policies:- { id: maabarot, from: 1948-05-15, default: 0.0, office: prime_minister, name: Transit camps (ma'abarot) }effects:- { id: rationing_feeds, source: rationing, target: food_supply, k: 0.40, inertia: 2, office: rationing_minister, name: Rations share out food }- - { id: rationing_grates, from: 1948-05-15, source: rationing, target: morale, k: -0.15, inertia: 1, name: Rationing wears on morale }+ - { id: rationing_grates, from: 1948-05-15, source: rationing, target: morale, k: -0.15, inertia: 1, name: Rationing wears on cohesion }- { id: building_houses, from: 1948-05-15, source: housing_construction, target: housing, k: 0.35, inertia: 4, office: labour_minister, name: New housing }- - { id: homes_lift_morale, source: housing, target: morale, k: 0.15, inertia: 2, name: Homes lift morale }+ - { id: homes_lift_morale, source: housing, target: morale, k: 0.15, inertia: 2, name: Homes lift cohesion }- { id: border_villages_secure, from: 1948-05-15, source: border_settlement, target: security, k: 0.30, inertia: 4, office: agriculture_minister, name: Border villages }- - { id: safety_lifts_morale, source: security, target: morale, k: 0.10, inertia: 2, name: Safety lifts morale }+ - { id: safety_lifts_morale, source: security, target: morale, k: 0.10, inertia: 2, name: Safety lifts cohesion }+ # Social cohesion's two GDD inputs beside homes and safety (Q-NAT-2, decided 15 October 2026, #375): the cities' employed+ # share (employed_share, a GDD-only source: Cities.EmployedShare) and food_supply, so a Food shortage lowers it (R-CITY-005).+ - { id: work_lifts_cohesion, source: employed_share, target: morale, k: 0.10, inertia: 2, name: Work lifts cohesion } # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-NAT-2)+ - { id: food_lifts_cohesion, source: food_supply, target: morale, k: 0.10, inertia: 2, name: Food lifts cohesion } # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-NAT-2)situations:- { id: food_crisis, indicator: food_supply, on_below: 0.30, off_above: 0.45, name: Food crisis }- { id: housing_crisis, indicator: housing, on_below: 0.25, off_above: 0.40, name: Housing crisis }+ # The national parameters' thresholds as situations, with food_crisis's bands and no mechanical effect of their own: events+ # can read them through their indicator conditions (Q-NAT-3, decided 15 October 2026, #375; R-NAT-002, R-NAT-004).+ - { id: low_cohesion, indicator: morale, on_below: 0.30, off_above: 0.45, name: Low social cohesion } # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-NAT-3)+ - { id: low_intl_support, indicator: intl_standing, on_below: 0.30, off_above: 0.45, name: Low international support } # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, Q-NAT-3)# Money the sim tracks (these three ids, in millions): the name and the currency prefix the player sees.# The treasury is the GDD's Money (R-MONEY-001; spec §1.2 "Treasury becomes Money", owner, 15 October 2026, Q-MONEY-4).# Debt and foreign currency stay internal, under Money (D-C3, Q-MONEY-1).diff --git a/content/rules.yaml b/content/rules.yamlindex d3f00f461..1c1dca748 100644--- a/content/rules.yaml+++ b/content/rules.yaml@@ -29,8 +29,6 @@ mvp:end: 1952-01-15people_per_unit: 1000 # DESIGN VALUE: owner-set balance, not a historical figure (D-A1: people in one population unit)income_per_job_per_year: 0.06 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per employed unit a year)- cohesion_housing_weight: 0.5 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, until Phase 2 PR 4)- cohesion_jobs_weight: 0.5 # DESIGN VALUE: owner-set balance, not a historical figure (D-C1, until Phase 2 PR 4; the two weights sum to 1)# The day the cities start taking arrivals (R-CITY-003; Q-ARRV-3, owner, 15 October 2026, #375): the census day of their# start values, 8 November 1948 (CBS Statistical Abstract of Israel No. 14, Table 11, pp. 30-31). The census already# counts the people who arrived from 15 May, so the cities take none before it; the national head count takes them all.diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 437ce1003..88ce84868 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -19,9 +19,9 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression brotli -shareable -logFile "$PWD/unity-build-web-br.log"git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.assetuv run tools/web_check.py unity/Builds/Web-brotli --query "golden&smoke=5" \- --expect "GOLDEN OK 1950 d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a" \- --expect "GOLDEN OK 1952 21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322" \- --expect "SMOKE OK 5 turns 1948-10-15 3f7a0fe0d5f22e83edd00c8a913a8d216b4420c36907b11e2ec9406baecdad56"+ --expect "GOLDEN OK 1950 2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be" \+ --expect "GOLDEN OK 1952 f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59" \+ --expect "SMOKE OK 5 turns 1948-10-15 2436927c8b24f28c42be0e7b5a6fe30900f2f6c6a3ba77e4be943c1f50db57cc"bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-israel-vX.Y.Z-web.zip```diff --git a/docs/determinism.md b/docs/determinism.mdindex 6792e3165..b982a1591 100644--- a/docs/determinism.md+++ b/docs/determinism.md@@ -28,9 +28,9 @@ final `GameState.Hash()` is pinned:| Run | Ends | Hash ||---|---|---|-| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a` |-| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322` |-| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322` |+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be` |+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59` |+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59` |`hash1952` stops at the first turn on or after 1 January 1952, which is the game's last turn, so it is the same run as`mvp-end` (`DeterminismTests.TheWholeGameToItsEndIsFixed`). Both names are kept (spec 2026-10-12 section 3 step 6): a@@ -39,15 +39,15 @@ check `hash1950` and `hash1952`.A further value is pinned for the browser smoke run (`?smoke=5`: the golden seed, five turns played through the UI's ownbuttons, answering each event with its first option while the turn's Attention pays for it, the rest left to their-ministers): `SMOKE OK 5 turns 1948-10-15 3f7a0fe0d5f22e83edd00c8a913a8d216b4420c36907b11e2ec9406baecdad56`.+ministers): `SMOKE OK 5 turns 1948-10-15 2436927c8b24f28c42be0e7b5a6fe30900f2f6c6a3ba77e4be943c1f50db57cc`.It depends on the UI path as well as the sim (which option is first, the turn grid), so re-record it when either changes.Check every build with:```uv run tools/web_check.py unity/Builds/Web-<compression> --query "golden&smoke=5" \- --expect "GOLDEN OK 1950 d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a" \- --expect "GOLDEN OK 1952 21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322" \- --expect "SMOKE OK 5 turns 1948-10-15 3f7a0fe0d5f22e83edd00c8a913a8d216b4420c36907b11e2ec9406baecdad56"+ --expect "GOLDEN OK 1950 2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be" \+ --expect "GOLDEN OK 1952 f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59" \+ --expect "SMOKE OK 5 turns 1948-10-15 2436927c8b24f28c42be0e7b5a6fe30900f2f6c6a3ba77e4be943c1f50db57cc"```**When a golden moves.** The test fails with the lines that changed, grouped by section (`[ind]`, `[pol]`, `[bud]`,@@ -245,3 +245,10 @@ The hash reads the state keys, so it never sees a record outside its window. An| GDD Phase 3 PR 2 | scenario-cautious | `a9afb0ad` | the arrivals over the cities; `city{}` and `coh` only (was `5f162f0f`) || GDD Phase 3 PR 2 | scenario-reckless | `8f209d56` | same (was `a10877e2`) || GDD Phase 3 PR 2 | scenario-mvp-absorb-first | `8601da93` | same (was `53852f2c`) |+| GDD Phase 2 PR 4 | 1950 | `2766b45b` | Social cohesion is `morale` (D-C1, Reading 2; R-CITY-005, R-NAT-001): the `coh=` line goes (a hash format change), and two new effect-web sources of `morale`, `work_lifts_cohesion` (the cities' employed share) and `food_lifts_cohesion` (`food_supply`), k 0.10 and inertia 2 each, act every turn (Q-NAT-2). `morale` ends at 0.5545 (was 0.4255); approval reads it (Q-NAT-5), so `stab` ends at 0.5612 (was 0.5123). Two new situations, `low_cohesion` and `low_intl_support`, do not fire in the run (was `d22b369f`) |+| GDD Phase 2 PR 4 | 1952 | `f8cd22d7` | same; `morale` ends at 0.5691 (was 0.4388), `stab` at 0.5683 (was 0.5098) (was `21029217`) |+| GDD Phase 2 PR 4 | mvp-end | `f8cd22d7` | same; the same run as hash1952 (was `21029217`) |+| GDD Phase 2 PR 4 | smoke5 | `2436927c` | the `coh=` line goes and the two new sources of `morale` (was `3f7a0fe0`) |+| GDD Phase 2 PR 4 | scenario-cautious | `28fd1405` | same; `morale` ends at 0.6183 (was 0.5296) (was `a9afb0ad`) |+| GDD Phase 2 PR 4 | scenario-reckless | `af7b2abd` | same (was `8f209d56`) |+| GDD Phase 2 PR 4 | scenario-mvp-absorb-first | `b16a8740` | same (was `8601da93`) |diff --git a/docs/gdd/one-city.md b/docs/gdd/one-city.mdindex 26162a217..ad2d094a2 100644--- a/docs/gdd/one-city.md+++ b/docs/gdd/one-city.md@@ -12,12 +12,12 @@ As a player of the MVP, I want to put Tel Aviv's people to work and house the im- Production: each employed unit earns `income_per_job_per_year` IL millions a year, for the turn's share of a year (R-CITY-002).- Arrivals: the CBS series in `content/aliyah.yaml` arrives as refugees, in whole units, counted cumulatively so that no unit is lost or counted twice (R-CITY-003, D-A5 [S2]). With twelve cities they are spread over all of them: see `cities.md`.- Housing: refugees become civilians, without a job, up to the city's housing capacity. The cap is a placeholder while D-D1 is open (R-CITY-004).-- Social cohesion: a share from 0% to 100%, the weighted housed share and employed share over all cities (R-CITY-005). No other system reads it; the top bar shows it as a resource meter, in the GDD loop only (the owner's ruling of 15 October 2026 [S4]).+- Social cohesion: a share from 0% to 100%, the weighted housed share and employed share over all cities (R-CITY-005). At first no other system read it; the top bar shows it as a resource meter, in the GDD loop only (the owner's ruling of 15 October 2026 [S4]). It is now the `morale` indicator (R-NAT-001), which approval and the `low_cohesion` situation read; the employed share is one of its effect-web sources and housing reaches it through the `housing` indicator.## Data touched- `cities.yaml`, `unit_types.yaml` and `rules.yaml` `mvp:` and `attention_cost.assign_workers`: labelled design values in `content/` since the cutover (Q-CUT-1, R-LOOP-005), the overlay's placeholders before it (ruling 2 [S3]).-- `GameState`: `Cities` (counts), `Cohesion` (hashed as `coh=` when the state has cities), `Treasury`.+- `GameState`: `Cities` (counts), `Cohesion` (hashed as `coh=` when the state has cities; since removed: folded into `morale`, R-NAT-001), `Treasury`.- Save files: the `work CITY ROLE N` line. Scenarios: `assign_workers` (and `content: mvp` until the cutover).- `sim/Statecraft.Sim.Tests/golden/manifest.txt`: `mvp-slice` moved (retired at the cutover); `scenario-mvp-absorb-first` was new.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 1790b4a2b..de3a576d7 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -48,7 +48,7 @@ R-CITY-008: `GameState.Population` is the one record of the nation's people: itR-CITY-004: Each turn, `min(refugees, max(0, housing_capacity - civilians))` of a city's refugees become civilians without a job. The cap is a placeholder while overflow (D-D1) is open.-R-CITY-005: Social cohesion is `clamp(0, 1, cohesion_housing_weight * housed + cohesion_jobs_weight * employed)`, where `housed` is civilians over civilians and refugees (1 with nobody) and `employed` is employed over civilians (1 with none), over all cities. It is a placeholder while D-C1 is open: no other system reads it.+R-CITY-005: The cities' employed share (employed over civilians, summed over all cities; 1 with no civilians) is an effect-web source of `morale`, Social cohesion (`work_lifts_cohesion`, source id `employed_share`), read after the turn's housing. The legacy loop has no cities, so there it reads 0 and adds nothing. Housing reaches Social cohesion through the existing `housing` link (`homes_lift_morale`) until Phase 3 makes it the cities' aggregate (Q-NAT-2, decided 15 October 2026). Phase 1's separate cohesion value and its two weights are gone (D-C1, Reading 2).R-CITY-006: The cities are the `city` and `town` rows of `map/settlements_1948.yaml`, in that file's order, and their start values are `cities.yaml`'s. Each of a city's values (`people`, `employed_share`, `housing_capacity`, `job_slots`) is required and has a status: `sourced` (read from the source named), `derived` (computed from sourced values), `wikipedia-only` (an owner-accepted Wikipedia figure) or `design` (a labelled design value, R-LOOP-005). A `sourced`, `derived` or `wikipedia-only` value has at least one source, each with a url and a checked date, and the day (YYYY-MM-DD) or month (YYYY-MM) it describes; the loader refuses a value without them, naming the file and field (GDD Phase 3 plan, review focus 3).@@ -107,3 +107,15 @@ D-C5 as decided (12 October 2026): the cabinet and Attention stay, the coalitionR-GOV-001: In the GDD loop the coalition's stability never ends the game: it still moves toward public approval each turn and still weights the coalition votes, but a value below 0.2 (`PoliticsSystem.CollapseBelow`) sets no `coalition_collapse` (D-B5: "Coalition collapse is off in the MVP"). The legacy loop keeps its collapse while the legacy code exists (D-E1).R-GOV-002: Every GDD order kind has an `attention_cost` in the real rules (a design value, R-LOOP-005), the unit orders `pioneer_work` and `stop_work` cost 0 (D-A6: unit orders are free), and a refused order costs nothing: its Attention is refunded before the next order in the turn is priced.++## National parameters++The GDD's Social cohesion and International Support (D-C1, decided 15 October 2026: "0–1 indicators through the effects web. Cohesion replaces `morale` on screen. Thresholds as situations"). Their numbers are labelled design values in `model.yaml` (Reading 1).++R-NAT-001: Social cohesion is the 0 to 1 `morale` indicator, shown to the player as Social cohesion; its id stays, so no event changes (Reading 2). Its sources are the existing homes, rationing and security links, the cities' employed share (R-CITY-005) and `food_supply`, so a Food shortage lowers it (`food_lifts_cohesion`; Q-NAT-2). Approval keeps its weights, which now read Social cohesion through `morale` (Q-NAT-5).++R-NAT-002: "Low social cohesion" (`low_cohesion`) is a situation on `morale`: on below 0.30, off above 0.45, as `food_crisis`. It has no mechanical effect of its own; events can read it through their indicator conditions (Q-NAT-3).++R-NAT-003: International Support is the 0 to 1 `intl_standing` indicator, shown as International support; event effects on `intl_standing` move it (Q-NAT-4).++R-NAT-004: "Low international support" (`low_intl_support`) is a situation on `intl_standing` with the same bands and, likewise, no effect of its own (Q-NAT-3).diff --git a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs b/sim/Statecraft.Sim.Tests/CitiesContentTests.csindex 32a787484..9c58a1109 100644--- a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs+++ b/sim/Statecraft.Sim.Tests/CitiesContentTests.cs@@ -23,7 +23,7 @@ public class CitiesContentTestsAssert.Equal(("unit", "hakhshara", 3, 0.25), (halutz.Kind, halutz.Facility, halutz.TrainingTurns, halutz.TrainingCost));Assert.Equal("", c.UnitTypes.Single(t => t.Id == "civilian").Facility);var mvp = c.RulesAt(c.Eras[0].From).Mvp!;- Assert.Equal((10, 1.2, 0.5, 0.5, new DateTime(1948, 5, 15)), (mvp.PeoplePerUnit, mvp.IncomePerJobPerYear, mvp.CohesionHousingWeight, mvp.CohesionJobsWeight, mvp.CityArrivalsFrom));+ Assert.Equal((10, 1.2, new DateTime(1948, 5, 15)), (mvp.PeoplePerUnit, mvp.IncomePerJobPerYear, mvp.CityArrivalsFrom));Assert.Equal("Town A", c.SettlementNames["town_a"]);}@@ -194,8 +194,6 @@ public class CitiesContentTestsnew object[] { "unit_types.yaml", "types:\n - { id: civilian, kind: crowd }\n", "types[civilian].kind", "must be population or unit" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("people_per_unit: 10", "people_per_unit: 0")), "mvp.people_per_unit", "must be >= 1" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("income_per_job_per_year: 1.2", "income_per_job_per_year: -1")), "mvp.income_per_job_per_year", "must be a finite number >= 0" },- new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("cohesion_housing_weight: 0.5", "cohesion_housing_weight: 1.5")), "mvp.cohesion_housing_weight", "must be a number from 0 to 1" },- new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("cohesion_jobs_weight: 0.5", "cohesion_jobs_weight: 0.4")), "mvp.cohesion_jobs_weight", "the two cohesion weights must sum to 1" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace(" city_arrivals_from: 1948-05-15\n", "")), "mvp.city_arrivals_from", "required when eras.yaml systems.loop is gdd" },new object[] { "rules.yaml", Rules(""), "mvp", "required when eras.yaml systems.loop is gdd" },new object[] { "rules.yaml", Fixture.Files["rules.yaml"] + Fixture.GddRules, "attention_cost.assign_workers", "missing cost" },diff --git a/sim/Statecraft.Sim.Tests/CitiesTests.cs b/sim/Statecraft.Sim.Tests/CitiesTests.csindex 46b33abcc..f174e8f26 100644--- a/sim/Statecraft.Sim.Tests/CitiesTests.cs+++ b/sim/Statecraft.Sim.Tests/CitiesTests.cs@@ -123,75 +123,23 @@ public class CitiesTestsAssert.Equal(228 + Math.Min(arrived, 20), two.Civilians);}- // R-CITY-005- [Fact]- public void CohesionFallsWhenRefugeesWaitAndRisesWhenTheyAreHousedAndEmployed()- {- var c = Town();- var s = Simulation.NewGame(c, 1, Mode.Historical);- Assert.Equal(0.5 * 1 + 0.5 * 0.6, s.Cohesion, 12); // all housed, 6 of 10 employed- var waiting = Step(c, With(s, "town_a", 10, 6, 10)).State; // 2 housed: 12 of 20 housed, 6 of 12 employed- Assert.Equal(0.5 * 0.6 + 0.5 * 0.5, waiting.Cohesion, 12);- var working = Step(c, waiting, new AssignWorkers("town_a", "job", 12)).State;- Assert.Equal(0.5 * 0.6 + 0.5 * 1, working.Cohesion, 12);- Assert.True(waiting.Cohesion < s.Cohesion && working.Cohesion > waiting.Cohesion);- }-- /// <summary>The GDD fixture's town with cohesion weights 0.8 on housing and 0.2 on jobs (fixture values), so a change in- /// either share shows apart from the other.</summary>- static Content Unequal() => ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string>- {- ["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 20, 10, 6),- ["rules.yaml"] = Fixture.Files["rules.yaml"].Replace("map_action: 1 }", Fixture.GddCosts)- + Fixture.GddRules.Replace("cohesion_housing_weight: 0.5", "cohesion_housing_weight: 0.8").Replace("cohesion_jobs_weight: 0.5", "cohesion_jobs_weight: 0.2"),- })));-- // R-CITY-005- [Fact]- public void UnequalWeightsWeighTheHousedAndEmployedSharesApart()- {- var c = Unequal();- var s = Simulation.NewGame(c, 1, Mode.Historical);- Assert.Equal(0.8 * 1 + 0.2 * 0.6, s.Cohesion, 12); // all housed, 6 of 10 employed- var working = Step(c, s, new AssignWorkers("town_a", "job", 10)).State; // all housed, all employed- Assert.Equal(1.0, working.Cohesion, 12);- }-- /// <summary>D-A6: housing comes before Social cohesion in the turn, so cohesion reads the counts after this turn's housing.- /// Read before housing, the same state would give 0.8 * 10/20 + 0.2 * 6/10 = 0.52.</summary>+ /// <summary>D-A6: housing comes before Social cohesion in the turn. The effects web reads the cities' employed share after+ /// the resolution, so it sees this turn's housed people: read before housing, the same state would give 6 of 10.</summary>// R-CITY-004, R-CITY-005[Fact]- public void CohesionReadsTheCountsAfterThisTurnsHousing()+ public void TheEmployedShareReadsTheCountsAfterThisTurnsHousing(){- var c = Unequal();+ // A work effect with k 1 and inertia 1 (fixture values), so its contribution is the share it read.+ var c = ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string>+ {+ ["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 20, 10, 6),+ ["model.yaml"] = Fixture.Files["model.yaml"].Replace("effects:\n", "effects:\n - { id: work, source: employed_share, target: morale, k: 1, inertia: 1, name: Work }\n"),+ })));var s = With(Simulation.NewGame(c, 1, Mode.Historical), "town_a", 10, 6, 10);- var after = Step(c, s).State; // 2 housed: 12 of 20 housed, 6 of 12 employed+ var after = Step(c, s).State; // 2 housed: 6 of 12 employedAssert.Equal((12, 8), (after.Cities["town_a"].Civilians, after.Cities["town_a"].Refugees));- Assert.Equal(0.8 * 0.6 + 0.2 * 0.5, after.Cohesion, 12);- }-- /// <summary>Social cohesion is a labelled placeholder while D-C1 is open (an owner question on #375): no effect, morale or- /// threshold reads it, and only the top bar displays it (#380). Two states that differ only in it step to the same state,- /// and no code outside the city rules, the state and the top bar names it.</summary>- // R-CITY-005- [Fact]- public void CohesionFeedsNothingElse()- {- var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);- for (int i = 0; i < 3; i++) s = Step(Mvp, s).State;- var other = s.Clone();- other.Cohesion = 1 - s.Cohesion;- Assert.NotEqual(s.Hash(), other.Hash());- Assert.Equal(Step(Mvp, s).State.Describe(), Step(Mvp, other).State.Describe());- var repo = System.IO.Directory.GetParent(RealContentTests.ContentRoot())!.FullName;- var readers = new[] { "sim/Statecraft.Sim", "sim/Statecraft.Cli", "unity/Assets" }- .Select(d => System.IO.Path.Combine(repo, d)).Where(System.IO.Directory.Exists)- .SelectMany(d => System.IO.Directory.GetFiles(d, "*.cs", System.IO.SearchOption.AllDirectories))- .Where(f => System.Text.RegularExpressions.Regex.IsMatch(System.IO.File.ReadAllText(f), @"\bCohesion\b"))- .Select(f => System.IO.Path.GetFileName(f)).OrderBy(f => f, StringComparer.Ordinal);- // The top bar shows it (the owner's ruling of 15 October 2026, #380): the HUD's model, presenter and tests read it to- // display it, and nothing else in Unity or the sim does.- Assert.Equal(new[] { "Cities.cs", "GameState.cs", "HudModel.cs", "HudPresenter.cs", "HudTests.cs" }, readers);+ Assert.Equal(6.0 / 12, Cities.EmployedShare(after), 12);+ Assert.Equal(6.0 / 12, after.EffectContributions["work"], 12);}[Fact]@@ -201,7 +149,6 @@ public class CitiesTestsvar s = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);s = Step(c, s).State;Assert.Empty(s.Cities);- Assert.Equal(0, s.Cohesion);Assert.DoesNotContain("coh=", s.Describe());}}diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.csindex 7d4cad9f0..14894fa9f 100644--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs@@ -24,8 +24,6 @@ public class DesignValuesTests("rules.yaml", "attention_cost.stop_work"),("rules.yaml", "mvp.people_per_unit"),("rules.yaml", "mvp.income_per_job_per_year"),- ("rules.yaml", "mvp.cohesion_housing_weight"),- ("rules.yaml", "mvp.cohesion_jobs_weight"),("rules.yaml", "mvp.build_yishuv_turns"),("rules.yaml", "mvp.build_yishuv_cost"),("rules.yaml", "mvp.objective_points"),@@ -71,17 +69,27 @@ public class DesignValuesTests("unit_types.yaml", "types[recruit].training_cost"),("unit_types.yaml", "types[halutz].training_turns"),("unit_types.yaml", "types[halutz].training_cost"),+ // Social cohesion's two new inputs and the national parameters' thresholds (Phase 2 PR 4; Q-NAT-2, Q-NAT-3; Reading 1).+ ("model.yaml", "effects[work_lifts_cohesion].k"),+ ("model.yaml", "effects[work_lifts_cohesion].inertia"),+ ("model.yaml", "effects[food_lifts_cohesion].k"),+ ("model.yaml", "effects[food_lifts_cohesion].inertia"),+ ("model.yaml", "situations[low_cohesion].on_below"),+ ("model.yaml", "situations[low_cohesion].off_above"),+ ("model.yaml", "situations[low_intl_support].on_below"),+ ("model.yaml", "situations[low_intl_support].off_above"),};/// <summary>Every number in the GDD files and blocks, as (file, key path, the line it is on). Scope: all of cities.yaml and/// unit_types.yaml, rules.yaml mvp:, and the GDD kinds under rules.yaml attention_cost. A value whose own mapping says/// `status: sourced`, `derived` or `wikipedia-only` is a historical figure, not balance: the loader holds it to its- /// sources and date instead (cities.yaml, R-CITY-006), so it is left out.</summary>+ /// sources and date instead (cities.yaml, R-CITY-006), so it is left out. model.yaml predates the rule (its header calls+ /// every number there a design value), so only its tagged lines are in scope: the numbers Phase 2 PR 4 added.</summary>public static List<(string File, string Key, string Line)> Numbers(string root){var found = new List<(string, string, string)>();- foreach (var file in new[] { "rules.yaml", "cities.yaml", "unit_types.yaml" })+ foreach (var file in new[] { "rules.yaml", "cities.yaml", "unit_types.yaml", "model.yaml" }){var path = Path.Combine(root, file);if (!File.Exists(path)) continue;@@ -100,7 +108,7 @@ public class DesignValuesTests{var k = ((YamlScalarNode)kv.Key).Value!;var child = key == "" ? k : key + "." + k;- var scope = inScope || file != "rules.yaml" || k == "mvp" || (key == "attention_cost" && AttentionSystem.IsGddKind(k));+ var scope = inScope || (file != "rules.yaml" && file != "model.yaml") || (file == "rules.yaml" && k == "mvp") || (key == "attention_cost" && AttentionSystem.IsGddKind(k));Walk(kv.Value, child, scope);}break;@@ -113,7 +121,7 @@ public class DesignValuesTestsi++;}break;- case YamlScalarNode sc when inScope && sc.Style == YamlDotNet.Core.ScalarStyle.Plain+ case YamlScalarNode sc when (inScope || (file == "model.yaml" && lines[(int)sc.Start.Line - 1].Contains(Tag))) && sc.Style == YamlDotNet.Core.ScalarStyle.Plain&& double.TryParse(sc.Value, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out _):found.Add((file, key, lines[(int)sc.Start.Line - 1]));break;@@ -146,7 +154,7 @@ public class DesignValuesTests{var c = ContentLoader.Load(RealContentTests.ContentRoot());var m = c.Rules.Mvp!;- Assert.Equal((1000, 0.06, 0.5, 0.5), (m.PeoplePerUnit, m.IncomePerJobPerYear, m.CohesionHousingWeight, m.CohesionJobsWeight));+ Assert.Equal((1000, 0.06), (m.PeoplePerUnit, m.IncomePerJobPerYear));Assert.Equal((0.5, 1.0, 0.5), (c.Rules.AttentionCost["assign_workers"], c.Rules.AttentionCost["train"], c.Rules.AttentionCost["cancel_training"]));Assert.Equal((0.0, 0.0), (c.Rules.AttentionCost["pioneer_work"], c.Rules.AttentionCost["stop_work"])); // D-A6: unit orders are freeAssert.Equal((6, 2.0), (m.BuildYishuvTurns, m.BuildYishuvCost));diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.csindex a7f17a8d0..50b387538 100644--- a/sim/Statecraft.Sim.Tests/Fixture.cs+++ b/sim/Statecraft.Sim.Tests/Fixture.cs@@ -219,8 +219,6 @@ series:mvp:people_per_unit: 10income_per_job_per_year: 1.2- cohesion_housing_weight: 0.5- cohesion_jobs_weight: 0.5city_arrivals_from: 1948-05-15build_yishuv_turns: 3build_yishuv_cost: 1.5diff --git a/sim/Statecraft.Sim.Tests/GddStateTests.cs b/sim/Statecraft.Sim.Tests/GddStateTests.csindex 1805f02a0..6059c226d 100644--- a/sim/Statecraft.Sim.Tests/GddStateTests.cs+++ b/sim/Statecraft.Sim.Tests/GddStateTests.cs@@ -27,19 +27,6 @@ public class GddStateTestsAssert.EndsWith("over=", text);}- // R-LOOP-002, R-CITY-005- [Fact]- public void CohesionIsHashedWithTheCities()- {- var s = new GameState { Cohesion = 0.5 };- Assert.DoesNotContain("coh=", s.Describe()); // no cities: the legacy loop's text is unchanged whatever the field holds- s.Cities["x"] = new City("x", 1, 1, 1, 0, 0);- Assert.Contains("coh=0.5 [3FE0000000000000]", s.Describe());- var before = s.Hash();- s.Cohesion = 0.25;- Assert.NotEqual(before, s.Hash());- }-// R-LOOP-002[Fact]public void EachNewSectionAppearsOnlyWhenSetAndMovesTheHash()diff --git a/sim/Statecraft.Sim.Tests/NationalParametersTests.cs b/sim/Statecraft.Sim.Tests/NationalParametersTests.csnew file mode 100644index 000000000..09f561f11--- /dev/null+++ b/sim/Statecraft.Sim.Tests/NationalParametersTests.cs@@ -0,0 +1,125 @@+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++/// <summary>The GDD's two national parameters (Phase 2 PR 4; D-C1, decided 15 October 2026): Social cohesion is the 0 to 1+/// `morale` indicator in the effects web, shown as Social cohesion, and International Support is `intl_standing`; their+/// thresholds are situations (Q-NAT-3). The inputs are Q-NAT-2's: the existing housing link, the cities' employed share and+/// food_supply for shortages (Reading 2: Phase 1's separate GameState.Cohesion is folded into `morale`).</summary>+public class NationalParametersTests+{+ static readonly Content Mvp = ContentLoader.Load(RealContentTests.ContentRoot());+ static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);+ static string Name(Content c, string indicator) => c.Indicators.First(i => i.Id == indicator).Name;++ /// <summary>A real GDD game a few turns in, so every effect contribution is under way.</summary>+ static GameState Played()+ {+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);+ for (int i = 0; i < 3; i++) s = Step(Mvp, s).State;+ return s;+ }++ // R-NAT-001+ [Fact]+ public void CohesionIsMoraleShownAsSocialCohesion()+ {+ Assert.Equal("Social cohesion", Name(Mvp, "morale"));+ Assert.Null(typeof(GameState).GetField("Cohesion")); // no second cohesion value beside the indicator+ var s = Played();+ Assert.NotEmpty(s.Cities);+ Assert.DoesNotContain("coh=", s.Describe());+ Assert.InRange(s.Indicators["morale"], 0.0, 1.0);+ }++ // R-NAT-003+ [Fact]+ public void InternationalSupportIsIntlStanding()+ {+ Assert.Equal("International support", Name(Mvp, "intl_standing")); // #683's name, the top bar's caption+ var s = Played();+ s.PendingEvents.Add("armistice_lebanon");+ var before = s.Indicators["intl_standing"];+ Assert.Null(EventSystem.Choose(Mvp, s, "armistice_lebanon", "sign", new List<Cause>()));+ Assert.Equal(before + 0.05, s.Indicators["intl_standing"], 9); // the option's effect on intl_standing+ }++ /// <summary>Each input Q-NAT-2 names moves Social cohesion in its direction: two states that differ only in that input+ /// step to a higher cohesion on the side with more of it.</summary>+ // R-CITY-005, R-NAT-001+ [Fact]+ public void CohesionReadsItsInputs()+ {+ var s = Played();+ double After(GameState x) => Step(Mvp, x).State.Indicators["morale"];++ // Employment: the same city with more of its civilians in work.+ var city = s.Cities["tel_aviv"];+ Assert.True(city.Employed > 0 && city.Employed < city.Civilians, "precondition: room to move employment both ways");+ var idle = s.Clone(); idle.Cities["tel_aviv"] = city.WithCounts(city.Civilians, 0, city.Refugees);+ var busy = s.Clone(); busy.Cities["tel_aviv"] = city.WithCounts(city.Civilians, Math.Min(city.Civilians, city.JobSlots), city.Refugees);+ Assert.True(After(busy) > After(idle), "more of the civilians in work raises Social cohesion");++ // Shortages: a lower food_supply, which a Food shortfall lowers (R-FOOD-003, PoolsTests).+ var hungry = s.Clone(); EffectsSystem.Shift(Mvp, hungry, "food_supply", -0.2);+ Assert.True(After(s) > After(hungry), "a Food shortage lowers Social cohesion");++ // Housing: the existing link (homes_lift_morale) stays.+ var cramped = s.Clone(); EffectsSystem.Shift(Mvp, cramped, "housing", -0.2);+ Assert.True(After(s) > After(cramped), "worse housing lowers Social cohesion");+ }++ /// <summary>The cities' employed share, the effect web's source: employed over civilians summed over all cities, 1 with+ /// no civilians (nobody is out of work).</summary>+ // R-CITY-005+ [Fact]+ public void TheEmployedShareIsOverAllCities()+ {+ var s = new GameState();+ Assert.Equal(1.0, Cities.EmployedShare(s));+ s.Cities["a"] = new City("a", 10, 10, 10, 6, 0);+ s.Cities["b"] = new City("b", 30, 30, 30, 0, 5);+ Assert.Equal(6.0 / 40, Cities.EmployedShare(s), 12);+ }++ /// <summary>The legacy loop has no cities, so the employed share reads 0 there and its effect adds nothing; the real+ /// content still loads with the loop switch taken out (Unity's SimBridgeGddTests.Legacy).</summary>+ // R-CITY-005+ [Fact]+ public void TheLegacyLoopHasNoEmployedShare()+ {+ var model = Fixture.Files["model.yaml"].Replace("effects:\n", "effects:\n - { id: work, source: employed_share, target: morale, k: 0.1, inertia: 2, name: Work }\n");+ var legacy = ContentLoader.Load(Fixture.Write(new Dictionary<string, string> { ["model.yaml"] = model }));+ Assert.False(legacy.IsGdd);+ var s = Step(legacy, Simulation.NewGame(legacy, GoldenRun.Seed, Mode.Historical)).State;+ Assert.Equal(0.0, s.EffectContributions["work"]);+ var gdd = ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string> { ["model.yaml"] = model })));+ var g = Step(gdd, Simulation.NewGame(gdd, GoldenRun.Seed, Mode.Historical)).State;+ Assert.True(g.EffectContributions["work"] > 0, "the GDD loop's cities feed it");+ }++ /// <summary>Q-NAT-3: "Low social cohesion" and "Low international support" are situations with food_crisis's bands, on+ /// below 0.30 and off above 0.45.</summary>+ // R-NAT-002, R-NAT-004+ [Theory]+ [InlineData("morale", "low_cohesion", "Low social cohesion")]+ [InlineData("intl_standing", "low_intl_support", "Low international support")]+ public void BelowTheThresholdOpensTheSituation(string indicator, string situation, string name)+ {+ var sit = Mvp.Situations.Single(x => x.Id == situation);+ Assert.Equal((indicator, 0.30, 0.45, name), (sit.Indicator, sit.OnBelow, sit.OffAbove, sit.Name));+ var s = Played();+ var why = new List<Cause>();+ EffectsSystem.Shift(Mvp, s, indicator, 0.25 - s.Indicators[indicator]);+ EffectsSystem.UpdateSituations(Mvp, s, why);+ Assert.Contains(situation, s.ActiveSituations);+ Assert.Contains(why, w => w.Message.StartsWith(name + " began", StringComparison.Ordinal));+ EffectsSystem.Shift(Mvp, s, indicator, 0.40 - s.Indicators[indicator]); // inside the band: stays on+ EffectsSystem.UpdateSituations(Mvp, s, why);+ Assert.Contains(situation, s.ActiveSituations);+ EffectsSystem.Shift(Mvp, s, indicator, 0.50 - s.Indicators[indicator]);+ EffectsSystem.UpdateSituations(Mvp, s, why);+ Assert.DoesNotContain(situation, s.ActiveSituations);+ }+}diff --git a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs b/sim/Statecraft.Sim.Tests/PlayerTextTests.csindex 1d1ebc972..a24ef409b 100644--- a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs+++ b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs@@ -40,7 +40,7 @@ public class PlayerTextTestsvar messages = HistoricalCauseMessages();Assert.Contains(messages, m => m.EndsWith("immigrants arrived (the Americas and Oceania)", StringComparison.Ordinal));Assert.Contains(messages, m => m.EndsWith("immigrants arrived (country of origin not recorded)", StringComparison.Ordinal));- Assert.Contains(messages, m => m.StartsWith("Morale ", StringComparison.Ordinal) && m.Contains("Homes lift morale"));+ Assert.Contains(messages, m => m.StartsWith("Social cohesion ", StringComparison.Ordinal) && m.Contains("Homes lift cohesion"));Assert.Contains(messages, m => m.StartsWith("International support +5.0% (Armistice with Egypt)", StringComparison.Ordinal));Assert.Contains(messages, m => m.Contains("elected 25 January 1949"));}@@ -265,7 +265,7 @@ public class PlayerTextTests[Theory][InlineData("chosen: Impose rationing")][InlineData("Built a housing project: cost IL 1.5m, Housing +3.0%, Morale +1.0%")]- [InlineData("Morale -10.9% (Rationing wears on morale, Homes lift morale, Safety lifts morale)")]+ [InlineData("Social cohesion -10.9% (Rationing wears on cohesion, Homes lift cohesion, Safety lifts cohesion)")][InlineData("reserve call-up raised to 80%, the minimum for security level 5")]public void TheGuardLeavesPlainEnglishAlone(string message) => Assert.Empty(Leaks(Real, new[] { message }));@@ -307,7 +307,7 @@ public class PlayerTextTestsAssert.Equal("55%", PlayerText.Percent(0.55));Assert.Equal("+4.1%", PlayerText.PercentChange(0.041));Assert.Equal("Money -IL 2.0m", PlayerText.Change(Real, "treasury", -2)); // R-MONEY-001- Assert.Equal("Morale +5.0%", PlayerText.Change(Real, "morale", 0.05));+ Assert.Equal("Social cohesion +5.0%", PlayerText.Change(Real, "morale", 0.05));Assert.Equal("Foreign currency", PlayerText.Target(Real, "fx_reserves"));}diff --git a/sim/Statecraft.Sim.Tests/ProjectsTests.cs b/sim/Statecraft.Sim.Tests/ProjectsTests.csindex 531452c9c..12020bbe9 100644--- a/sim/Statecraft.Sim.Tests/ProjectsTests.cs+++ b/sim/Statecraft.Sim.Tests/ProjectsTests.cs@@ -268,7 +268,7 @@ public class ProjectsTestsAssert.NotNull(built.Sites["site_a"].BuiltOn);Assert.Equal(idle.Cities.Values.Select(x => x.Canonical()), built.Cities.Values.Select(x => x.Canonical()));Assert.Equal(idle.Units.Values.Select(x => x.Canonical()), built.Units.Values.Select(x => x.Canonical()));- Assert.Equal(idle.Cohesion, built.Cohesion);+ Assert.Equal(idle.Indicators["morale"], built.Indicators["morale"]); // Social cohesionAssert.Equal(idle.Treasury - 1.5, built.Treasury, 9); // only the cost paid at the start: founding adds no MoneyAssert.Equal(idle.Debt, built.Debt);}diff --git a/sim/Statecraft.Sim.Tests/YishuvWindowsTests.cs b/sim/Statecraft.Sim.Tests/YishuvWindowsTests.csindex 52000b943..331519def 100644--- a/sim/Statecraft.Sim.Tests/YishuvWindowsTests.cs+++ b/sim/Statecraft.Sim.Tests/YishuvWindowsTests.cs@@ -13,7 +13,7 @@ public class YishuvWindowsTestsvar s = Simulation.NewGame(C, 1, Mode.Historical);Assert.Equal(new[] { "food_supply", "housing", "intl_standing", "morale", "security" }, s.Indicators.Keys.OrderBy(k => k, StringComparer.Ordinal));Assert.Equal(new[] { "border_settlement", "housing_construction", "maabarot", "rationing" }, s.Policies.Keys.OrderBy(k => k, StringComparer.Ordinal));- Assert.Equal(new[] { "border_villages_secure", "building_houses", "homes_lift_morale", "rationing_feeds", "rationing_grates", "safety_lifts_morale" },+ Assert.Equal(new[] { "border_villages_secure", "building_houses", "food_lifts_cohesion", "homes_lift_morale", "rationing_feeds", "rationing_grates", "safety_lifts_morale", "work_lifts_cohesion" },s.EffectContributions.Keys.OrderBy(k => k, StringComparer.Ordinal));}diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txtindex 0c34618ed..cb9517a4e 100644--- a/sim/Statecraft.Sim.Tests/golden/hash1950.txt+++ b/sim/Statecraft.Sim.Tests/golden/hash1950.txt@@ -3,7 +3,7 @@ ind{food_supply=0.8886718750000001 [3FEC700000000001]housing=0.43452919104400284 [3FDBCF53862C3EB9]intl_standing=0.8100000000000003 [3FE9EB851EB851EE]- morale=0.4254696853969594 [3FDB3AE5340E09D2]+ morale=0.5545072916128947 [3FE1BE86135BDE8F]security=0.5042220244102726 [3FE022963A187B2A]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,10 +13,12 @@ pol{eff{border_villages_secure=0.03922202441027243 [3FA414E8C040046D]building_houses=0.08452919104400287 [3FB5A3B47F17614D]+ food_lifts_cohesion=0.08774605560302737 [3FB67686872B020E]homes_lift_morale=0.06510191087455454 [3FB0AA84D21D0271]rationing_feeds=0.33867187500000007 [3FD5ACCCCCCCCCCE]rationing_grates=-0.15 [BFC3333333333333]safety_lifts_morale=0.050367774522404846 [3FA9C9CE10B12AF4]+ work_lifts_cohesion=0.041291550612907985 [3FA5242A86F7964C]shift{food_supply=0.15000000000000002 [3FC3333333333334]housing=0 [0000000000000000]@@ -45,7 +47,7 @@ debt=71.50032828298673 [4051E00560EB2C47]fx=94.52989672613671 [4057A1E9D3F540F0]rung=2;cf=0;mob=0.05 [3FA999999999999A]-stab=0.5122628429406425 [3FE064750BAC5A79]+stab=0.5612480202322593 [3FE1F5BE687AF41F]att=4 [4010000000000000]fired[altalena@@ -112,7 +114,6 @@ city{tel_aviv=248,106,248,106,131tiberias=6,2,6,2,3zikhron_yaakov=2,1,2,1,1-coh=0.541759762906349 [3FE1561891FF1663]units[1:halutz@-3,19site{diff --git a/sim/Statecraft.Sim.Tests/golden/hash1952.txt b/sim/Statecraft.Sim.Tests/golden/hash1952.txtindex 38620ddc5..52f986e0d 100644--- a/sim/Statecraft.Sim.Tests/golden/hash1952.txt+++ b/sim/Statecraft.Sim.Tests/golden/hash1952.txt@@ -3,7 +3,7 @@ ind{food_supply=0.8555155874508137 [3FEB606239AA391F]housing=0.43504947742483624 [3FDBD7D9C36B9EB6]intl_standing=0.7800000000000002 [3FE8F5C28F5C28F8]- morale=0.4388039705804806 [3FDC155D3FBFE10A]+ morale=0.5690955554429493 [3FE23607E1DDA540]security=0.5361322526321604 [3FE127FED36C599C]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,10 +13,12 @@ pol{eff{border_villages_secure=0.04113225263216018 [3FA50F495FBB5C36]building_houses=0.08504947742483629 [3FB5C5CD7414E142]+ food_lifts_cohesion=0.08899999973526929 [3FB6C8B43834FD50]homes_lift_morale=0.06526319974146688 [3FB0B516CC859C48]rationing_feeds=0.3399999999208376 [3FD5C28F5C133334]rationing_grates=-0.15 [BFC3333333333333]safety_lifts_morale=0.05354077083901369 [3FAB69B227832BE6]+ work_lifts_cohesion=0.04129158512719951 [3FA5242BAF71511A]shift{food_supply=0.15000000000000002 [3FC3333333333334]housing=0 [0000000000000000]@@ -46,7 +48,7 @@ debt=170.89012071283815 [40655C7BDE6EE43A]fx=-12.990431328096559 [C029FB19D0A63796]rung=2;cf=0;mob=0.05 [3FA999999999999A]-stab=0.5097888733187989 [3FE05030C1589B0F]+stab=0.5682965036166527 [3FE22F7C262EDE92]att=4 [4010000000000000]fired[altalena@@ -133,7 +135,6 @@ city{tel_aviv=248,106,248,106,296tiberias=6,2,6,2,7zikhron_yaakov=2,1,2,1,2-coh=0.4364309229357378 [3FDBEE7BF73E36BA]units[1:halutz@-3,19site{diff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txtindex c6365a571..00ae5aeb1 100644--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt@@ -2,10 +2,10 @@# Tests read this file. To accept a deliberate change: STATECRAFT_UPDATE_GOLDEN=1 dotnet test sim/Statecraft.sln# rewrites this file, the snapshots and the GoldenRun.cs constants; then update docs/determinism.md and tools/web_check.py# (GoldenManifestTests names any place that is out of date) and add a row to the rebaseline history.-hash1950 d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a-hash1952 21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322-smoke5 3f7a0fe0d5f22e83edd00c8a913a8d216b4420c36907b11e2ec9406baecdad56-scenario-reckless 8f209d56a4e396750873fdfd37f35941f96d677d9a24e821793c6f016c8ad488-scenario-cautious a9afb0ad22dd4cb14da6e94117ae538ad96e33d5af53ad64785e62fa85c6bc1f-scenario-mvp-absorb-first 8601da9326339e51948c492f7b7ad662d261944c75f7d9a483c30cbb5f654f47-mvp-end 21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322+hash1950 2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be+hash1952 f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59+smoke5 2436927c8b24f28c42be0e7b5a6fe30900f2f6c6a3ba77e4be943c1f50db57cc+scenario-reckless af7b2abd4c6e477cc78555700b09822030773e9fc6b856ffc0a7109bedc1e7dd+scenario-cautious 28fd140536e326922fadf21571b64bdaae5125f97f2609b44b4baa5ca9bceda3+scenario-mvp-absorb-first b16a87402c03324f6260b57b915a0b7767f12cc166420ace257a21b54b341dd4+mvp-end f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txtindex 38620ddc5..52f986e0d 100644--- a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt+++ b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt@@ -3,7 +3,7 @@ ind{food_supply=0.8555155874508137 [3FEB606239AA391F]housing=0.43504947742483624 [3FDBD7D9C36B9EB6]intl_standing=0.7800000000000002 [3FE8F5C28F5C28F8]- morale=0.4388039705804806 [3FDC155D3FBFE10A]+ morale=0.5690955554429493 [3FE23607E1DDA540]security=0.5361322526321604 [3FE127FED36C599C]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,10 +13,12 @@ pol{eff{border_villages_secure=0.04113225263216018 [3FA50F495FBB5C36]building_houses=0.08504947742483629 [3FB5C5CD7414E142]+ food_lifts_cohesion=0.08899999973526929 [3FB6C8B43834FD50]homes_lift_morale=0.06526319974146688 [3FB0B516CC859C48]rationing_feeds=0.3399999999208376 [3FD5C28F5C133334]rationing_grates=-0.15 [BFC3333333333333]safety_lifts_morale=0.05354077083901369 [3FAB69B227832BE6]+ work_lifts_cohesion=0.04129158512719951 [3FA5242BAF71511A]shift{food_supply=0.15000000000000002 [3FC3333333333334]housing=0 [0000000000000000]@@ -46,7 +48,7 @@ debt=170.89012071283815 [40655C7BDE6EE43A]fx=-12.990431328096559 [C029FB19D0A63796]rung=2;cf=0;mob=0.05 [3FA999999999999A]-stab=0.5097888733187989 [3FE05030C1589B0F]+stab=0.5682965036166527 [3FE22F7C262EDE92]att=4 [4010000000000000]fired[altalena@@ -133,7 +135,6 @@ city{tel_aviv=248,106,248,106,296tiberias=6,2,6,2,7zikhron_yaakov=2,1,2,1,2-coh=0.4364309229357378 [3FDBEE7BF73E36BA]units[1:halutz@-3,19site{diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txtindex 41f6790ed..a471bec1f 100644--- a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt+++ b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt@@ -3,7 +3,7 @@ ind{food_supply=0.47968750000000004 [3FDEB33333333334]housing=0.42228343009948727 [3FDB06B1147AE147]intl_standing=0.5 [3FE0000000000000]- morale=0.5295946677017213 [3FE0F270843D46B3]+ morale=0.6182874575745196 [3FE3C902C739E7D4]security=0.5086917724609377 [3FE04733F7CED918]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,15 +13,17 @@ pol{eff{border_villages_secure=0.033691772460937505 [3FA1400C49BA5E36]building_houses=0.0722834300994873 [3FB2812AB851EB85]+ food_lifts_cohesion=0.04756250000000001 [3FA85A1CAC083128]homes_lift_morale=0.06197826633453369 [3FAFBB9D85F06F69]rationing_feeds=0.07968750000000002 [3FB4666666666668]rationing_grates=-0.06 [BFAEB851EB851EB8]safety_lifts_morale=0.04761640136718752 [3FA8612D4D4024B6]+ work_lifts_cohesion=0.04113028987279843 [3FA50F0783C1E0F0]shift{food_supply=0 [0000000000000000]housing=0 [0000000000000000]intl_standing=0 [0000000000000000]- morale=-0.06999999999999995 [BFB1EB851EB851E8]+ morale=-0.07000000000000006 [BFB1EB851EB851F0]security=0.17500000000000016 [3FC666666666666C]bud{agriculture_minister=0.07 [3FB1EB851EB851EC]@@ -45,7 +47,7 @@ debt=26.960591926047705 [403AF5E95A3B2D32]fx=80.85238326859616 [4054368D728D91CC]rung=5;cf=40;mob=0.8 [3FE999999999999A]-stab=0.5976373397227674 [3FE31FD8579F498C]+stab=0.6256903459725325 [3FE405A7C2ABFF9C]att=4 [4010000000000000]fired[altalena@@ -98,5 +100,4 @@ city{tel_aviv=248,106,248,106,16tiberias=6,2,6,2,0zikhron_yaakov=2,1,2,1,0-coh=0.6912776599813588 [3FE61EF253C26938]food=2253,751,0\ No newline at end of filediff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txtindex 0e91be5d4..b5d49ca2a 100644--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt@@ -3,7 +3,7 @@ ind{food_supply=0.7200000000000001 [3FE70A3D70A3D70B]housing=0.4311483383927494 [3FDB97EF3347C84B]intl_standing=0.7600000000000002 [3FE851EB851EB854]- morale=0.4239879519429728 [3FDB229E5CDF8EC0]+ morale=0.5096388805373344 [3FE04EF63295B160]security=0.500599903035164 [3FE004EA167D566E]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,10 +13,12 @@ pol{eff{border_villages_secure=0.03559990303516388 [3FA23A26868DB8BB]building_houses=0.08114833839274943 [3FB4C62333858794]+ food_lifts_cohesion=0.047495117187500005 [3FA85147AE147AE2]homes_lift_morale=0.06417065737109631 [3FB06D7CFAC58CD2]rationing_feeds=0.17 [3FC5C28F5C28F5C3]rationing_grates=-0.15 [BFC3333333333333]safety_lifts_morale=0.049817294571876544 [3FA981A705EC3DAE]+ work_lifts_cohesion=0.03815581140686154 [3FA38928944A2512]shift{food_supply=0.15000000000000002 [3FC3333333333334]housing=0 [0000000000000000]@@ -45,7 +47,7 @@ debt=59.72606782031707 [404DDCEFCA53784C]fx=94.29191537516759 [405792AEBDD362D7]rung=2;cf=0;mob=0.8 [3FE999999999999A]-stab=0.5512986983937466 [3FE1A43D2AFDB659]+stab=0.5829253189830537 [3FE2A752FFA15CD8]att=4 [4010000000000000]fired[altalena@@ -106,5 +108,4 @@ city{tel_aviv=248,106,248,90,64tiberias=6,2,6,2,1zikhron_yaakov=2,1,2,1,1-coh=0.6015740525166592 [3FE340183A35CCB3]food=2556,852,0\ No newline at end of filediff --git a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txtindex b5daf4b14..7b465319a 100644--- a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt+++ b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt@@ -3,7 +3,7 @@ ind{food_supply=0.59921875 [3FE32CCCCCCCCCCD]housing=0.42228343009948727 [3FDB06B1147AE147]intl_standing=0.38999999999999996 [3FD8F5C28F5C28F5]- morale=0.4051493552017212 [3FD9EDF78FA58F71]+ morale=0.5054202700745196 [3FE02C67215693DC]security=0.4636917724609376 [3FDDAD204189374E]pol{border_settlement=0.2 [3FC999999999999A]@@ -13,15 +13,17 @@ pol{eff{border_villages_secure=0.033691772460937505 [3FA1400C49BA5E36]building_houses=0.0722834300994873 [3FB2812AB851EB85]+ food_lifts_cohesion=0.059140625 [3FAE47AE147AE148]homes_lift_morale=0.06197826633453369 [3FAFBB9D85F06F69]rationing_feeds=0.19921875 [3FC9800000000000]rationing_grates=-0.15 [BFC3333333333333]safety_lifts_morale=0.04317108886718751 [3FA61A855DA27288]+ work_lifts_cohesion=0.04113028987279843 [3FA50F0783C1E0F0]shift{food_supply=0 [0000000000000000]housing=0 [0000000000000000]intl_standing=-0.11000000000000004 [BFBC28F5C28F5C2C]- morale=-0.10000000000000003 [BFB999999999999C]+ morale=-0.10000000000000009 [BFB99999999999A0]security=0.13000000000000012 [3FC0A3D70A3D70A8]bud{agriculture_minister=0.07 [3FB1EB851EB851EC]@@ -45,7 +47,7 @@ debt=34.960591926047705 [40417AF4AD1D9699]fx=80.85238326859616 [4054368D728D91CC]rung=5;cf=40;mob=1 [3FF0000000000000]-stab=0.5607986744564208 [3FE1F2100FCDC67A]+stab=0.5919575738389019 [3FE2F15102883E2B]att=4 [4010000000000000]fired[altalena@@ -96,5 +98,4 @@ city{tel_aviv=248,106,248,106,16tiberias=6,2,6,2,0zikhron_yaakov=2,1,2,1,0-coh=0.6912776599813588 [3FE61EF253C26938]food=2253,751,0\ No newline at end of filediff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.csindex 22a71155b..bb421e76a 100644--- a/sim/Statecraft.Sim/Cities.cs+++ b/sim/Statecraft.Sim/Cities.cs@@ -23,7 +23,6 @@ namespace Statecraft.Sim{if (!c.IsGdd) return;foreach (var x in c.Cities) s.Cities[x.Id] = new City(x.Id, x.HousingCapacity, x.JobSlots, x.Civilians, x.Employed, 0);- UpdateCohesion(s, c.RulesAt(s.Date).Mvp!);}/// <summary>R-CITY-001: sets the number of the city's civilians in jobs (a standing order). Refused, state untouched,@@ -67,16 +66,17 @@ namespace Statecraft.Sim}}- /// <summary>R-CITY-005, a placeholder while D-C1 is open: over all cities, the housed share (civilians of civilians and- /// refugees; 1 with nobody) and the employed share (employed of civilians; 1 with no civilians), weighted by the mvp- /// cohesion weights, clamped to 0 to 1. Counts are summed as integers, so city order cannot change the result.</summary>- public static void UpdateCohesion(GameState s, MvpRules r)+ /// <summary>The effect source id of the cities' employed share (R-CITY-005): a GDD-only source of `morale`, Social+ /// cohesion, read by the effects web after the turn's housing (D-A6). Phase 1's separate cohesion value is folded into it.</summary>+ public const string EmployedShareSource = "employed_share";++ /// <summary>R-CITY-005: employed over civilians, summed over all cities as integers (so city order cannot change it);+ /// 1 with no civilians, as nobody is out of work.</summary>+ public static double EmployedShare(GameState s){- long civilians = 0, employed = 0, refugees = 0;- foreach (var x in s.Cities.Values) { civilians += x.Civilians; employed += x.Employed; refugees += x.Refugees; }- var housed = civilians + refugees == 0 ? 1.0 : (double)civilians / (civilians + refugees);- var working = civilians == 0 ? 1.0 : (double)employed / civilians;- s.Cohesion = Math.Max(0, Math.Min(1, r.CohesionHousingWeight * housed + r.CohesionJobsWeight * working));+ long civilians = 0, employed = 0;+ foreach (var x in s.Cities.Values) { civilians += x.Civilians; employed += x.Employed; }+ return civilians == 0 ? 1.0 : (double)employed / civilians;}/// <summary>R-CITY-003 (D-A5, Q-ARRV-1): the turn's immigrants (the CBS series, aliyah.yaml) arrive as refugees, in wholediff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 08c2058de..342044bf6 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -460,10 +460,6 @@ namespace Statecraft.Simpublic int PeoplePerUnit { get; set; }/// <summary>Money each employed unit earns a year, in IL millions (R-CITY-002).</summary>public double IncomePerJobPerYear { get; set; }- /// <summary>Social cohesion's weight on the housed share (R-CITY-005). A placeholder while D-C1 is open.</summary>- public double CohesionHousingWeight { get; set; }- /// <summary>Social cohesion's weight on the employed share (R-CITY-005). A placeholder while D-C1 is open.</summary>- public double CohesionJobsWeight { get; set; }/// <summary>The day the cities start taking arrivals: the census day their start values count (R-CITY-003, Q-ARRV-3).</summary>public DateTime CityArrivalsFrom { get; set; }/// <summary>The day the GDD game ends (R-LOOP-004; D-E5, 15 January 1952 in the real content), or null for the lastdiff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 6700c3ccd..09cffb5e0 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -653,6 +653,9 @@ namespace Statecraft.Simvar parties = new HashSet<string>(c.Parties.Select(p => p.Id));var indicators = new HashSet<string>(c.Indicators.Select(i => i.Id));var sources = new HashSet<string>(c.Policies.Select(p => p.Id).Concat(indicators));+ // The cities' employed share (R-CITY-005). Accepted in both loops, so the real content still loads with the loop+ // switch taken out (Unity's SimBridgeGddTests.Legacy); with no cities it reads 0 (EffectsSystem.Source).+ sources.Add(Cities.EmployedShareSource);Unique("offices.yaml", "offices", c.Offices.Select(o => o.Id));Unique("parties.yaml", "parties", c.Parties.Select(p => p.Id));Unique("people.yaml", "people", c.People.Select(p => p.Id));@@ -1036,10 +1039,6 @@ namespace Statecraft.Simif (m.PeoplePerUnit != c.Rules.Mvp!.PeoplePerUnit)throw new ContentException(file, "mvp.people_per_unit", "must be the same in every era (arrivals are counted in one unit size)");if (!(m.IncomePerJobPerYear >= 0 && IsFinite(m.IncomePerJobPerYear))) throw new ContentException(file, "mvp.income_per_job_per_year", "must be a finite number >= 0");- Unit(file, "mvp.cohesion_housing_weight", m.CohesionHousingWeight);- Unit(file, "mvp.cohesion_jobs_weight", m.CohesionJobsWeight);- if (Math.Abs(m.CohesionHousingWeight + m.CohesionJobsWeight - 1) > 1e-9)- throw new ContentException(file, "mvp.cohesion_jobs_weight", "the two cohesion weights must sum to 1");// R-CITY-003: the cities count arrivals from one day; another day in a later era would lose or double-count units.if (m.CityArrivalsFrom == default) throw new ContentException(file, "mvp.city_arrivals_from", "required when eras.yaml systems.loop is gdd");if (m.CityArrivalsFrom != c.Rules.Mvp!.CityArrivalsFrom) throw new ContentException(file, "mvp.city_arrivals_from", "must be the same in every era (the cities count arrivals from one day)");diff --git a/sim/Statecraft.Sim/EffectsSystem.cs b/sim/Statecraft.Sim/EffectsSystem.csindex 6eb021545..bee6376e3 100644--- a/sim/Statecraft.Sim/EffectsSystem.cs+++ b/sim/Statecraft.Sim/EffectsSystem.cs@@ -46,7 +46,7 @@ namespace Statecraft.Sim// Read every source before writing anything, so effect order cannot change results.var v = c.At(s.Date);var targets = v.Effects.ToDictionary(e => e.Id, e =>- e.K * (s.Policies.TryGetValue(e.Source, out var p) ? p : s.Indicators[e.Source]) * Multiplier(c, s, e.Office));+ e.K * Source(s, e.Source) * Multiplier(c, s, e.Office));var moved = new HashSet<string>();foreach (var e in v.Effects){@@ -69,6 +69,13 @@ namespace Statecraft.SimUpdateSituations(c, s, why);}+ /// <summary>An effect's source level: a policy, an indicator, or the cities' employed share (R-CITY-005). The legacy+ /// loop has no cities, so there the share reads 0 and the effect adds nothing (not 1, which would lift morale).</summary>+ static double Source(GameState s, string id) =>+ s.Policies.TryGetValue(id, out var p) ? p+ : id == Cities.EmployedShareSource ? (s.Cities.Count == 0 ? 0.0 : Cities.EmployedShare(s))+ : s.Indicators[id];+/// <summary>clamp(base + effect contributions) to [0, 1], before event shifts. In the GDD loop food_supply also carries/// the Food stock's term (R-FOOD-003), exactly 0 at a full cover.</summary>internal static double Inner(Content c, GameState s, Indicator i) =>diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.csindex 744014930..f6687b8ff 100644--- a/sim/Statecraft.Sim/GameState.cs+++ b/sim/Statecraft.Sim/GameState.cs@@ -60,9 +60,6 @@ namespace Statecraft.Sim// GDD v0.1 state (spec 2026-10-12 section 2.2). Empty in the legacy loop, and then left out of the hash (R-LOOP-002)./// <summary>The cities by id (ordinal).</summary>public SortedDictionary<string, City> Cities = new SortedDictionary<string, City>(StringComparer.Ordinal);- /// <summary>Social cohesion, 0 to 1, from the cities' housing and jobs (R-CITY-005). A placeholder while D-C1 is open:- /// no other system reads it, and only the top bar shows it (#380). Hashed only when the state has cities.</summary>- public double Cohesion;/// <summary>The movable units by id.</summary>public SortedList<int, Unit> Units = new SortedList<int, Unit>();/// <summary>The groups in training by id (R-TRAIN-001). A cohort leaves when it finishes or is cancelled.</summary>@@ -187,15 +184,7 @@ namespace Statecraft.Simforeach (var i in items) { Entry(); sb.Append(i); Sep(); }Close(close);}- if (Cities.Count > 0)- {- Section("city", '{', '}', Cities.Values.Select(x => x.Canonical()));- Sep();- var bits = BitConverter.DoubleToInt64Bits(Cohesion == 0.0 ? 0.0 : Cohesion).ToString("X16", CultureInfo.InvariantCulture);- Nl(); sb.Append("coh=");- if (readable) sb.Append((Cohesion == 0.0 ? 0.0 : Cohesion).ToString("R", CultureInfo.InvariantCulture)).Append(" [").Append(bits).Append(']');- else sb.Append(bits);- }+ if (Cities.Count > 0) Section("city", '{', '}', Cities.Values.Select(x => x.Canonical()));if (Units.Count > 0) Section("units", '[', ']', Units.Values.Select(x => x.Canonical()));if (Cohorts.Count > 0) Section("train", '[', ']', Cohorts.Values.Select(x => x.Canonical()));if (Sites.Count > 0) Section("site", '{', '}', Sites.Values.Select(x => x.Canonical()));diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.csindex 120cb0df4..ec4b5bf7e 100644--- a/sim/Statecraft.Sim/GoldenRun.cs+++ b/sim/Statecraft.Sim/GoldenRun.cs@@ -15,13 +15,13 @@ namespace Statecraft.Sim/// <summary>Final hash of Play(content, Until1950). Changing it is a deliberate rules or content change: the value/// is pinned in sim/Statecraft.Sim.Tests/golden/manifest.txt, and STATECRAFT_UPDATE_GOLDEN=1 dotnet test rewrites/// both (docs/determinism.md). Say why in the commit message.</summary>- public const string Hash1950 = "d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a";+ public const string Hash1950 = "2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be";public static readonly DateTime Until1950 = new DateTime(1950, 1, 1);/// <summary>Final hash of Play(content, Until1952): the M3 content range (to 31 December 1951). The GDD game ends on/// 15 January 1952 (R-LOOP-004), the first turn on or after Until1952, so this is also the mvp-end run.</summary>- public const string Hash1952 = "21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322";+ public const string Hash1952 = "f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59";public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.csindex b1dacdfc8..df38471e4 100644--- a/sim/Statecraft.Sim/TurnResolver.cs+++ b/sim/Statecraft.Sim/TurnResolver.cs@@ -19,8 +19,7 @@ namespace Statecraft.SimProjects.Advance(c, s, next, why); // 5. constructionCities.Produce(c, s, r, yearFraction, why); // 6. productionPools.Consume(c, s, r, why); // 7. consumption: the nation eats, then imports (R-FOOD-002)- Cities.House(c, s, why); // 8. housing, then Social cohesion- Cities.UpdateCohesion(s, r);+ Cities.House(c, s, why); // 8. housing; Social cohesion is morale, which the effects web moves after the resolutionCities.Arrive(c, s, r, next, why); // 9. arrivals// 10. Occupation timers: Phase 6.Objectives.Complete(c, s, r, next, why); // 11. objectives and scorediff --git a/tools/web_check.py b/tools/web_check.pyindex 20f555c3c..3c05810a5 100644--- a/tools/web_check.py+++ b/tools/web_check.py@@ -8,7 +8,7 @@ fail on a failure line or a timeout. Uses Chrome for Testing from the Playwright--enable-logging=stderr --v=1 as INFO:CONSOLE... "text", source: ...Usage (from the repo root):- uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 d22b369fa9d269a2311a51ab26ef8e0069c3e55f8febfa0376340dd03e012b8a" --expect "GOLDEN OK 1952 21029217387d875c8723f0a99e46f199fa3181ba979352ac8200c6d5045e1322"+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 2766b45b13c63daa7b6a71bfa8b40a8c52f542a6d6ddcf70ac0810fa27d952be" --expect "GOLDEN OK 1952 f8cd22d7b754d5f7d5cc24b9b4576cedd4940fdb28d987ad86cd7004bead9e59"Options: --query Q (page URL query, without '?'), --expect TEXT (repeatable), --fail REGEX (default: GOLDEN FAIL|SMOKE FAIL|BOOT FAIL),--timeout SECONDS (default 300), --stall SECONDS (fail when no console message arrives for that long; 0 = off),--swiftshader (software WebGL when there is no GPU), --dpr N (default 1), --shots DIR (reassemble the player'sdiff --git a/unity/Assets/Scripts/UI/HudModel.cs b/unity/Assets/Scripts/UI/HudModel.csindex 52f469b68..b622149e6 100644--- a/unity/Assets/Scripts/UI/HudModel.cs+++ b/unity/Assets/Scripts/UI/HudModel.cs@@ -23,7 +23,7 @@ namespace Statecraft.Game.UI{public string Year = "", Turn = "", Date = "", Attention = "", SecurityLevel = "", Score = "";public Meter Treasury, Immigration, Security, Support, Standing, Fx;- /// <summary>Social cohesion (GameState.Cohesion, R-CITY-005) on the 0-100 scale, shown only in the GDD loop+ /// <summary>Social cohesion (the morale indicator, R-NAT-001) on the 0-100 scale, shown only in the GDD loop/// (ShowsCohesion; the owner's ruling of 15 October 2026, #380). Empty in the legacy loop.</summary>public Meter Cohesion = new Meter("", "", 0, "", "");public bool ShowsCohesion;@@ -90,7 +90,7 @@ namespace Statecraft.Game.UIStanding = Points(s.Indicators["intl_standing"], prev?.Indicators["intl_standing"]),Fx = Money("fx_reserves", s.FxReserves, prev?.FxReserves),ShowsCohesion = c.IsGdd,- Cohesion = c.IsGdd ? Points(s.Cohesion, prev?.Cohesion) : new Meter("", "", 0, "", ""),+ Cohesion = c.IsGdd ? Points(s.Indicators["morale"], prev?.Indicators["morale"]) : new Meter("", "", 0, "", ""),};}}diff --git a/unity/Assets/Tests/EditMode/HudTests.cs b/unity/Assets/Tests/EditMode/HudTests.csindex f158945bd..983e0cd0d 100644--- a/unity/Assets/Tests/EditMode/HudTests.cs+++ b/unity/Assets/Tests/EditMode/HudTests.cs@@ -153,10 +153,10 @@ public class HudTestsAssert.AreEqual("Score 150", label.text);}- // ---- Social cohesion (#380): a resource meter, only in the GDD loop, from GameState.Cohesion ----+ // ---- Social cohesion (#380): a resource meter, only in the GDD loop, from the morale indicator ----/// <summary>The owner's ruling of 15 October 2026 (#380): Social cohesion on the top bar as a resource meter, in the GDD- /// loop. Its value is GameState.Cohesion (R-CITY-005) on the 0-100 scale, as the other 0..1 meters; after a turn it+ /// loop. Its value is the morale indicator (R-NAT-001) on the 0-100 scale, as the other 0..1 meters; after a turn it/// shows the change, and its tooltip says both, under the caption the bar shows (Hebrew: לכידות חברתית).</summary>[Test]public void TheGddGameShowsSocialCohesion()@@ -168,19 +168,19 @@ public class HudTestsAssert.AreEqual(DisplayStyle.Flex, meter.style.display.value, "shown in the GDD loop");Assert.AreEqual("Social cohesion", meter.Q<Label>(className: "meter-name").text);Assert.AreEqual("rings", meter.Q<UiIcon>().Glyph);- Assert.Greater(bridge.State.Cohesion, 0.0, "precondition: the cities have set it at the start");- Assert.AreEqual(PlayerText.Percent(bridge.State.Cohesion), ui.Q<Label>("cohesion-value").text);+ Assert.Greater(bridge.State.Indicators["morale"], 0.0, "precondition: the indicator starts at its base");+ Assert.AreEqual(PlayerText.Percent(bridge.State.Indicators["morale"]), ui.Q<Label>("cohesion-value").text);Assert.AreEqual("", ui.Q<Label>("cohesion-delta").text, "no change before the first turn");- Assert.AreEqual($"Social cohesion: {PlayerText.Percent(bridge.State.Cohesion)}", meter.tooltip);+ Assert.AreEqual($"Social cohesion: {PlayerText.Percent(bridge.State.Indicators["morale"])}", meter.tooltip);bridge.EndTurn();var prev = bridge.Session.Previous!; var now = bridge.State;- now.Cohesion = 0.634; prev.Cohesion = 0.584; // 58% -> 63%: up 5 points+ now.Indicators["morale"] = 0.634; prev.Indicators["morale"] = 0.584; // 58% -> 63%: up 5 pointshud.Render();Assert.AreEqual("63%", ui.Q<Label>("cohesion-value").text);Assert.AreEqual("+5%", ui.Q<Label>("cohesion-delta").text);Assert.IsTrue(ui.Q<Label>("cohesion-delta").ClassListContains("delta-up"));Assert.AreEqual("Social cohesion: 63%, up 5 points since last turn", meter.tooltip);- now.Cohesion = 0.574; // 58% -> 57%: down 1 point+ now.Indicators["morale"] = 0.574; // 58% -> 57%: down 1 pointhud.Render();Assert.AreEqual("-1%", ui.Q<Label>("cohesion-delta").text);Assert.IsTrue(ui.Q<Label>("cohesion-delta").ClassListContains("delta-down"));diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex 67e22dd02..d902d3ac5 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -28,7 +28,7 @@ hud.caption.security: "Security"hud.caption.support: "Public support"hud.caption.standing: "International support"hud.caption.fx: "Foreign currency"-# Social cohesion (GameState.Cohesion, R-CITY-005), the GDD loop only; the owner's ruling of 15 October 2026 (#380).+# Social cohesion (the morale indicator, R-NAT-001), the GDD loop only; the owner's ruling of 15 October 2026 (#380).hud.caption.cohesion: "Social cohesion"# The other static texts of Game.uxml, each set by the presenter that owns its element (#193). Each English string is# the UXML's own text (HebrewUiTests.EachEnglishStaticTextIsTheUxmlsOwnText), so English shows what it always showed.