Skip to content

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 war state's first slice - the call-up retires in the GDD loop (#750) (#1148)

agamrafaeli-instinct5d5bee4d1a32
diff --git a/changelog.d/1148.md b/changelog.d/1148.md
new file mode 100644
index 000000000..cfb7ddf6d
--- /dev/null
+++ b/changelog.d/1148.md
@@ -0,0 +1,7 @@
+### Changed
+- The war state's first slice (R-WAR-002 and R-WAR-003's clock; refs #750, #1148, by Agam): in the GDD loop the sim
+ refuses the call-up and the security order ("That order is not available in this game", state and Attention
+ unchanged), and the call-up follows the rung an event sets, lowered to the rung's minimum as well as raised, so the
+ army still goes home after the 1949 armistices and the 1950-51 debt rise stays on the Michaely anchor. HistoricalAI
+ sends no call-up order there, the 52-week ceasefire clock never starts, and the Defence screen hides the rung and
+ call-up controls and the ceasefire line. The legacy loop is unchanged. The goldens move (the debt, `mob`, `cf`).
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index a8da8926f..e4771c4bc 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -28,10 +28,10 @@ macOS IL2CPP parity check is not an MVP release gate.
"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression gzip -shareable -logFile "$PWD/unity-build-web-gz.log"
git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset
golden_expect=(); while read -r name hash; do [[ -z "$name" || "$name" == \#* ]] || golden_expect+=(--expect "GOLDEN OK $name $hash"); done < sim/Statecraft.Sim.Tests/golden/manifest.txt
- # one GOLDEN OK line per manifest golden (#394), e.g. "GOLDEN OK hash1950 d14a4899a1e068bf238f84f4e8fe06270b5164b2c6ba62f2fef399fd7eaada8e"
- # and "GOLDEN OK hash1952 3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85"
+ # one GOLDEN OK line per manifest golden (#394), e.g. "GOLDEN OK hash1950 f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df"
+ # and "GOLDEN OK hash1952 ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf"
uv run tools/web_check.py unity/Builds/Web-gzip --query "golden&smoke=5" "${golden_expect[@]}" \
- --expect "SMOKE OK 5 turns 1948-10-15 7559f30cc7649555cb369b729442d203fa0b42968679f870ac88f0e519a8b755"
+ --expect "SMOKE OK 5 turns 1948-10-15 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
uv run tools/web_check.py unity/Builds/Web-gzip --startscreen new --timeout 300 --stall 90
uv run tools/web_check.py unity/Builds/Web-gzip --startscreen recording --timeout 300 --stall 90
uv run tools/web_check.py unity/Builds/Web-gzip --startscreen new --query lang=he --timeout 300 --stall 90
@@ -61,7 +61,7 @@ macOS IL2CPP parity check is not an MVP release gate.
"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression gzip -decompressionFallback -shareable -out Builds/Web-pages -logFile "$PWD/unity-build-web-pages.log"
git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset
uv run tools/web_check.py unity/Builds/Web-pages --query "golden&smoke=5" "${golden_expect[@]}" \
- --expect "SMOKE OK 5 turns 1948-10-15 7559f30cc7649555cb369b729442d203fa0b42968679f870ac88f0e519a8b755"
+ --expect "SMOKE OK 5 turns 1948-10-15 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
uv run tools/web_check.py unity/Builds/Web-pages --startscreen new --timeout 300 --stall 90
uv run tools/web_check.py unity/Builds/Web-pages --startscreen recording --timeout 300 --stall 90
uv run tools/web_check.py unity/Builds/Web-pages --startscreen new --query lang=he --timeout 300 --stall 90
diff --git a/docs/determinism.md b/docs/determinism.md
index 894bef66a..7b362b44c 100644
--- a/docs/determinism.md
+++ b/docs/determinism.md
@@ -41,9 +41,9 @@ final `GameState.Hash()` is pinned:
| Run | Ends | Hash |
|---|---|---|
-| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `d14a4899a1e068bf238f84f4e8fe06270b5164b2c6ba62f2fef399fd7eaada8e` |
-| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85` |
-| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85` |
+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df` |
+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf` |
+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf` |
`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
@@ -52,7 +52,7 @@ player check enumerate the manifest, so it and every scenario are checked withou
A further value is pinned for the browser smoke run (`?smoke=5`: the golden seed, five turns played through the UI's own
buttons, 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 7559f30cc7649555cb369b729442d203fa0b42968679f870ac88f0e519a8b755`.
+ministers): `SMOKE OK 5 turns 1948-10-15 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1`.
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 WebGL build with every manifest entry (plus the UI-path smoke line) with:
@@ -63,21 +63,21 @@ while read -r name hash; do
golden_expect+=(--expect "GOLDEN OK $name $hash")
done < sim/Statecraft.Sim.Tests/golden/manifest.txt
uv run tools/web_check.py unity/Builds/Web-<compression> --query "golden&smoke=5" "${golden_expect[@]}" \
- --expect "SMOKE OK 5 turns 1948-10-15 7559f30cc7649555cb369b729442d203fa0b42968679f870ac88f0e519a8b755"
+ --expect "SMOKE OK 5 turns 1948-10-15 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
```
`smoke-orders` (GDD Phase 5 PR 15, #754) is the same kind of browser run for the unit orders (`?smoke-orders`, desktop
`-smoke-orders`: the golden seed, one turn). It hides the turn's event card (the events go to their ministers), clicks the
hex of the unit `GoldenRun.SmokeMove` names (the lowest-id unit `Movement.Reachable` has a hex for: unit 0, Golani, on
10,9), presses the unit card's Move button, clicks the first lit hex in `Reachable`'s (q, r) order (7,11) and presses End
-Turn: `SMOKE ORDERS OK 1948-06-15 98422be8eca2981e191fde3a7aaf28fdef269203cee2f6dfe7a7cddb770f7133`.
+Turn: `SMOKE ORDERS OK 1948-06-15 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee`.
`GoldenRun.PlaySmokeOrders` plays the same turn with that one `Move`, so the value is in the manifest (`SliceSmokeTests.TheSmokeOrdersRunMovesOneUnitAndEndsOnTheGolden`) and the player's golden check
prints it as `GOLDEN OK smoke-orders`. Re-record it when the sim or the order path on the card changes; the fortify, hold and
attack slices can add their orders to it. Check a WebGL build with:
```
uv run tools/web_check.py unity/Builds/Web-<compression> --query "smoke-orders" \
- --expect "SMOKE ORDERS OK 1948-06-15 98422be8eca2981e191fde3a7aaf28fdef269203cee2f6dfe7a7cddb770f7133"
+ --expect "SMOKE ORDERS OK 1948-06-15 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee"
```
**When a golden moves.** The test fails with the lines that changed, grouped by section (`[ind]`, `[pol]`, `[bud]`,
@@ -386,3 +386,12 @@ The hash reads the state keys, so it never sees a record outside its window. An
| #1241: Etzioni starts, the 7th Brigade arrives (R-UNIT-009), on the enemy AI (#1263) | scenario-mvp-absorb-first | `64bdd93b` | same as reckless (was `de176931`) |
| #1241: Etzioni starts, the 7th Brigade arrives (R-UNIT-009), on the enemy AI (#1263) | scenario-mvp-defeat | `54ec7d6b` | same as reckless; the defeat is unchanged (was `7404295a`) |
| GDD Phase 5 PR 15 slice 4 (#754) | smoke-orders | `98422be8` | new: one turn from the golden seed whose only order is unit 0 (Golani) moving from 10,9 to 7,11, given through the unit card in the browser run; no other golden moves |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | 1950 | `f70d7cc2` | R-WAR-002: the GDD loop refuses the call-up order, so HistoricalAI sends none, and the call-up follows the rung down to its minimum the turn an event lowers it: 40% on the first truce's rung 4 (15 August 1948) and 5% on the armistices' rung 2 (15 April 1949), each a turn before HistoricalAI's order used to. Only the debt line moves, IL 87.5m to 81.8m. R-WAR-003: the ceasefire clock never starts, which this run's end state does not show (rung 2, `cf=0` either way) (was `d14a4899`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | 1952 | `ca78893d` | same as 1950: only the debt line, IL 211.9m to 206.1m; the 1950-51 rise stays inside the Michaely anchor's tolerance (EconomyCalibrationTests) (was `3bacd2b1`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | mvp-end | `ca78893d` | same as 1952 (was `3bacd2b1`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | smoke5 | `71a4cef0` | the smoke run sends no call-up order, so on main the 80% call-up stayed through the first truce; now it follows rung 4 down to 40%. Only `mob` (0.8 to 0.4) and the debt (IL 8.9m to 2.9m) move (was `7559f30c`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | scenario-cautious | `d6e7cea0` | the call-up follows the truce's rung down and back up (debt IL 27.0m to 21.0m), and the ceasefire clock never starts (`cf=40` to `cf=0`) (was `e45c5429`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | scenario-reckless | `57b3c29d` | the scenario's `set_mobilization: 1.0` order is gone (the GDD loop refuses it), so the call-up is the war rung's 80% (`mob` 1 to 0.8, debt IL 35.0m to 21.0m), and `cf=40` to `cf=0` as in cautious (was `030817e3`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | scenario-mvp-absorb-first | `912504be` | the scenario sends no call-up order, so on main the 80% call-up stayed after the armistices; now it follows rung 2 down to 5% (`mob` 0.8 to 0.05, debt IL 316.4m to 272.9m) (was `64bdd93b`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | scenario-mvp-defeat | `109b0a5e` | the retired full call-up is replaced by 120 Arms bought on credit on the first turn (`arms` 12 to 132), and the call-up follows the armistices to 5% (`mob` 1 to 0.05). The debt passes the ceiling in July 1951 (was April) and ends at IL 281.6m (was 339.1m); the defeat is unchanged: `defeat_economy` on 15 January 1952 after three exhausted turns (was `54ec7d6b`) |
+| GDD Phase 5 PR 11, slice 1: the call-up retires in the GDD loop (#750, #1148) | smoke-orders | `4c991630` | R-WAR-003: the ceasefire clock never starts, so the one-turn run ends on `cf=0` (was `cf=48`); nothing else moves (was `98422be8`) |
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index a2acdfee7..df1470345 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -236,6 +236,14 @@ R-ENEMY-004: No enemy unit arrives or grows in Phase 5 (Q-ENEMY-3): no turn adds
R-ENEMY-006: No enemy unit attacks inside a truce window (owner, 21 October 2026, #749): the first truce from 11 June to 8 July 1948 and the second from 18 July to 15 October 1948, half-open, the dates of `events/first_truce.yaml`, `events/second_truce.yaml`, `events/ten_days.yaml` and `events/operation_yoav.yaml` (the same windows as `map/control_hexes_1948_49.yaml`'s truce periods). A turn is in a truce when its middle day is (agent default): a monthly turn spans a truce's edge, and the middle puts it on the side that holds most of its days. So the turns of 15 June to 15 September 1948 are truce turns, and those of 15 May and 15 October 1948 are not. On a truce turn every enemy unit's standing attack ends first, whatever the unit then does (owner, #1263): it may still move on its script (R-ENEMY-002), and a unit off its script fortifies (R-ENEMY-003's else branch). The guard is by date alone, in every mode, whatever the truce cards' answers: #750 replaces it with the full war state.
+## The war state
+
+Phase 5 PR 11, first slice (#750; Q-WAR-1, Q-WAR-2 and Q-WAR-4, owner, 15 October 2026, #375: "Take all recommendations"; D-C4): the security rung stops being a player lever in the GDD loop and stays the value the war events set. The player's attacks in a truce (Q-WAR-3) are a later slice of #750.
+
+R-WAR-002: In the GDD loop the sim refuses `SetMobilization` and `SecurityOrder` with "That order is not available in this game", the state and the Attention unchanged (the convention of R-CITY-001's legacy refusal). The call-up follows the rung instead: when the rung changes (an event's `set_rung`), the call-up becomes that rung's `rung_min_mobilization`, raised as before and now also lowered, with the cause "Reserves sent home: call-up lowered to N%, the minimum for security level R". That is what `HistoricalAI`'s call-up order did a turn later in the legacy loop (the army demobilised after the 1949 armistices), so the debt calibration holds (`EconomyCalibrationTests`, the Michaely IL 98.4m 1950-51 anchor within 15%; the owner's condition on #1148). `HistoricalAI` sends no call-up order in the GDD loop, and the Defence screen hides its escalate, de-escalate and call-up controls there. The legacy loop accepts both orders and keeps the call-up where the player put it.
+
+R-WAR-003 (first slice): the GDD loop retires the 52-week UN ceasefire clock (Q-WAR-2, option (b)): it never starts (`CeasefireWeeksLeft` stays 0), never counts down and never ends the war, and the Defence screen shows no ceasefire line there. An event's `set_rung` still moves the rung (Q-WAR-4). `ceasefire_weeks` stays in the rules for the legacy loop, which keeps the clock.
+
## Prisoners
Phase 5 PR 12 (#751). The impact plan's §4.3 as written (Q-POW-1), points per unit returned (Q-POW-2), a sourced event card per front (Q-POW-3), the player's soldiers counted with a cost (Q-POW-4) and a Food cost whose shortfall costs cohesion (Q-POW-5): the owner's picks of 15 October 2026 (#375). The four amounts (`rules.yaml` `mvp.food_per_prisoner_unit`, `mvp.prisoner_shortfall_cohesion`, `mvp.points_per_prisoner_unit_returned`, `mvp.held_soldier_cost_per_turn`) are agent defaults posted on #751 (https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6318787961), accepted by the owner as design values (owner, 21 October 2026, #751: https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6321366548). The same ruling says ALA and local-force prisoners belong to no front, so they stay held, and fed, to the game's end. It does not name the front of each side or the captor of the player's soldiers; those stay agent defaults. The four sourced exchange cards are not in `content/` yet: they wait for a person's source check (CONTENT_POLICY §2) and the owner's sensitivity review.
diff --git a/sim/Statecraft.Sim.Tests/SliceSmokeTests.cs b/sim/Statecraft.Sim.Tests/SliceSmokeTests.cs
index 98778c534..9abe5d3a7 100644
--- a/sim/Statecraft.Sim.Tests/SliceSmokeTests.cs
+++ b/sim/Statecraft.Sim.Tests/SliceSmokeTests.cs
@@ -37,8 +37,8 @@ public class SliceSmokeTests
static List<Command> Historical(Content c, GameState s, int turn) => GoldenRun.Orders(c, s).ToList();
/// <summary>A player who uses every UI order: the event card's first options, then (in turn) an appointment, a
- /// budget change, a call-up change, a map build and a security-level change, each only when the sim's own check
- /// says it is legal now.</summary>
+ /// budget change and a map build, each only when the sim's own check says it is legal now. The call-up change and
+ /// the security-level change left with the retired controls (R-WAR-002, #750).</summary>
static List<Command> Player(Content c, GameState s, int turn)
{
var cmds = FirstOption(c, s, turn);
@@ -56,19 +56,12 @@ public class SliceSmokeTests
if (s.Budget[from] >= 0.05)
cmds.Add(new AllocateBudget(new Dictionary<string, double>(s.Budget) { [from] = s.Budget[from] - 0.05, [to] = s.Budget[to] + 0.05 }));
}
- if (turn % 10 == 3) cmds.Add(new SetMobilization(Math.Min(1, Math.Round(s.Mobilization + 0.1, 2))));
- if (turn % 10 == 8) cmds.Add(new SetMobilization(SecuritySystem.MinMobilization(c, s.Date, s.Rung)));
if (turn % 2 == 0)
foreach (var action in new[] { MapActions.TransitCamp, MapActions.Housing })
{
var hex = c.Hexes.FirstOrDefault(h => MapActions.Check(c, s, action, h.Q, h.R) == null);
if (hex != null) { cmds.Add(new MapAction(action, hex.Q, hex.R)); break; }
}
- if (turn % 15 == 7 || turn % 15 == 8) // DefencePresenter: one level up, then back down the next turn
- {
- var delta = SecuritySystem.ClampRung(s.Rung + (turn % 15 == 7 ? 1 : -1)) - s.Rung;
- if (delta != 0) cmds.Add(new SecurityOrder(delta));
- }
return cmds;
}
@@ -270,10 +263,14 @@ public class SliceSmokeTests
var clock = Stopwatch.StartNew();
var run = Play(Real, Player, reload: true, PlayerTextTests.LeakGuard(Real));
AssertClean("player", run, Play(Real, Player, reload: false, guard: null));
- // Attention runs out some turns: the UI refuses those extra orders at queue time, which is not a sim refusal.
- Assert.True(run.Orders > run.Turns, $"{run.Orders} orders in {run.Turns} turns");
+ // Attention runs out some turns: the UI refuses those extra orders at queue time, which is not a sim refusal. This
+ // checked "more orders than turns" until the call-up and security orders left the GDD loop (R-WAR-002, #750); it now
+ // asserts the queue refusals themselves.
+ Assert.True(run.QueueRefusals.Count > 0, $"{run.Orders} orders in {run.Turns} turns and none refused by the queue");
// No map_action: the GDD loop refuses it (R-PROJ-004) and the info panel offers no legacy Build button there.
- var uiKinds = new[] { "choose_event_option", "appoint", "allocate_budget", "set_mobilization", "security_order" };
+ // R-WAR-002 (#750): the GDD loop refuses set_mobilization and security_order and the Defence screen hides them there,
+ // so the reference player never queues them.
+ var uiKinds = new[] { "choose_event_option", "appoint", "allocate_budget" };
Assert.Empty(uiKinds.Except(run.Carried)); // every order a UI screen can queue was carried out
Assert.True(clock.Elapsed < TimeSpan.FromMinutes(1), $"took {clock.Elapsed}");
}
diff --git a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
index 0d8d13257..cbe6bd531 100644
--- a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
+++ b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
@@ -21,7 +21,9 @@ public class TreasuryFloorTests
Assert.True(s.Treasury >= 0, $"turn {s.Turn} ({s.Date:yyyy-MM-dd}): Treasury {s.Treasury}");
if (firstDebt == null && s.Debt > 0) firstDebt = s.Turn;
}
- Assert.Equal(4, firstDebt); // 15 September 1948: the HUD's "IL -1.5m" is 0 cash and IL 1.5m debt
+ // 15 October 1948: 0 cash and IL 5.4m debt. It was turn 4 (15 September, IL 1.5m) while HistoricalAI's call-up order
+ // sent the reserves home a turn after the first truce; the GDD loop now lowers the call-up with the rung (R-WAR-002).
+ Assert.Equal(5, firstDebt);
}
// R-MONEY-003: an event's cost is a payment like any other. With IL 0.4m in the Treasury, the IL 1m claim on Germany
diff --git a/sim/Statecraft.Sim.Tests/WarStateTests.cs b/sim/Statecraft.Sim.Tests/WarStateTests.cs
new file mode 100644
index 000000000..f44f1190c
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/WarStateTests.cs
@@ -0,0 +1,155 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Xunit;
+
+namespace Statecraft.Sim.Tests
+{
+ /// <summary>#750's first slice (D-C4; Q-WAR-1, Q-WAR-2, Q-WAR-4): R-WAR-002 retires the call-up and the security order
+ /// in the GDD loop, where the call-up follows the rung instead, and R-WAR-003's clock half retires the 52-week clock
+ /// there; an event's set_rung still moves the rung. The legacy loop keeps all of them while the code exists (D-E1; SecurityTests pins the legacy clock).</summary>
+ public class WarStateTests
+ {
+ static Content Gdd(Dictionary<string, string>? extra = null) => ContentLoader.Load(Fixture.Write(Fixture.Gdd(extra)));
+
+ // R-WAR-002: the refusal reads as the not-available convention (R-CITY-001's wording), before charging, so the
+ // state and the Attention are exactly what a turn without the order leaves.
+ [Fact]
+ public void TheCallUpIsRefusedInTheGddLoop()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ var refused = Simulation.Step(c, s, new Command[] { new SetMobilization(0.5) });
+ var rejection = Assert.Single(refused.Rejected);
+ Assert.Equal("That order is not available in this game", rejection.Reason);
+ var clean = Simulation.Step(c, s, new Command[0]);
+ Assert.Equal(3, refused.State.Attention); // the fixture's attention_per_turn, untouched
+ Assert.Equal(clean.State.Hash(), refused.State.Hash());
+ }
+
+ // R-WAR-002: the security order the ladder's buttons send.
+ [Fact]
+ public void TheSecurityOrderIsRefusedInTheGddLoop()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ var refused = Simulation.Step(c, s, new Command[] { new SecurityOrder(1) });
+ Assert.Equal("That order is not available in this game", Assert.Single(refused.Rejected).Reason);
+ Assert.Equal(5, refused.State.Rung);
+ Assert.Equal(Simulation.Step(c, s, new Command[0]).State.Hash(), refused.State.Hash());
+ }
+
+ // R-WAR-002: HistoricalAI stops generating the retired call-up; below the rung's floor it would send one in the
+ // legacy loop (EconomyM3Tests.HistoricalAiSendsReservesHomeToTheRungMinimum pins that side).
+ [Fact]
+ public void HistoricalAiSendsNoCallUpInTheGddLoop()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ s.Rung = 1;
+ s.Mobilization = 0.5; // above rung 1's 0.02 floor: the legacy loop would send SetMobilization(0.02)
+ Assert.DoesNotContain(HistoricalAI.Commands(c, s), cmd => cmd is SetMobilization);
+ }
+
+ // R-WAR-003 (the slice's clock half): the 52-week countdown never ticks in the GDD loop, so it never ends the
+ // war on its own.
+ [Fact]
+ public void TheCountdownNeverEndsTheWarInTheGddLoop()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ Assert.Equal(5, s.Rung);
+ s.CeasefireWeeksLeft = 1; // a monthly turn is more weeks than that
+ var r = Simulation.Step(c, s, new Command[0]);
+ Assert.Equal(5, r.State.Rung);
+ Assert.Equal(1, r.State.CeasefireWeeksLeft);
+ Assert.DoesNotContain(r.Why, w => w.Target == "ceasefire");
+ }
+
+ // R-WAR-003 (the slice's clock half): the clock never starts in the GDD loop, so no screen can promise a ceasefire
+ // the sim will not impose; the legacy loop starts its 52 weeks on entering full war.
+ [Fact]
+ public void TheGddLoopStartsNoCeasefireClock()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ Assert.Equal(5, s.Rung);
+ Assert.Equal(0, s.CeasefireWeeksLeft);
+ Assert.Equal(0, SecuritySystem.CeasefireWeeksAfter(c, s.Date, 4, 0, 5));
+ var legacy = ContentLoader.Load(Fixture.Write());
+ Assert.Equal(legacy.Rules.CeasefireWeeks, Simulation.NewGame(legacy, 42, Mode.Historical).CeasefireWeeksLeft);
+ Assert.Equal(legacy.Rules.CeasefireWeeks, SecuritySystem.CeasefireWeeksAfter(legacy, s.Date, 4, 0, 5));
+ }
+
+ const string RungEvent = @"
+id: rung
+title: A choice
+text: '{finance_minister} asks for a decision.'
+office: finance_minister
+anchor: hard
+from: 1948-05-15
+options:
+ - id: history
+ text: The way it went
+ historical: true
+ set_rung: 3
+";
+
+ // Q-WAR-4 in the slice: an event's set_rung still moves the rung in the GDD loop.
+ [Fact]
+ public void AnEventSetRungStillMovesTheRungInTheGddLoop()
+ {
+ var c = Gdd(new Dictionary<string, string> { ["events/rung.yaml"] = RungEvent });
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var r = Simulation.Step(c, s, new Command[] { new ChooseEventOption("rung", "history") });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(3, r.State.Rung);
+ }
+
+ // R-WAR-002 (the owner's condition on #1148): with the call-up order retired, the reserves follow the rung down. A
+ // rung an event sets lowers the call-up to that rung's rung_min_mobilization, as HistoricalAI's order did in the
+ // legacy loop, so the 1949 armistices still send the army home (EconomyCalibrationTests keeps the debt anchor).
+ [Fact]
+ public void TheReservesGoHomeWithTheRungInTheGddLoop()
+ {
+ var c = Gdd(new Dictionary<string, string> { ["events/rung.yaml"] = RungEvent });
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ Assert.Equal(0.8, s.Mobilization); // the rung-5 floor at the start
+ var r = Simulation.Step(c, s, new Command[] { new ChooseEventOption("rung", "history") });
+ Assert.Equal(3, r.State.Rung);
+ Assert.Equal(c.Rules.RungMinMobilization[2], r.State.Mobilization);
+ Assert.Contains(r.Why, w => w.Target == "mobilization" && w.Message == "Reserves sent home: call-up lowered to 15%, the minimum for security level 3");
+ }
+
+ // The legacy loop keeps the call-up as a lever: a lower rung leaves it where the player put it.
+ [Fact]
+ public void TheLegacyLoopLeavesTheCallUpWhenTheRungFalls()
+ {
+ var c = ContentLoader.Load(Fixture.Write());
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ var r = Simulation.Step(c, s, new Command[] { new SecurityOrder(-2) });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(3, r.State.Rung);
+ Assert.Equal(0.8, r.State.Mobilization);
+ }
+
+ // D-E1: the legacy loop keeps both orders and the clock while the code exists.
+ [Fact]
+ public void TheLegacyLoopKeepsTheCallUpAndTheClock()
+ {
+ var c = ContentLoader.Load(Fixture.Write());
+ var s = Simulation.NewGame(c, 42, Mode.Historical);
+ var r = Simulation.Step(c, s, new Command[] { new SetMobilization(0.5) }); // 2.0 attention at rung 5
+ Assert.Empty(r.Rejected);
+ Assert.Equal(0.8, r.State.Mobilization); // the rung-5 floor raises the order, as the real game's 80%
+ r = Simulation.Step(c, r.State, new Command[] { new SecurityOrder(-1) });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(4, r.State.Rung);
+ var war = Simulation.NewGame(c, 42, Mode.Historical);
+ war.CeasefireWeeksLeft = 1;
+ var cease = Simulation.Step(c, war, new Command[0]); // the legacy era's turn is longer than a week
+ Assert.NotEqual(5, cease.State.Rung);
+ Assert.Contains(cease.Why, w => w.Target == "ceasefire");
+ }
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
index 2d4810c63..559f55a39 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1950.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
@@ -44,7 +44,7 @@ pop{
sit[
housing_crisis
treasury=0 [0000000000000000]
-debt=87.50032828298674 [4055E00560EB2C48]
+debt=81.75032828298673 [4054700560EB2C47]
fx=94.52989672613671 [4057A1E9D3F540F0]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1952.txt b/sim/Statecraft.Sim.Tests/golden/hash1952.txt
index c37047ce6..2a48139cd 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1952.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1952.txt
@@ -45,7 +45,7 @@ sit[
fx_crisis
housing_crisis
treasury=0 [0000000000000000]
-debt=211.89012071283815 [406A7C7BDE6EE43A]
+debt=206.14012071283815 [4069C47BDE6EE43A]
fx=-12.990431328096559 [C029FB19D0A63796]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
diff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txt
index ddc4f62f4..642ed69a5 100644
--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt
+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt
@@ -2,12 +2,12 @@
# 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 d14a4899a1e068bf238f84f4e8fe06270b5164b2c6ba62f2fef399fd7eaada8e
-hash1952 3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85
-smoke5 7559f30cc7649555cb369b729442d203fa0b42968679f870ac88f0e519a8b755
-smoke-orders 98422be8eca2981e191fde3a7aaf28fdef269203cee2f6dfe7a7cddb770f7133
-scenario-reckless 030817e35956616c848df451c02fbb1b4e981d0971100f49121cb83c01220586
-scenario-cautious e45c542996b94c73242f276acc0f1d6301e3f1cc1a55a919bdc7cc3788894d33
-scenario-mvp-absorb-first 64bdd93b3003158e9504d4d1e4581d214ffd52a992ccf9035d81b56c312eb6ae
-mvp-end 3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85
-scenario-mvp-defeat 54ec7d6bcdf977017f7b0bc0a06c256f40198f2d2338e515e351451f9f46d75d
+hash1950 f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df
+hash1952 ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf
+smoke5 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1
+smoke-orders 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee
+scenario-reckless 57b3c29d54489b7d056f403481455e83eed07913a34ad8b41706b9c3de9ea389
+scenario-cautious d6e7cea014076804f96c9c89a18e019a9160e9b4d47c0efcb51747b02ae4adb1
+scenario-mvp-absorb-first 912504be63675e5f303099b61c977ea9699afd93c79ef77f407c2bafb4005f25
+mvp-end ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf
+scenario-mvp-defeat 109b0a5e592923cd42bf16d5fa7a6f323cc3991e6679fd6dced7b4f753f5fea9
diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
index c37047ce6..2a48139cd 100644
--- a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
+++ b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
@@ -45,7 +45,7 @@ sit[
fx_crisis
housing_crisis
treasury=0 [0000000000000000]
-debt=211.89012071283815 [406A7C7BDE6EE43A]
+debt=206.14012071283815 [4069C47BDE6EE43A]
fx=-12.990431328096559 [C029FB19D0A63796]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
index 4a80029ce..520e82083 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
@@ -43,9 +43,9 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=26.960591926047705 [403AF5E95A3B2D32]
+debt=20.9605919260477 [4034F5E95A3B2D31]
fx=80.85238326859616 [4054368D728D91CC]
-rung=5;cf=40;
+rung=5;cf=0;
mob=0.8 [3FE999999999999A]
stab=0.6255260111471207 [3FE4044F2015932B]
att=4 [4010000000000000]
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
index a085e05dc..9ca2c636b 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
@@ -43,10 +43,10 @@ pop{
veterans=667938.2378207468 [4124624479C3A414]
sit[
treasury=0 [0000000000000000]
-debt=316.4253282829867 [4073C6CE250797DE]
+debt=272.9253282829867 [40710ECE250797DE]
fx=94.52989672613671 [4057A1E9D3F540F0]
rung=2;cf=0;
-mob=0.8 [3FE999999999999A]
+mob=0.05 [3FA999999999999A]
stab=0.5662904231863636 [3FE21F0D17F3F327]
att=4 [4010000000000000]
fired[
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
index 904c027c1..64d5819a8 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
@@ -46,10 +46,10 @@ sit[
fx_crisis
housing_crisis
treasury=0 [0000000000000000]
-debt=339.14012071283804 [4075323DEF37721B]
+debt=281.64012071283815 [40719A3DEF37721D]
fx=-74.99043132809655 [C052BF633A14C6F2]
rung=2;cf=0;
-mob=1 [3FF0000000000000]
+mob=0.05 [3FA999999999999A]
stab=0.4380036636522637 [3FDC084084BA89BB]
att=4 [4010000000000000]
fired[
@@ -150,4 +150,4 @@ units[
next=14
food=0,1390,1390
exhausted=3
-arms=12
\ No newline at end of file
+arms=132
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
index f9c2003e3..fba0a2b6d 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
@@ -43,10 +43,10 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=34.960591926047705 [40417AF4AD1D9699]
+debt=20.9605919260477 [4034F5E95A3B2D31]
fx=80.85238326859616 [4054368D728D91CC]
-rung=5;cf=40;
-mob=1 [3FF0000000000000]
+rung=5;cf=0;
+mob=0.8 [3FE999999999999A]
stab=0.5917932390134901 [3FE2EFF85FF1D1BA]
att=4 [4010000000000000]
fired[
diff --git a/sim/Statecraft.Sim.Tests/scenarios/mvp-defeat.yaml b/sim/Statecraft.Sim.Tests/scenarios/mvp-defeat.yaml
index 2e2380ce2..ec3b3948a 100644
--- a/sim/Statecraft.Sim.Tests/scenarios/mvp-defeat.yaml
+++ b/sim/Statecraft.Sim.Tests/scenarios/mvp-defeat.yaml
@@ -1,16 +1,17 @@
-# A player who overspends and turns down every source of foreign currency (GDD Phase 7 PR 5, D-B5): full mobilisation
-# from the first turn, then the non-historical option of each foreign currency card (no austerity, clothing rationing
-# relaxed, no reparations claim, donations instead of Israel Bonds). The debt passes the ceiling in April 1951, foreign
-# currency runs out in August, food imports stop, and after three turn ends with Money and Food both exhausted the game
-# ends with defeat_economy on 15 January 1952 (R-END-001, R-END-002), the game's last day: a defeat on the last turn is
-# a defeat. A balance change that delays the third empty turn makes this run end as mvp_ended, and DefeatTests says so.
+# A player who overspends and turns down every source of foreign currency (GDD Phase 7 PR 5, D-B5): 120 Arms bought on
+# credit on the first turn (IL 120m; the full call-up this scenario used to order is retired in the GDD loop, R-WAR-002,
+# #750), then the non-historical option of each foreign currency card (no austerity, clothing rationing relaxed, no
+# reparations claim, donations instead of Israel Bonds). The debt passes the ceiling in July 1951, foreign currency
+# runs out in August, food imports stop, and after three turn ends with Money and Food both exhausted the game ends
+# with defeat_economy on 15 January 1952 (R-END-001, R-END-002), the game's last day: a defeat on the last turn is a
+# defeat. A balance change that delays the third empty turn makes this run end as mvp_ended, and DefeatTests says so.
# It plays the real content, so it moves whenever a rule or value it reaches changes.
name: mvp-defeat
until: 1952-01-15
steps:
- on: 1948-05-15
commands:
- - { kind: set_mobilization, level: 1.0 }
+ - { kind: buy_arms, count: 120 }
- on: 1949-05-15
commands:
- { kind: choose_event_option, event: austerity_1949, option: decline }
diff --git a/sim/Statecraft.Sim.Tests/scenarios/reckless.yaml b/sim/Statecraft.Sim.Tests/scenarios/reckless.yaml
index c185fdb73..6a3eac8a6 100644
--- a/sim/Statecraft.Sim.Tests/scenarios/reckless.yaml
+++ b/sim/Statecraft.Sim.Tests/scenarios/reckless.yaml
@@ -1,11 +1,11 @@
-# A reckless player: full rationing from the first turn, refuses the First Truce, and mobilises everyone.
+# A reckless player: full rationing from the first turn and refuses the First Truce. The call-up follows the war rung
+# (R-WAR-002, #750: the GDD loop refuses the set_mobilization order to call up everyone this scenario used to send).
name: reckless
until: 1949-01-01
steps:
- on: 1948-05-15
commands:
- { kind: set_policy, policy: rationing, level: 1.0 }
- - { kind: set_mobilization, level: 1.0 }
- on: 1948-06-01
commands:
- { kind: choose_event_option, event: first_truce, option: refuse }
diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.cs
index 60b7cf875..f340c30e8 100644
--- a/sim/Statecraft.Sim/GoldenRun.cs
+++ b/sim/Statecraft.Sim/GoldenRun.cs
@@ -16,13 +16,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 = "d14a4899a1e068bf238f84f4e8fe06270b5164b2c6ba62f2fef399fd7eaada8e";
+ public const string Hash1950 = "f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df";
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 = "3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85";
+ public const string Hash1952 = "ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf";
public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);
diff --git a/sim/Statecraft.Sim/HistoricalAI.cs b/sim/Statecraft.Sim/HistoricalAI.cs
index 2e92b47d1..bdfae3773 100644
--- a/sim/Statecraft.Sim/HistoricalAI.cs
+++ b/sim/Statecraft.Sim/HistoricalAI.cs
@@ -7,8 +7,9 @@ namespace Statecraft.Sim
/// <summary>Plays what really happened: picks each pending event's historical option (else its first), answers each
/// capture awaiting the choice, in ordinal id order, with Raid, never Deport (R-CTRL-009; Q-REF-1 (a), owner, 18
/// October 2026, #783 batch 3; impact plan section 4.1 item 1), then sends reserves home down to the current security
- /// level's minimum call-up (the army demobilised after the 1949 armistices). It sends no budget allocation, so the
- /// budget stays at rules.yaml budget_start. Like the UI's order queue (SimBridge.Queue), it leaves out an order the
+ /// level's minimum call-up (the army demobilised after the 1949 armistices). In the GDD loop the call-up order is retired
+ /// and the sim itself sends the reserves home with the rung (R-WAR-002), so there it sends none. It sends no budget
+ /// allocation, so the budget stays at rules.yaml budget_start. Like the UI's order queue (SimBridge.Queue), it leaves out an order the
/// turn's remaining attention cannot cover, so Step never has to refuse one of its orders.</summary>
public static class HistoricalAI
{
@@ -25,7 +26,7 @@ namespace Statecraft.Sim
if (SettlementControl.Resolve(c, probe, kv.Key, SettlementControl.Raid, new List<Cause>()) == null)
wanted.Add(new ResolveCapture(kv.Key, SettlementControl.Raid));
var floor = SecuritySystem.MinMobilization(c, s.Date, s.Rung);
- if (s.Mobilization > floor) wanted.Add(new SetMobilization(floor));
+ if (!c.IsGdd && s.Mobilization > floor) wanted.Add(new SetMobilization(floor)); // retired in the GDD loop (R-WAR-002)
var list = new List<Command>();
var left = s.Attention;
foreach (var cmd in wanted)
diff --git a/sim/Statecraft.Sim/SecuritySystem.cs b/sim/Statecraft.Sim/SecuritySystem.cs
index 4552008aa..849eb1d88 100644
--- a/sim/Statecraft.Sim/SecuritySystem.cs
+++ b/sim/Statecraft.Sim/SecuritySystem.cs
@@ -29,9 +29,11 @@ namespace Statecraft.Sim
public static double EffectiveMobilization(Content c, DateTime date, int rung, double level) => Math.Max(level, MinMobilization(c, date, rung));
/// <summary>Weeks left on the UN ceasefire clock after moving from <paramref name="fromRung"/> (with
- /// <paramref name="weeksLeft"/> on the clock) to <paramref name="toRung"/>: entering full war starts it, leaving ends it.</summary>
+ /// <paramref name="weeksLeft"/> on the clock) to <paramref name="toRung"/>: entering full war starts it, leaving ends it.
+ /// The GDD loop retires the clock (R-WAR-003, Q-WAR-2 (b)), so there it never starts.</summary>
public static int CeasefireWeeksAfter(Content c, DateTime date, int fromRung, int weeksLeft, int toRung)
{
+ if (c.IsGdd) return 0;
toRung = ClampRung(toRung);
if (toRung != 5) return 0;
return fromRung != 5 ? c.RulesAt(date).CeasefireWeeks : weeksLeft;
@@ -46,6 +48,7 @@ namespace Statecraft.Sim
if (rung != s.Rung) why.Add(new Cause("security", "rung", rung - s.Rung, FormattableString.Invariant($"Security level {s.Rung} to {rung}")));
s.Rung = rung;
RaiseToFloor(c, s, why);
+ if (c.IsGdd) SendHomeToFloor(c, s, why);
}
/// <summary>Returns null on success, or the reason the order was rejected.</summary>
@@ -69,6 +72,20 @@ namespace Statecraft.Sim
}
}
+ /// <summary>R-WAR-002: the GDD loop retires the call-up order, so the call-up follows the rung down to its minimum,
+ /// as HistoricalAI's order did (the army demobilised after the 1949 armistices). The debt calibration rests on it
+ /// (EconomyCalibrationTests).</summary>
+ static void SendHomeToFloor(Content c, GameState s, List<Cause> why)
+ {
+ var rung = ClampRung(s.Rung);
+ var floor = MinMobilization(c, s.Date, rung);
+ if (s.Mobilization > floor)
+ {
+ why.Add(new Cause("security", "mobilization", floor - s.Mobilization, FormattableString.Invariant($"reserves sent home: call-up lowered to {PlayerText.Percent(floor)}, the minimum for security level {rung}")));
+ s.Mobilization = floor;
+ }
+ }
+
public static void Apply(Content c, GameState s, TurnLength len, List<Cause> why) => Apply(c, s, Weeks(len), why);
/// <summary>True while the country is at full war: rung 5, the ladder's top. The war state the sim already keeps (the
@@ -76,9 +93,12 @@ namespace Statecraft.Sim
public static bool AtFullWar(GameState s) => s.Rung == 5;
/// <summary>Counts the ceasefire clock down by <paramref name="weeks"/> (a whole turn's weeks, or the whole weeks of
- /// an adjusted turn at an era's end) while the country is at full war.</summary>
+ /// an adjusted turn at an era's end) while the country is at full war. The GDD loop retires the 52-week clock
+ /// (R-WAR-003): the call is a no-op there (the clock never starts, so it must not count down and impose a ceasefire
+ /// at once), and only an event's set_rung moves the rung.</summary>
public static void Apply(Content c, GameState s, int weeks, List<Cause> why)
{
+ if (c.IsGdd) return;
if (!AtFullWar(s)) return;
s.CeasefireWeeksLeft = Math.Max(0, s.CeasefireWeeksLeft - weeks);
if (s.CeasefireWeeksLeft == 0)
diff --git a/sim/Statecraft.Sim/Simulation.cs b/sim/Statecraft.Sim/Simulation.cs
index 6067bbcf8..0e54b7857 100644
--- a/sim/Statecraft.Sim/Simulation.cs
+++ b/sim/Statecraft.Sim/Simulation.cs
@@ -106,6 +106,9 @@ namespace Statecraft.Sim
if (!AttentionSystem.IsCommandKind(cmd.Kind)) { rejected.Add(new Rejection(cmd, "That order is not known")); continue; }
// A GDD order has no price in the legacy rules: refuse it before charging (R-CITY-001).
if (AttentionSystem.IsGddKind(cmd.Kind) && !c.IsGdd) { rejected.Add(new Rejection(cmd, "That order is not available in this game")); continue; }
+ // The call-up and the security order are retired in the GDD loop (R-WAR-002): refused the same way,
+ // before charging, so the state and the Attention are unchanged.
+ if (c.IsGdd && (cmd is SetMobilization || cmd is SecurityOrder)) { rejected.Add(new Rejection(cmd, "That order is not available in this game")); continue; }
var before = s.Attention;
var error = AttentionSystem.TrySpend(c, s, cmd.Kind, priceRung) ?? Execute(c, s, cmd, spent, why);
if (error != null) { s.Attention = before; rejected.Add(new Rejection(cmd, error)); }
diff --git a/tools/web_check.py b/tools/web_check.py
index aae880509..620f70602 100644
--- a/tools/web_check.py
+++ b/tools/web_check.py
@@ -8,8 +8,8 @@ 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 hash1950 d14a4899a1e068bf238f84f4e8fe06270b5164b2c6ba62f2fef399fd7eaada8e" --expect "GOLDEN OK hash1952 3bacd2b10340aa95ec130d84aedfb560828dae6b0ed35323f64410f9ac8eee85"
- uv run tools/web_check.py unity/Builds/Web-disabled --query "smoke-orders" --expect "SMOKE ORDERS OK 1948-06-15 98422be8eca2981e191fde3a7aaf28fdef269203cee2f6dfe7a7cddb770f7133"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK hash1950 f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df" --expect "GOLDEN OK hash1952 ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "smoke-orders" --expect "SMOKE ORDERS OK 1948-06-15 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee"
(the smoke-orders golden: one Move given through the unit card, docs/determinism.md)
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),
diff --git a/unity/Assets/Scripts/UI/DefencePresenter.cs b/unity/Assets/Scripts/UI/DefencePresenter.cs
index bee40e7b8..2a443906a 100644
--- a/unity/Assets/Scripts/UI/DefencePresenter.cs
+++ b/unity/Assets/Scripts/UI/DefencePresenter.cs
@@ -163,11 +163,16 @@ namespace Statecraft.Game.UI
PersonCard.Fill(card, "lead-" + Leaders[i], c, s, seat.Holder, titles, seat.Appointed, text, portraits, LeaderPortrait);
}
var ceasefire = screen.Q<Label>("ceasefire");
- if (s.Rung == 5 && target == 5) ceasefire.text = text.Format("defence.ceasefire", s.CeasefireWeeksLeft);
+ if (c.IsGdd) ceasefire.text = ""; // the GDD loop retires the clock (R-WAR-003): no ceasefire to promise
+ else if (s.Rung == 5 && target == 5) ceasefire.text = text.Format("defence.ceasefire", s.CeasefireWeeksLeft);
else if (s.Rung == 5) ceasefire.text = text["defence.ceasefire_stops"]; // a lowering is queued
else if (target == 5) ceasefire.text = text.Format("defence.ceasefire_starts", SecuritySystem.CeasefireWeeksAfter(c, s.Date, s.Rung, s.CeasefireWeeksLeft, target));
else ceasefire.text = "";
ceasefire.style.display = ceasefire.text == "" ? DisplayStyle.None : DisplayStyle.Flex;
+ // The call-up and the security order are retired in the GDD loop (R-WAR-002): hide the four controls
+ // that would queue a refused order.
+ var lever = c.IsGdd ? DisplayStyle.None : DisplayStyle.Flex;
+ escalate.style.display = lever; deEscalate.style.display = lever; mobUp.style.display = lever; mobDown.style.display = lever;
screen.Q<Label>("order-pending").text = delta == 0 ? "" : text.Format("defence.order", s.Rung, target);
var floor = SecuritySystem.MinMobilization(c, s.Date, target);
var proposed = EffectiveAt(ProposedMobilization); // what the call-up will be: the sim raises a lower order to the minimum
diff --git a/unity/Assets/Tests/EditMode/DefenceScreenTests.cs b/unity/Assets/Tests/EditMode/DefenceScreenTests.cs
index e3bf59ec3..0c10c431d 100644
--- a/unity/Assets/Tests/EditMode/DefenceScreenTests.cs
+++ b/unity/Assets/Tests/EditMode/DefenceScreenTests.cs
@@ -21,6 +21,17 @@ public class DefenceScreenTests
return (ui, bridge, new DefencePresenter(ui.Root, bridge, Text));
}
+ /// <summary>The same screen on the legacy loop (the real content without the loop switch): the call-up and the
+ /// security order live there now (R-WAR-002), so their tests play a legacy session.</summary>
+ static (UiTestKit ui, SimBridge bridge, DefencePresenter defence) OpenLegacy()
+ {
+ var ui = new UiTestKit();
+ ui.Q<VisualElement>("screen-defence").style.display = DisplayStyle.Flex;
+ var bridge = new SimBridge(GameSession.New(SimBridgeGddTests.Legacy, GoldenRun.Seed, Mode.Historical), Text);
+ new ToastPresenter(ui.Root, bridge, Text);
+ return (ui, bridge, new DefencePresenter(ui.Root, bridge, Text));
+ }
+
/// <summary>In Hebrew the command line and the leaders' cards show the content's Hebrew names and titles (#558).</summary>
[Test]
public void InHebrewTheLeadersAreNamedInHebrew()
@@ -50,7 +61,7 @@ public class DefenceScreenTests
Assert.IsFalse(ui.Q<VisualElement>("rung-2").ClassListContains("rung-current"));
for (int rung = 1; rung <= 5; rung++) // the GDD game plays monthly turns on every rung (R-TURN-001)
Assert.AreEqual("turns of a month", ui.Q<Label>($"rung-{rung}-turn").text, $"rung {rung}");
- Assert.AreEqual("If full war goes on, the UN imposes a ceasefire in 52 weeks", ui.Q<Label>("ceasefire").text);
+ Assert.AreEqual(DisplayStyle.None, ui.Q<Label>("ceasefire").style.display.value); // no clock in the GDD loop (R-WAR-003)
Assert.AreEqual("Minister of Defense David Ben-Gurion · Chief of Staff Yaakov Dori", ui.Q<Label>("defence-command").text);
Assert.AreEqual("80% of reserves called up (level 5 needs at least 80%)", ui.Q<Label>("mob-level").text);
Assert.AreEqual("Costs IL 48.0m a year in pay and lost work", ui.Q<Label>("mob-cost").text);
@@ -61,7 +72,7 @@ public class DefenceScreenTests
[Test]
public void OrdersAreQueuedAndTheTurnCarriesThemOut()
{
- var (ui, bridge, defence) = Open();
+ var (ui, bridge, defence) = OpenLegacy();
using (ui)
{
ui.Press("de-escalate");
@@ -80,7 +91,7 @@ public class DefenceScreenTests
[Test]
public void PressingBackToTodaysLevelWithdrawsTheOrder()
{
- var (ui, bridge, _) = Open();
+ var (ui, bridge, _) = OpenLegacy();
using (ui)
{
ui.Press("de-escalate");
@@ -93,7 +104,7 @@ public class DefenceScreenTests
[Test]
public void RaisingTheLevelShowsTheCallUpTheSimWillForce()
{
- var (ui, bridge, defence) = Open();
+ var (ui, bridge, defence) = OpenLegacy();
using (ui)
{
ui.Press("de-escalate");
@@ -115,7 +126,7 @@ public class DefenceScreenTests
[Test]
public void AnOrderTheAttentionCannotPayForIsRefusedWithTheReason()
{
- var (ui, bridge, _) = Open();
+ var (ui, bridge, _) = OpenLegacy();
using (ui)
{
Assert.IsNull(bridge.Queue(new SetPolicy(C.Policies[0].Id, 0.5)));
@@ -126,6 +137,30 @@ public class DefenceScreenTests
}
}
+ /// <summary>R-WAR-002 and R-WAR-003 (#750): the GDD loop refuses the call-up and the security order and has no
+ /// ceasefire clock, so the Defence screen hides the four lever controls and the ceasefire line there. The legacy
+ /// loop keeps all of them, with the clock's 52 weeks.</summary>
+ [Test]
+ public void TheGddLoopHidesTheRetiredLevers()
+ {
+ var levers = new[] { "escalate", "de-escalate", "mob-up", "mob-down" };
+ var (ui, _, _) = Open();
+ using (ui)
+ {
+ foreach (var id in levers)
+ Assert.AreEqual(DisplayStyle.None, ui.Q<Button>(id).style.display.value, id);
+ Assert.AreEqual(DisplayStyle.None, ui.Q<Label>("ceasefire").style.display.value);
+ }
+ var (legacy, _, _) = OpenLegacy();
+ using (legacy)
+ {
+ foreach (var id in levers)
+ Assert.AreEqual(DisplayStyle.Flex, legacy.Q<Button>(id).style.display.value, id);
+ Assert.AreEqual(DisplayStyle.Flex, legacy.Q<Label>("ceasefire").style.display.value);
+ Assert.AreEqual("If full war goes on, the UN imposes a ceasefire in 52 weeks", legacy.Q<Label>("ceasefire").text);
+ }
+ }
+
[Test]
public void ADisposedScreenHearsNothing()
{
@@ -144,7 +179,7 @@ public class DefenceScreenTests
[Test]
public void CallUpCanBeRaisedButNotPast100Percent()
{
- var (ui, bridge, defence) = Open();
+ var (ui, bridge, defence) = OpenLegacy();
using (ui)
{
for (int i = 0; i < 6; i++) ui.Press("mob-up");
@@ -158,7 +193,7 @@ public class DefenceScreenTests
[Test]
public void TheCeasefireClockCountsDownEachTurn()
{
- var (ui, bridge, _) = Open();
+ var (ui, bridge, _) = OpenLegacy();
using (ui)
{
bridge.EndTurn(); // a monthly turn counts 4 weeks (SecuritySystem.Weeks) since the GDD cutover
@@ -170,7 +205,7 @@ public class DefenceScreenTests
[Test]
public void AQueuedDropFromFullWarSaysTheClockStops()
{
- var (ui, bridge, _) = Open();
+ var (ui, bridge, _) = OpenLegacy();
using (ui)
{
ui.Press("de-escalate");
@@ -184,7 +219,7 @@ public class DefenceScreenTests
[Test]
public void AQueuedRaiseToFullWarShowsTheClockItWillStart()
{
- var (ui, bridge, _) = Open();
+ var (ui, bridge, _) = OpenLegacy();
using (ui)
{
ui.Press("de-escalate");
diff --git a/unity/Assets/Tests/EditMode/HudTests.cs b/unity/Assets/Tests/EditMode/HudTests.cs
index ae47d82f2..9f86ab2bb 100644
--- a/unity/Assets/Tests/EditMode/HudTests.cs
+++ b/unity/Assets/Tests/EditMode/HudTests.cs
@@ -77,12 +77,13 @@ public class HudTests
/// <summary>T71: the top bar's Treasury is the net position, cash minus debt (HudModel.From; M3 plan: "with deficits
/// borrowed, cash alone is always 0"). The sim keeps cash at 0 or above (R-MONEY-003), so a negative reading is debt,
- /// not a negative Treasury: after four monthly turns with no orders, 0 cash and the debt read as minus the debt.</summary>
+ /// not a negative Treasury: after five monthly turns with no orders, 0 cash and the debt read as minus the debt (four
+ /// before the GDD loop sent the reserves home with the first truce's rung, R-WAR-002, #750).</summary>
[Test]
public void TheTreasuryShowsCashMinusDebtSoBorrowingReadsNegative()
{
var bridge = NewBridge();
- for (var i = 0; i < 4; i++) bridge.EndTurn();
+ for (var i = 0; i < 5; i++) bridge.EndTurn();
Assert.AreEqual(0.0, bridge.State.Treasury); // R-MONEY-003: cash stops at 0
Assert.Greater(bridge.State.Debt, 0.0);
var m = HudModel.From(bridge, Text);
@@ -99,7 +100,7 @@ public class HudTests
{
var text = hebrew ? He : Text;
var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), text);
- for (var i = 0; i < 4; i++) bridge.EndTurn();
+ for (var i = 0; i < 5; i++) bridge.EndTurn();
Assert.Greater(bridge.State.Debt, 0.0, "precondition: something is borrowed");
using var ui = new UiTestKit();
new HudPresenter(ui.Root, bridge, text);
diff --git a/unity/Assets/Tests/EditMode/SaveUiTests.cs b/unity/Assets/Tests/EditMode/SaveUiTests.cs
index 44ad402b0..6b65340bc 100644
--- a/unity/Assets/Tests/EditMode/SaveUiTests.cs
+++ b/unity/Assets/Tests/EditMode/SaveUiTests.cs
@@ -134,7 +134,7 @@ public class SaveUiTests
var text = UiText.Parse(AssetDatabase.LoadAssetAtPath<TextAsset>(UiPaths.Folder + "/" + file).text, file);
var content = C;
var played = GameSession.New(C, 9, Mode.Historical);
- played.Step(new Command[] { new SetMobilization(1.0) });
+ played.Step(new Command[] { new BuyArms(1) }); // a GDD order the sim carries out (the call-up is refused there, R-WAR-002)
var save = played.Save.Write();
string logged;
var expected = Unreadable(text);
@@ -157,8 +157,8 @@ public class SaveUiTests
break;
default:
content = ContentLoader.Load(Paths.Content); // its own copy: removing a price must not touch C
- content.Rules.AttentionCost.Remove("set_mobilization");
- foreach (var r in content.EraRules.Values) r.AttentionCost.Remove("set_mobilization");
+ content.Rules.AttentionCost.Remove("buy_arms");
+ foreach (var r in content.EraRules.Values) r.AttentionCost.Remove("buy_arms");
logged = "turn 1: (.|\\n)*KeyNotFoundException";
break;
}
diff --git a/unity/Assets/Tests/EditMode/WhyScreenTests.cs b/unity/Assets/Tests/EditMode/WhyScreenTests.cs
index 94e7f0438..a704dfc79 100644
--- a/unity/Assets/Tests/EditMode/WhyScreenTests.cs
+++ b/unity/Assets/Tests/EditMode/WhyScreenTests.cs
@@ -16,7 +16,8 @@ public class WhyScreenTests
public void EveryCauseOfTheLastTurnIsListedUnderItsSystem()
{
using var ui = new UiTestKit();
- var bridge = new SimBridge(GameSession.New(C, GoldenRun.Seed, Mode.Historical), Text);
+ // The legacy loop: the call-up order is refused in the GDD loop (R-WAR-002, #750), and this test reads its cause.
+ var bridge = new SimBridge(GameSession.New(SimBridgeGddTests.Legacy, GoldenRun.Seed, Mode.Historical), Text);
new WhyPresenter(ui.Root, bridge, Text);
Assert.AreEqual("Nothing has happened yet: end the turn to see its causes.", ui.Q<Label>("why-empty").text);
bridge.Queue(new SetMobilization(1.0));