A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: the coalition no longer ends the GDD game; R-GOV-001 and R-GOV-002 (refs #730) (#830)
Beri096b740f6406
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e799ec64d..5acb56f54 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,10 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBThe checks file is now written in the bundle cache and copied beside the shipped bundles.### Changed+- The coalition can no longer end the GDD game (refs #730, R-GOV-001; D-C5, D-B5: "Coalition collapse is off in the+ MVP"). Its stability still follows public approval and still weights the coalition votes; the legacy loop keeps its+ collapse. R-GOV-002 pins what the GDD orders cost in Attention: each has a price, the unit orders are free, and a+ refused order is refunded. No golden moves: no reference run's stability falls below 0.2.- 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/docs/rules/mvp.md b/docs/rules/mvp.mdindex 869543284..1ce171f04 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -97,3 +97,11 @@ R-FOOD-001: Food is a national stock of whole units (`GameState.Food`); one unitR-FOOD-002: In step 7 the nation eats the turn's need from the stock as far as it goes: the stock stops at 0, and the rest is the unmet share, kept in the state with the need (Q-POOL-5, decided 15 October 2026). Then a monthly import brings the stock back to `cover_months` of the need, unless foreign currency is exhausted (the `fx_crisis` situation at the turn's start), when nothing is imported (Q-POOL-4, decided 15 October 2026). Imports are already paid for in foreign currency per head (`imports_per_capita_per_year`), so they are not charged again. In the GDD loop the crisis cuts the imports, not `food_supply` directly: `fx_crisis_food_per_year` acts in the legacy loop only.R-FOOD-003: `food_supply` stays the 0 to 1 level the UI, the situations and the events read (Q-POOL-3, decided 15 October 2026), with a stock term inside its effect sum: `k_food * (stock - full) / full - unmet / need`, where `full` is `cover_months` of the last need. The term is exactly 0 at a full stock, `-k_food` when the stock is empty, and the unmet share lowers it further; rationing, the other effects and event shifts act on top as before, and the level's clamp to 0..1 bounds the result. The GDD loop requires the `food_supply` indicator.++## Government++D-C5 as decided (12 October 2026): the cabinet and Attention stay, the coalition is optional with no collapse. The coalition votes, the budget shares and the policies keep running and visible as before (Q-GOV-1, decided 15 October 2026, "Take all recommendations", #375). The defeat (D-B5) is built in Phase 7 (Q-GOV-2, decided the same day).++R-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.diff --git a/sim/Statecraft.Sim.Tests/GovernmentTests.cs b/sim/Statecraft.Sim.Tests/GovernmentTests.csnew file mode 100644index 000000000..c2f822034--- /dev/null+++ b/sim/Statecraft.Sim.Tests/GovernmentTests.cs@@ -0,0 +1,69 @@+using System;+using System.Linq;+using Statecraft.Sim;++/// <summary>The D-C5 choices in the GDD loop (Phase 2 plan, PR 6): the cabinet, the coalition votes, the budget and the+/// policies keep running as they do today (Q-GOV-1), but the coalition can no longer end the game, and Attention prices+/// the GDD orders.</summary>+public class GovernmentTests+{+ static GameState CollapsingCoalition(Content c)+ {+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ s.CoalitionStability = 0.1;+ s.Indicators["morale"] = 0.0; // approval falls, so stability stays under the line through the turn+ return s;+ }++ // R-GOV-001 (D-C5, D-B5: "Coalition collapse is off in the MVP")+ [Fact]+ public void StabilityBelowTheLineDoesNotEndTheGddGame()+ {+ var c = ContentLoader.Load(Fixture.Write(Fixture.Gdd()));+ Assert.True(c.IsGdd);+ var r = Simulation.Step(c, CollapsingCoalition(c), Array.Empty<Command>());+ Assert.True(r.State.CoalitionStability < PoliticsSystem.CollapseBelow, $"stability {r.State.CoalitionStability}");+ Assert.Null(r.State.GameOver);+ Assert.DoesNotContain(r.Why, w => w.Target == "game_over");+ }++ // R-GOV-001: the legacy loop keeps its collapse while the legacy code exists (D-E1).+ [Fact]+ public void StabilityBelowTheLineStillEndsTheLegacyGame()+ {+ var c = ContentLoader.Load(Fixture.Write());+ Assert.False(c.IsGdd);+ var r = Simulation.Step(c, CollapsingCoalition(c), Array.Empty<Command>());+ Assert.Equal(GameOverCodes.CoalitionCollapse, r.State.GameOver);+ }++ // R-GOV-002: every GDD order has a price in the real rules, and the unit orders are free (D-A6).+ [Fact]+ public void EveryGddKindHasACostAndUnitOrdersAreFree()+ {+ var c = ContentLoader.Load(RealContentTests.ContentRoot());+ var gdd = CommandGuardTests.Samples.Values.Where(cmd => AttentionSystem.IsGddKind(cmd.Kind)).ToList();+ Assert.NotEmpty(gdd);+ foreach (var cmd in gdd) Assert.True(c.Rules.AttentionCost.ContainsKey(cmd.Kind), $"{cmd.Kind} has no attention_cost");+ Assert.Equal(0, c.Rules.AttentionCost["pioneer_work"]);+ Assert.Equal(0, c.Rules.AttentionCost["stop_work"]);+ }++ // R-GOV-002: a refused GDD order costs nothing. The samples name a city, a cohort and a unit the GDD fixture does not+ // have, so each is refused. Attention refills at the end of the step, so the end state cannot show a refund: the turn+ // holds only enough Attention for the dearer of the refused order and a policy after it, and the policy still goes+ // through. Without the refund, any priced order would leave too little for the policy.+ [Fact]+ public void ARefusedGddOrderRefundsItsAttention()+ {+ var c = ContentLoader.Load(Fixture.Write(Fixture.Gdd()));+ var policy = new SetPolicy("rationing", 0.5);+ foreach (var cmd in CommandGuardTests.Samples.Values.Where(cmd => AttentionSystem.IsGddKind(cmd.Kind)))+ {+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ s.Attention = Math.Max(AttentionSystem.Cost(c, s, cmd.Kind), AttentionSystem.Cost(c, s, policy.Kind));+ var r = Simulation.Step(c, s, new Command[] { cmd, policy });+ Assert.Same(cmd, Assert.Single(r.Rejected).Command);+ }+ }+}diff --git a/sim/Statecraft.Sim/PoliticsSystem.cs b/sim/Statecraft.Sim/PoliticsSystem.csindex 23fd300cf..e058cc55c 100644--- a/sim/Statecraft.Sim/PoliticsSystem.cs+++ b/sim/Statecraft.Sim/PoliticsSystem.cs@@ -37,7 +37,9 @@ namespace Statecraft.Sims.CoalitionStability = old + (EffectsSystem.Approval(c, s) - old) * Math.Min(1.0, yearFraction * 2);if (Math.Abs(s.CoalitionStability - old) > 1e-9)why.Add(new Cause("politics", "coalition_stability", s.CoalitionStability - old, $"coalition stability {PlayerText.PercentChange(s.CoalitionStability - old)} (public approval)"));- if (s.CoalitionStability < CollapseBelow && s.GameOver == null)+ // R-GOV-001: in the GDD loop the coalition stays, but it can no longer end the game (D-C5; D-B5, "Coalition+ // collapse is off in the MVP"). The legacy loop keeps its collapse while the legacy code exists (D-E1).+ if (!c.IsGdd && s.CoalitionStability < CollapseBelow && s.GameOver == null){s.GameOver = GameOverCodes.CoalitionCollapse;why.Add(new Cause("politics", "game_over", 0, "The coalition collapsed. Your premiership is over."));