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.

Turn trained recruits into military formations (#1130)

Aviel Cohenb8beef733807
diff --git a/changelog.d/1130-home-housing.md b/changelog.d/1130-home-housing.md
new file mode 100644
index 000000000..0809539a9
--- /dev/null
+++ b/changelog.d/1130-home-housing.md
@@ -0,0 +1,5 @@
+### Fixed
+
+- Trained recruit formations keep counting toward their home city's housing after graduation, movement and veteran
+ promotion. The home survives standing orders, attacks, retreats, withdrawals and save replay; a formation that survives combat
+ counts at its remaining strength. Pioneer units still leave city housing (refs #742, #1130; Q-HOUSE-5).
diff --git a/changelog.d/1130-recruit-formations.md b/changelog.d/1130-recruit-formations.md
new file mode 100644
index 000000000..603879f68
--- /dev/null
+++ b/changelog.d/1130-recruit-formations.md
@@ -0,0 +1,5 @@
+- Completed recruit cohorts become one military formation each, conserving their population strength. Israeli military
+ formations pay Money upkeep in step 7, borrowing a shortfall without ongoing Arms consumption; recruits promote after
+ service, preserving their identity and orders. Initial upkeep IL 0.05m per formation per turn, six service turns, and
+ recruit movement 3 are owner-accepted design values; military event grants await a separate strength/side/source schema
+ (19 October 2026; refs #742, #1130).
diff --git a/content/rules.yaml b/content/rules.yaml
index 08e253f11..61b90102e 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -105,6 +105,13 @@ mvp:
arms_start: 12 # DESIGN VALUE: owner-set balance, not a historical figure (D-G6, #781: Arms on 15 May 1948)
arms_price: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-G6, #781: IL millions per Arms)
arms_per_recruit_group: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-G6, Q-UNIT-3: Arms per recruit group trained)
+ # Agent-proposed values accepted by the owner on 19 October 2026 (Q-GEN-1, Q-UNIT-2, Q-UNIT-3):
+ # https://github.com/eyalgolan/statecraft-israel/pull/1130#issuecomment-6269103829
+ # Upkeep is per formation, not strength:
+ # IL 0.05m is one tenth of a single group's IL 0.5m training cost per turn. Six service turns match the veteran pioneer
+ # threshold as an accepted initial design value; neither number asserts a historical cost or period.
+ military_upkeep_per_turn: 0.05 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-UNIT-3: IL millions per formation per turn)
+ veteran_soldier_service: 6 # DESIGN VALUE: owner-set balance, not a historical figure (D-D9, Q-UNIT-2: service turns, excluding training)
# The veteran pioneer (R-VET-001, R-VET-002; D-D9). Agent-proposed design values the owner took on 17 October 2026 (#782:
# "take all of the plan's recommendations"; Phase 4 plan Q-VET-1, Q-VET-2). Service is build_yishuv_turns, so one
# completed yishuv makes a veteran pioneer.
diff --git a/content/unit_types.yaml b/content/unit_types.yaml
index a0b2ae62f..2cbd9d266 100644
--- a/content/unit_types.yaml
+++ b/content/unit_types.yaml
@@ -1,12 +1,15 @@
# The GDD v0.1 population and unit types (GDD "Population and units"; docs/rules/mvp.md R-TRAIN-001 to R-TRAIN-003).
-# D-A2: civilians, refugees and recruits are counts per city; a halutz is a movable unit. Every number below is a design
+# D-A2: civilians and refugees are counts per city; recruits and halutzim are movable units. Every number below is a design
# value: the owner's balance, set or accepted in review (Q-CUT-1, owner, 15 October 2026: "Labelled design values"), not
# a historical figure. DesignValuesTests lists them all (R-LOOP-005).
types:
- { id: civilian, kind: population }
- { id: refugee, kind: population }
- id: recruit # civilian to recruit, through basic training (GDD "Progression")
- kind: population # a count per city until Phase 5
+ kind: unit # one formation per cohort, strength = its population units (Q-UNIT-1)
+ side: israel
+ class: infantry
+ movement_points: 3 # DESIGN VALUE: owner-set balance, not a historical figure (D-G2, Q-MOVE-1; owner accepted #1130, 19 October 2026)
facility: military_camp
training_turns: 3 # DESIGN VALUE: owner-set balance, not a historical figure (D-A3)
training_cost: 0.5 # DESIGN VALUE: owner-set balance, not a historical figure (D-A3: IL millions per group)
@@ -23,7 +26,7 @@ types:
training_cost: 0.5 # DESIGN VALUE: owner-set balance, not a historical figure (D-A3, D-D4: Q-CRAFT-3, IL millions per group)
# Phase 5's military types (R-UNIT-001; Q-UNIT-1, owner, 15 October 2026; #741, owner, 18 October 2026: "all defaults").
# A side, a class and movement points (Phase 5 PR 5, R-MOVE-001); strength comes from the unit's sourced row or its cohort
-# (Q-UNIT-4) and upkeep with Phase 5 PR 3. The recruit stays a count per city until PR 3; the enemy types come in PR 4.
+# (Q-UNIT-4). All Israeli military formations pay rules.yaml mvp.military_upkeep_per_turn; enemy types come in PR 4.
# Movement points were proposed in PR #1073 (#744; Q-MOVE-1, owner, 15 October 2026: "Take all recommendations") and
# accepted by the owner as design values on 19 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1073#issuecomment-6259021508). At about 8.7 km between hex centres, 3 plain hexes is about 26 km a monthly turn, an operational pace; the
# armoured car carries more (Q-ARTY-2) and the guns fewer.
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index e4771c4bc..15d5660f7 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 f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df"
- # and "GOLDEN OK hash1952 ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf"
+ # one GOLDEN OK line per manifest golden (#394), e.g. "GOLDEN OK hash1950 f3ec68b734a3beb24df9a873e0400f0253aed48f3cde2ea12415f1890dcaa5b0"
+ # and "GOLDEN OK hash1952 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b"
uv run tools/web_check.py unity/Builds/Web-gzip --query "golden&smoke=5" "${golden_expect[@]}" \
- --expect "SMOKE OK 5 turns 1948-10-15 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
+ --expect "SMOKE OK 5 turns 1948-10-15 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85"
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 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
+ --expect "SMOKE OK 5 turns 1948-10-15 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85"
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 7b362b44c..5b6a9b18c 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 | `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` |
+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `f3ec68b734a3beb24df9a873e0400f0253aed48f3cde2ea12415f1890dcaa5b0` |
+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b` |
+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b` |
`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 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1`.
+ministers): `SMOKE OK 5 turns 1948-10-15 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85`.
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 71a4cef0f81439c475e5e8a4e36bea9296f14287bc894cbc90efc4d2714348d1"
+ --expect "SMOKE OK 5 turns 1948-10-15 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85"
```
`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 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee`.
+Turn: `SMOKE ORDERS OK 1948-06-15 ee6bfee561120532416c1aff2cd7cd741256aaafb443d19b414031356b680ae6`.
`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 4c9916304b71a66c989494a80b0e9b70db98a26f4697e29066425b77539743ee"
+ --expect "SMOKE ORDERS OK 1948-06-15 ee6bfee561120532416c1aff2cd7cd741256aaafb443d19b414031356b680ae6"
```
**When a golden moves.** The test fails with the lines that changed, grouped by section (`[ind]`, `[pol]`, `[bud]`,
@@ -395,3 +395,12 @@ The hash reads the state keys, so it never sees a record outside its window. An
| 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`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | 1950 | `f3ec68b7` | owner-accepted military upkeep (R-UNIT-010; IL 0.05m per Israeli formation per turn, owner 19 October 2026 on #1130) charges the starting forces and the 7th Brigade once it arrives; the reference player trains no recruits, so only debt moves, by IL 8.2m over 20 turns (164 formation-turns); every other snapshot field is unchanged (was `f70d7cc2`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | 1952 | `6b374f69` | same; debt alone rises by IL 17.8m over 44 turns (356 formation-turns) (was `ca78893d`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | mvp-end | `6b374f69` | same as 1952 (was `ca78893d`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | smoke5 | `d449bf19` | same upkeep over the five smoke turns; no snapshot is kept for this run (was `71a4cef0`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | smoke-orders | `ee6bfee5` | the same upkeep over its one turn; no snapshot is kept for this run (was `4c991630`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-reckless | `6650ed3e` | same; debt alone rises by IL 3.4m (was `57b3c29d`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-cautious | `95982cf8` | same as reckless (was `d6e7cea0`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-mvp-absorb-first | `d6d47fd8` | same; debt alone rises by IL 8.2m (was `912504be`) |
+| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-mvp-defeat | `584a828a` | same; debt alone rises by IL 17.8m; the defeat is unchanged (was `109b0a5e`) |
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 081ee8668..5abab994c 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -106,7 +106,7 @@ R-TRAIN-001: `Train(city, track, n)` takes `n` of the city's civilians without a
R-TRAIN-002: `CancelTraining(cohort)` returns the cohort's people to its city as civilians without a job and refunds none of the Money paid (D-A3); a recruit cohort's Arms go back to the pool (R-ARMS-003). A cohort that does not exist, or has finished, is refused with the state unchanged.
-R-TRAIN-003: Each turn, in ascending id, every cohort has one turn less to go. A cohort that reaches 0 ends: recruits are added to the city's count of recruits (a count until Phase 5), craftsmen to its count of craftsmen (R-CRAFT-001), and halutzim become one movable unit per group at the city's settlement hex, taking the next ids in turn. A city's recruits and the cohorts are written into the state hash only when there are some.
+R-TRAIN-003: Each turn, in ascending id, every cohort has one turn less to go. A cohort that reaches 0 ends: a recruit cohort becomes one military unit with its count as strength (R-UNIT-003), craftsmen join the city's count (R-CRAFT-001), and halutzim become one movable unit per group. Units appear at the city's settlement hex, taking the next ids in turn. New recruit completions never fill `City.Recruits`; its old canonical field is retained, and saves still replay their command log. Cohorts are written into the state hash only when there are some.
## Craftsmen
@@ -150,11 +150,15 @@ R-CAMP-002: A camp site's `city` is the MVP city (`cities.yaml`) nearest to the
## Military units
-Phase 5 PR 2 (#741) adds the record and the types only; nothing moves, fights or trains into them yet (owner, 18 October 2026, #741: movement points in Phase 5 PR 5, upkeep in PR 3, enemy types in PR 4). Phase 5 PR 4 (#743) adds the Arab forces' types and the sourced starting forces (R-UNIT-006).
+Phase 5 PR 2 (#741) introduced the military record and types. PR 3 (#742, #1130) adds recruit formations, service and Money upkeep. Phase 5 PR 4 (#743) adds the Arab forces' types and the sourced starting forces (R-UNIT-006).
-R-UNIT-001: A military unit is a group at formation scale, one token per formation (D-A1; Q-UNIT-1). It has a side, a type, a hex, a strength (an integer, in population units) and a standing order with its target. A military type in `unit_types.yaml` is a `unit` with a `side` (one of `units_1948.yaml`'s sides) and a `class` (infantry, artillery or armour); the loader refuses a type with only one of them, an unknown side or class, or a population type with either, naming the file and field. The MVP's military types are Israel's `veteran_soldier`, `artillery` and `armoured_car`; `recruit` stays a count per city (R-TRAIN-003).
+R-UNIT-001: A military unit is a group at formation scale, one token per formation (D-A1; Q-UNIT-1). It has a side, a type, a hex, a strength (an integer, in population units) and a standing order with its target. A military type in `unit_types.yaml` is a `unit` with a `side` (one of `units_1948.yaml`'s sides) and a `class` (infantry, artillery or armour); the loader refuses a type with only one of them, an unknown side or class, or a population type with either, naming the file and field. The MVP's military types are Israel's `recruit`, `veteran_soldier`, `artillery` and `armoured_car`.
-R-UNIT-002: A unit's side, strength, order and order target are written into the state hash only when they are not at their default ("" or 0), after its service (R-LOOP-002's rule), so a halutz unit's hash text, and every golden, is unchanged.
+R-UNIT-002: A unit's side, strength, order and order target are written into the state hash only when they are not at their default ("" or 0), after its service (R-LOOP-002's rule). Its housing home city is also written when nonempty (`|home=<city>`); an empty home adds nothing, preserving earlier units' canonical text. A halutz unit's canonical text remains unchanged when its home is empty.
+
+R-UNIT-003: A finished recruit cohort becomes exactly one Israeli infantry formation at its city's settlement hex, with `Strength` equal to the cohort's `Count` in population units, service 0 and the next id (Q-UNIT-1, Q-UNIT-4; owner, 15 October 2026). The cohort leaves the state: nobody is lost or duplicated. Its reserved Arms are neither charged again nor refunded on completion (R-ARMS-003).
+
+R-UNIT-004: Each Israeli recruit formation already in play before step 4 gains one service turn; a cohort graduating in step 4 starts serving on the next turn. At `veteran_soldier_service` it becomes `veteran_soldier`, keeping id, hex, service, side, strength and standing order, with a Why cause. Veterans stop accumulating service. Combat gives no extra service, and Phase 5 adds no return to civilian life (Q-UNIT-2, Q-UNIT-6; owner, 15 October 2026). The owner-accepted initial threshold is 6 turns, a labelled design value under Q-GEN-1, not a historical period (19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1130#issuecomment-6269103829). The loader requires it to be at least 1 and requires the Israeli veteran infantry type when recruits exist.
R-UNIT-006: A new Historical game places one military unit per row of `map/units_1948.yaml` that is not `hidden`, has `service: army` (the squadron and the ships stay presentation-only tokens, Q-UNIT-5), has a `strength` whose `as_of` is the start day, and has an anchor window [from, to) covering the start. The unit stands on the hex that holds the first such anchor's coordinates, by the map's projection and cube rounding (`tools/hexgrid.py`, Unity's `HexPicker`), precomputed by `tools/unit_anchor_hexes.py` into `map/unit_anchor_hexes.yaml`, which the sim reads (no projection maths in the sim, docs/determinism.md); the token may stand one hex away (`UnitPlacer`), which is presentation. Every IDF brigade is a `veteran_soldier`; an Arab force takes its side's one military type, a labelled design value of class infantry with 3 movement points. Its strength is the row's people in population units, the nearest unit with a half up and never below 1 (`people_per_unit` 1,000: Golani's 4,095 is 4, Kiryati's 2,504 is 3). The units take ids 0 upward in the file's order, before any other unit (owner, 20 October 2026, #743: "all five defaults"). The file is in the content hash (Q-START-1), and so is the hex file. The loader refuses a starting row whose anchor is off the map or not on land or has no row in the hex file, a hex row for an anchor the unit file does not have, or whose side has no single military type, naming the file and the row. A shareable build refuses while any row a unit starts from is not `fact-checked` (Q-START-3): `Statecraft.Cli --release-gate`, `Build -shareable` and `tools/package_release.py` name them.
@@ -162,6 +166,8 @@ R-UNIT-007: Open mode starts no forces (Q-START-2, owner, 15 October 2026); `Sim
R-UNIT-009: A row of `map/units_1948.yaml` that meets R-UNIT-006 except that its `strength`'s `as_of` is after the start day arrives on that day (#1241, owner, 21 October 2026, answer 1(a): "enters the game on that date with its sourced strength, read from its row as a dated arrival"): in the GDD loop's resolution (step 9, after the immigrants' arrivals) of the turn that starts before that day and ends on or after it, once, on the hex of the anchor whose window covers that day, with that strength in population units and its side's type, as a starting force. Such rows follow the starting rows in `Content.StartingForces`, and their unit ids are reserved when the game starts, so unit i is still row i and the release gate names them too. An arrival ignores the stack limit and the hex's other units, as a starting force does. A row whose `as_of` is before the start starts nothing; the loader refuses an `as_of` that is not a `YYYY-MM-DD` date, naming the file and the row. Today the 7th Brigade arrives: 1,650 on 24 May 1948 at Hulda, 2 units from the 15 June 1948 turn.
+R-UNIT-010: In step 7, after production, Food consumption/imports and civilian upkeep, and before housing, each Israeli military formation pays `military_upkeep_per_turn` Money, including a formation that graduated this turn. The owner-accepted initial rate is IL 0.05m per formation per turn, independent of strength and turn length, a labelled design value under Q-GEN-1 (19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1130#issuecomment-6269103829). Civilian, enemy and default records without a military side pay none. R-MONEY-003 borrows a shortfall; no strength is removed or Arms consumed for upkeep (Q-UNIT-3; owner, 15 October 2026). The loader requires a finite rate >= 0. R-ARMS-003 remains the training/refund rule; the Phase 5 plan's suggested reuse of that id is obsolete.
+
## Corridors
Corridor work is step 5 too, after the sites (Phase 4 PR 2, #786; owner, 17 October 2026, #782: the plan's Q-COR-1 to Q-COR-7 and Q-RAIL-1). `content/corridors.yaml` holds each corridor's kind (`road` or `rail`), names, map route and segments; a segment's hexes are derived from the route's traced line by `tools/corridor_hexes.py`. The Money and turns per segment are labelled design values in `rules.yaml` `mvp:` (Q-COR-6). On screen a segment is its corridor's name and its number ("Burma Road, segment 2"), never a waypoint's name (Q-SENS-1). The MVP's corridors are the Burma Road (four segments), the 1949 Haifa–Tel Aviv rail link (one) and the Tel Aviv–Netanya road (four, on straight draft lines between its five sourced places; owner, 18 October 2026, #786, Q-COR-3 (b)). A segment point in a hex the grid counts as sea (the coast) counts in its nearest land neighbour, as a shore town does.
@@ -176,7 +182,7 @@ R-COR-003: A corridor is complete when every one of its segments is built, in an
Phase 5 PR 5 (#744). The numbers are design values this PR proposed (Q-MOVE-1, Q-MOVE-3; owner, 15 October 2026, #375: "Take all recommendations") and the owner accepted them on 19 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1073#issuecomment-6259021508).
-R-MOVE-001: Each unit type that moves has an integer `movement_points` a turn (`unit_types.yaml`; required, at least 1, on a military type; refused on a population type), and each land biome of `map/hexes.json` an integer cost to enter (`rules.yaml` `mvp.move_cost`, at least 1; the loader refuses a land biome with no cost and a cost for a water biome, so lake and sea are impassable). A path's cost is the sum of the costs of the hexes it enters. A unit's Moves in one turn share its points: a second Move has what the first left, and the next turn has them all again. A type with no movement points (the halutz types) cannot move. Real values: veteran soldier 3, artillery 2, armoured car 5; coastal plain, valley and lowland 1, hills and desert 2, mountains 3.
+R-MOVE-001: Each unit type that moves has an integer `movement_points` a turn (`unit_types.yaml`; required, at least 1, on a military type; refused on a population type), and each land biome of `map/hexes.json` an integer cost to enter (`rules.yaml` `mvp.move_cost`, at least 1; the loader refuses a land biome with no cost and a cost for a water biome, so lake and sea are impassable). A path's cost is the sum of the costs of the hexes it enters. A unit's Moves in one turn share its points: a second Move has what the first left, and the next turn has them all again. A type with no movement points (the halutz types) cannot move. Real values: recruit 3 (owner, 19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1130#issuecomment-6269103829), veteran soldier 3, artillery 2, armoured car 5; coastal plain, valley and lowland 1, hills and desert 2, mountains 3.
R-MOVE-002: `Move(unit, q, r)` takes the cheapest path, at command time (spec §2.3). Hexes leave the search in (cost, q, r) ordinal order, neighbours are tried in `tools/hexgrid.py`'s `NEIGHBOURS` order, and a hex reached again at the same cost keeps the hex it was first entered from, so of two equal paths the one through the hex first in that order wins, and the path is the same every run. `Movement.Reachable(c, s, unit)` lists the hexes a Move can end on this turn with their costs, and `Movement.Path` the hexes a path enters; both come from the same search Move uses (spec §2.6).
@@ -360,7 +366,7 @@ R-EFX-007: An option of an event tagged `displacement` cannot raise Money (`trea
D-H2 in the GDD loop (GDD Phase 7 PR 2, #806). The owner took the plan's recommendations for Q-HFX-1 to Q-HFX-3 on 17 October 2026 (#784): grants of units, a city's housing capacity, condition and job slots, and project unlock, each validated at load; a grant is free and stands at the military camp or at the site the event names (in this slice, a city the event names: a site waits until sites carry a date, R-EFX-006); the no-reward rule covers them. The first slice built unit grants and the housing capacity and job slots; the second adds the housing condition (#855); the third adds project unlock (R-EFX-008). The owner ruled on 19 October 2026 (#1095) that no current `projects.yaml` kind gets an additional lock, so none is locked.
-R-EFX-003: An option's `grant_units` entry `{ type, n, at }` adds `n` (at least 1) units of a `unit_types.yaml` type of kind `unit`, free, taking the next ids in turn. They stand at the settlement hex of the city `at` names or, with no `at`, at the settlement hex of the one city whose `facilities` include `military_camp` (Q-HFX-2). With no such single city, `at` is required. A site is not yet a target (R-EFX-006).
+R-EFX-003: An option's `grant_units` entry `{ type, n, at }` adds `n` (at least 1) units of a `unit_types.yaml` type of kind `unit`, free, taking the next ids in turn. Military types are refused: this schema does not specify military strength or a sourced formation, and must not create a default-side, zero-strength soldier. Recruits enter through training (R-UNIT-003); a military event grant needs a separate schema decision (owner, 19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1130#issuecomment-6269103829). Granted units stand at the settlement hex of the city `at` names or, with no `at`, at the settlement hex of the one city whose `facilities` include `military_camp` (Q-HFX-2). With no such single city, `at` is required. A site is not yet a target (R-EFX-006).
R-EFX-004: An option's `city_effects` entry `{ city, field, delta }` changes only that city's `housing_capacity` or `job_slots`, by a whole, non-zero `delta`, or its housing `condition` by a non-zero `delta` from -1 to 1. Housing capacity never drops below 0, and job slots never drop below the city's employed, so a larger cut applies only to what is free. Capacity may fall below the city's civilians, as overcrowding already can. The condition stays from 0 to 1 (R-HOUSE-001). The other fields of the city, its condition included, do not change. The cause carries the change that applied.
diff --git a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs b/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
index dcbd8d1d6..42867f381 100644
--- a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
+++ b/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
@@ -18,7 +18,7 @@ public class CitiesContentTests
var c = Load();
var city = Assert.Single(c.Cities);
Assert.Equal(("town_a", 12, 8, 10, 6), (city.Id, city.HousingCapacity, city.JobSlots, city.Civilians, city.Employed));
- Assert.Equal(new[] { "civilian", "refugee", "recruit", "halutz", "craftsman" }, c.UnitTypes.Select(t => t.Id));
+ Assert.Equal(new[] { "civilian", "refugee", "recruit", "halutz", "craftsman", "veteran_soldier" }, c.UnitTypes.Select(t => t.Id));
var halutz = c.UnitTypes.Single(t => t.Id == "halutz");
Assert.Equal(("unit", "hakhshara", 3, 0.25), (halutz.Kind, halutz.Facility, halutz.TrainingTurns, halutz.TrainingCost));
Assert.Equal("", c.UnitTypes.Single(t => t.Id == "civilian").Facility);
diff --git a/sim/Statecraft.Sim.Tests/CombatTests.cs b/sim/Statecraft.Sim.Tests/CombatTests.cs
index 91fb8354b..8d981072e 100644
--- a/sim/Statecraft.Sim.Tests/CombatTests.cs
+++ b/sim/Statecraft.Sim.Tests/CombatTests.cs
@@ -35,7 +35,7 @@ public class CombatTests
static Unit Soldier(int id, int q, int r, int strength) => new Unit(id, "soldier", q, r, side: "israel", strength: strength);
static Unit Enemy(int id, int q, int r, int strength) => new Unit(id, "enemy", q, r, side: "egypt", strength: strength);
static Unit Attacking(Unit u, int q, int r) =>
- new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, Combat.Attack, FormattableString.Invariant($"{q},{r}"));
+ new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, Combat.Attack, FormattableString.Invariant($"{q},{r}"), u.HomeCity);
static StepResult Step(Content c, GameState s, params Command[] cmds) => Simulation.Step(c, s, cmds);
@@ -46,6 +46,106 @@ public class CombatTests
return why;
}
+ // R-HOUSE-003, R-COMBAT-001: issuing an attack preserves the existing formation's housing home.
+ [Fact]
+ public void GivingAnAttackRetainsTheFormationsHomeAndHousing()
+ {
+ var c = Load();
+ var s = With(c, new Unit(1, "soldier", 3, 0, side: "israel", strength: 5, homeCity: "town_a"), Enemy(2, 2, 0, 5));
+ Assert.Equal("town_a", s.Units[1].HomeCity);
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+
+ Assert.Null(Combat.Give(c, s, 1, 2, 0, new List<Cause>()));
+
+ var u = s.Units[1];
+ Assert.Equal((1, "israel", 5, "town_a", Combat.Attack, "2,0"), (u.Id, u.Side, u.Strength, u.HomeCity, u.Order, u.OrderTarget));
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+ }
+
+ // R-HOUSE-003, R-COMBAT-001: ending an attack does not release a surviving formation's housing.
+ [Fact]
+ public void EndingAnAttackRetainsTheFormationsHomeAndHousing()
+ {
+ var c = Load();
+ var s = With(c, Attacking(new Unit(1, "soldier", 3, 0, side: "israel", strength: 5, homeCity: "town_a"), 2, 0));
+ Assert.Equal("town_a", s.Units[1].HomeCity); // The fixture must not lose the home before the Act step.
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+
+ Resolve(c, s); // There is no defender, so the standing attack ends without combat.
+
+ var u = s.Units[1];
+ Assert.Equal((1, "israel", 5, "town_a", "", ""), (u.Id, u.Side, u.Strength, u.HomeCity, u.Order, u.OrderTarget));
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+ }
+
+ // R-HOUSE-003, R-COMBAT-003: isolate the retreat copy from the separate surviving-loss copy.
+ [Fact]
+ public void RetreatingRetainsTheFormationsHomeAndHousing()
+ {
+ var c = Load();
+ c.Rules.Mvp!.CombatTable[1].DefenderLoss = new List<int> { 0, 0 }; // Fixture: retreat without losses.
+ var s = With(c, Attacking(Enemy(1, 3, 0, 10), 2, 0), new Unit(2, "soldier", 2, 0, side: "israel", strength: 5, homeCity: "town_a"));
+ Assert.Equal("town_a", s.Units[2].HomeCity);
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+
+ Resolve(c, s);
+
+ var u = s.Units[2];
+ Assert.Equal((2, "israel", 5, "town_a", 1, 0), (u.Id, u.Side, u.Strength, u.HomeCity, u.Q, u.R));
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+ }
+
+ // R-HOUSE-003, R-COMBAT-003: casualties release only their strength, not the survivor's entire home allocation.
+ [Fact]
+ public void SurvivingLossReleasesOnlyLostStrengthFromHomeHousing()
+ {
+ var c = Load();
+ var s = With(c, Attacking(Enemy(1, 3, 0, 5), 2, 0), new Unit(2, "soldier", 2, 0, side: "israel", strength: 5, homeCity: "town_a"));
+ Assert.Equal("town_a", s.Units[2].HomeCity);
+ Assert.Equal(15, Cities.Housed(s, s.Cities["town_a"]));
+
+ Resolve(c, s); // The fixture's lower row loses one per side and does not retreat.
+
+ var u = s.Units[2];
+ Assert.Equal((2, "israel", 4, "town_a", 2, 0), (u.Id, u.Side, u.Strength, u.HomeCity, u.Q, u.R));
+ Assert.Equal(14, Cities.Housed(s, s.Cities["town_a"]));
+ }
+
+ // R-HOUSE-003: a trained formation's home survives a real attack command and command-log replay.
+ [Fact]
+ public void AHomeFormationRetainsHousingThroughAttackCommandReplay()
+ {
+ var c = ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string>
+ {
+ ["unit_types.yaml"] = Types,
+ ["map/hexes.json"] = MovementTests.Board(),
+ ["corridors.yaml"] = "corridors: []\n",
+ ["map/units_1948.yaml"] = "units:\n - id: opponent\n service: army\n side: egypt\n status: draft\n strength: { value: 50, as_of: '1948-05-15' }\n anchors:\n - { place: Fixture, from: '1948-05-15', to: '1949-01-01' }\n",
+ ["map/unit_anchor_hexes.yaml"] = "anchors:\n - { id: opponent, anchor: 0, q: 2, r: 0 }\n",
+ })));
+ var g = GameSession.New(c, 1, Mode.Historical);
+ Assert.Empty(g.Step(new Command[] { new Train("town_a", "recruit", 2) }).Rejected);
+ g.Step(new Command[0]);
+ var recruit = Assert.Single(g.State.Units.Values, u => u.Type == "recruit");
+ Assert.Equal(("town_a", 2), (recruit.HomeCity, recruit.Strength));
+ Assert.Empty(g.State.Cohorts);
+ var city = g.State.Cities["town_a"];
+ Assert.Equal(city.Civilians + city.Craftsmen + city.Recruits + 2, Cities.Housed(g.State, city));
+
+ var result = g.Step(new Command[] { new UnitOrder(recruit.Id, Combat.Attack, 2, 0) });
+
+ Assert.Empty(result.Rejected);
+ var survivor = g.State.Units[recruit.Id];
+ Assert.Equal((recruit.Id, "israel", 1, "town_a"), (survivor.Id, survivor.Side, survivor.Strength, survivor.HomeCity));
+ var loaded = GameSession.Load(c, g.Save.Write(), out var warning);
+ Assert.Empty(warning);
+ Assert.Equal(g.State.Hash(), loaded.State.Hash());
+ Assert.Equal(g.State.Describe(), loaded.State.Describe());
+ Assert.Equal(survivor.Canonical(), loaded.State.Units[recruit.Id].Canonical());
+ city = loaded.State.Cities["town_a"];
+ Assert.Equal(city.Civilians + city.Craftsmen + city.Recruits + 1, Cities.Housed(loaded.State, city));
+ }
+
// R-COMBAT-001: an attack names an adjacent hex that holds an enemy unit, and the player's unit must have the Arms for
// it. Every refusal leaves the state as it was.
[Theory]
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index 5b36862c1..37b77d1ea 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -53,6 +53,8 @@ public class DesignValuesTests
("rules.yaml", "mvp.cover_months"),
("rules.yaml", "mvp.veteran_halutz_service"),
("rules.yaml", "mvp.veteran_progress"),
+ ("rules.yaml", "mvp.military_upkeep_per_turn"),
+ ("rules.yaml", "mvp.veteran_soldier_service"),
("rules.yaml", "mvp.housing_start_condition"),
("rules.yaml", "mvp.overflow_condition_loss"),
("rules.yaml", "mvp.defeat_turns"),
@@ -155,6 +157,7 @@ public class DesignValuesTests
("rules.yaml", "mvp.combat_terrain_percent.mountains"),
("rules.yaml", "mvp.road_move_cost"), // R-MOVE-007, #745 (Q-MOVE-2): agent-proposed
("rules.yaml", "mvp.rail_move_cost"),
+ ("unit_types.yaml", "types[recruit].movement_points"),
("unit_types.yaml", "types[veteran_soldier].movement_points"),
("unit_types.yaml", "types[artillery].movement_points"),
("unit_types.yaml", "types[armoured_car].movement_points"),
@@ -282,6 +285,7 @@ public class DesignValuesTests
Assert.Equal((0.35, 0.15), (m.HousingStartCondition, m.OverflowConditionLoss)); // Q-START-3, Q-HOUSE-1 (D-D1)
Assert.Equal((5, 0.5), (m.DelegationLoyaltyFloor, m.DisloyalEffectShare)); // R-EVT-003, #107 (D-H1)
Assert.Equal((12, 1.0, 1, 1.0), (m.ArmsStart, m.ArmsPrice, m.ArmsPerRecruitGroup, c.Rules.AttentionCost["buy_arms"])); // #781 (D-G6)
+ Assert.Equal((0.05, 6), (m.MilitaryUpkeepPerTurn, m.VeteranSoldierService)); // Q-GEN-1: owner-accepted initial design values (19 October 2026), not history.
Assert.Equal((1, 5, 6), (m.ArmsPerAttack, m.CombatTable.Count, m.CombatTable[0].AttackerLoss.Count)); // #747 (D-G6, D-G3), accepted by the owner 20 Oct 2026
Assert.Equal((1, 0.01, 10, 0.005), (m.FoodPerPrisonerUnit, m.PrisonerShortfallCohesion, m.PointsPerPrisonerUnitReturned, m.HeldSoldierCostPerTurn)); // #751 (Q-POW-2, Q-POW-4, Q-POW-5), accepted by the owner (owner, 21 October 2026, #751)
Assert.Equal(12, c.Cities.Count);
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index b7fd70388..bdae1066b 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -278,6 +278,8 @@ mvp:
arms_start: 20
arms_price: 0.25
arms_per_recruit_group: 2
+ military_upkeep_per_turn: 0.1
+ veteran_soldier_service: 3
veteran_halutz_service: 4
veteran_progress: 2
housing_start_condition: 0.5
@@ -316,9 +318,10 @@ mvp:
types:
- { id: civilian, kind: population }
- { id: refugee, kind: population }
- - { id: recruit, kind: population, facility: military_camp, training_turns: 2, training_cost: 0.5 }
+ - { id: recruit, kind: unit, side: israel, class: infantry, facility: military_camp, training_turns: 2, training_cost: 0.5, movement_points: 3 }
- { id: halutz, kind: unit, facility: hakhshara, training_turns: 3, training_cost: 0.25 }
- { id: craftsman, kind: population, facility: industry, training_turns: 3, training_cost: 0.75 }
+ - { id: veteran_soldier, kind: unit, side: israel, class: infantry, movement_points: 3 }
";
/// <summary>The three city project kinds (R-PROJ-001). Fixture values, not the game's.</summary>
diff --git a/sim/Statecraft.Sim.Tests/MilitaryTrainingTests.cs b/sim/Statecraft.Sim.Tests/MilitaryTrainingTests.cs
new file mode 100644
index 000000000..e2f28b4c0
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/MilitaryTrainingTests.cs
@@ -0,0 +1,251 @@
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>Phase 5 PR 3: a recruit cohort becomes one military formation, conserving its population strength.</summary>
+public class MilitaryTrainingTests
+{
+ static readonly Content Mvp = ContentLoader.Load(RealContentTests.ContentRoot());
+
+ /// <summary>The units after the starting forces: their ids, arrivals' included, are reserved at the start (R-UNIT-009),
+ /// so this counts what training and the test added whether or not a dated brigade has arrived yet.</summary>
+ static int After(GameState s) => s.Units.Keys.Count(id => id >= Mvp.StartingForces.Count);
+
+ // R-TRAIN-003, R-UNIT-003 (Q-UNIT-1): one cohort, one unit; strength is population units, not a figure count.
+ [Theory]
+ [InlineData(1)]
+ [InlineData(3)]
+ [InlineData(7)]
+ public void AFinishedRecruitCohortBecomesUnits(int count)
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var cohortId = s.NextId++;
+ s.Cohorts.Add(cohortId, new Cohort(cohortId, "recruit", "tel_aviv", count, 1, count));
+ var next = s.NextId;
+ var arms = s.Arms;
+ Training.Progress(Mvp, s, new List<Cause>());
+
+ Assert.Equal(1, After(s));
+ var unit = s.Units[next];
+ var home = Mvp.SettlementHexes.Single(h => h.Id == "tel_aviv");
+ Assert.Equal((next, "recruit", "israel", count, home.Q, home.R, 0),
+ (unit.Id, unit.Type, unit.Side, unit.Strength, unit.Q, unit.R, unit.Service));
+ Assert.Equal("tel_aviv", unit.HomeCity);
+ Assert.Equal(next + 1, s.NextId);
+ Assert.Empty(s.Cohorts);
+ Assert.Equal(0, s.Cities["tel_aviv"].Recruits);
+ Assert.Equal(arms, s.Arms); // Completing neither charges again nor returns the Arms reserved at the start.
+ }
+
+ // R-HOUSE-003, R-TRAIN-003: Q-HOUSE-5 still counts recruits after they leave their training cohort.
+ [Fact]
+ public void AGraduatedRecruitCohortRemainsHousedInItsCity()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var city = s.Cities["tel_aviv"].WithCounts(0, 0, 0).WithRecruits(0).WithCraftsmen(0);
+ s.Cities[city.Id] = city;
+ var id = s.NextId++;
+ s.Cohorts.Add(id, new Cohort(id, "recruit", city.Id, 3, 1, 3));
+ Assert.Equal(3, Cities.Housed(s, city));
+
+ Training.Progress(Mvp, s, new List<Cause>());
+
+ Assert.Empty(s.Cohorts);
+ Assert.Equal(1, After(s));
+ Assert.Equal(3, Assert.Single(s.Units.Values, u => u.Type == "recruit").Strength);
+ Assert.Equal(3, Cities.Housed(s, s.Cities[city.Id]));
+ }
+
+ // R-HOUSE-003: formations belong to their training city's housing, not their current hex.
+ [Fact]
+ public void AMovingFormationKeepsItsHomeHousingThroughOrdersAndPromotion()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var city = s.Cities["tel_aviv"].WithCounts(0, 0, 0).WithRecruits(0).WithCraftsmen(0);
+ s.Cities[city.Id] = city;
+ var id = s.NextId++;
+ s.Cohorts.Add(id, new Cohort(id, "recruit", city.Id, 3, 1, 3));
+ var why = new List<Cause>();
+ Training.Progress(Mvp, s, why);
+ var unit = Assert.Single(s.Units.Values, u => u.Type == "recruit");
+ var target = Movement.Reachable(Mvp, s, unit.Id).First(h => h.Value > 0).Key;
+ Assert.Null(Movement.Move(Mvp, s, unit.Id, target.Q, target.R, new Dictionary<int, int>(), why));
+ Assert.Equal(city.Id, s.Units[unit.Id].HomeCity);
+ Assert.Equal(3, Cities.Housed(s, city));
+ Assert.Null(Orders.Give(Mvp, s, unit.Id, Orders.Fortify, why));
+ Assert.Equal(city.Id, s.Units[unit.Id].HomeCity);
+ Orders.Settle(s, why);
+ Assert.Equal(Orders.Fortify, s.Units[unit.Id].Order);
+ Assert.Equal(city.Id, s.Units[unit.Id].HomeCity);
+ var rules = Mvp.RulesAt(s.Date).Mvp!;
+ for (int turn = 0; turn < rules.VeteranSoldierService!.Value; turn++)
+ {
+ Military.Serve(s, rules, why);
+ Assert.Equal(city.Id, s.Units[unit.Id].HomeCity);
+ Assert.Equal(3, Cities.Housed(s, city));
+ }
+ Assert.Equal("veteran_soldier", s.Units[unit.Id].Type);
+ }
+
+ // R-HOUSE-003: another city, an enemy formation and an unknown home do not fill this city's homes.
+ [Fact]
+ public void HousingCountsOnlyTheIsraeliFormationStrengthWithThatHome()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var city = s.Cities["tel_aviv"].WithCounts(0, 0, 0).WithRecruits(0).WithCraftsmen(0);
+ s.Cities[city.Id] = city;
+ var homeId = s.NextId++;
+ var otherCityId = s.NextId++;
+ var enemyId = s.NextId++;
+ var unknownHomeId = s.NextId++;
+ s.Units.Add(homeId, new Unit(homeId, "recruit", 0, 0, side: "israel", strength: 3, homeCity: city.Id));
+ s.Units.Add(otherCityId, new Unit(otherCityId, "veteran_soldier", 0, 0, side: "israel", strength: 5, homeCity: "jerusalem"));
+ s.Units.Add(enemyId, new Unit(enemyId, "enemy", 0, 0, side: "egypt", strength: 7, homeCity: city.Id));
+ s.Units.Add(unknownHomeId, new Unit(unknownHomeId, "recruit", 0, 0, side: "israel", strength: 11));
+ Assert.Equal(4, After(s));
+ Assert.Equal(3, Cities.Housed(s, city));
+ }
+
+ // R-HOUSE-003: the established exception for halutz units remains unchanged.
+ [Fact]
+ public void AGraduatedPioneerCohortLeavesCityHousing()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var home = Mvp.Cities.Single(c => c.Facilities.Contains("hakhshara")).Id;
+ var city = s.Cities[home].WithCounts(0, 0, 0).WithRecruits(0).WithCraftsmen(0);
+ s.Cities[home] = city;
+ var id = s.NextId++;
+ s.Cohorts.Add(id, new Cohort(id, "halutz", home, 3, 1));
+ Assert.Equal(3, Cities.Housed(s, city));
+ Training.Progress(Mvp, s, new List<Cause>());
+ Assert.Equal(3, After(s));
+ Assert.All(s.Units.Values, u => Assert.Empty(u.HomeCity));
+ Assert.Equal(0, Cities.Housed(s, city));
+ }
+
+ // R-UNIT-003: ascending completion order and the same people after differently sized cohorts finish.
+ [Fact]
+ public void NoRecruitIsLostOrDoubled()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var starting = s.Units.Values.Select(u => u.Canonical()).ToArray();
+ var cohort = s.NextId;
+ s.Cohorts.Add(cohort + 2, new Cohort(cohort + 2, "recruit", "tel_aviv", 4, 1, 4));
+ s.Cohorts.Add(cohort, new Cohort(cohort, "recruit", "tel_aviv", 2, 1, 2));
+ s.Cohorts.Add(cohort + 1, new Cohort(cohort + 1, "recruit", "tel_aviv", 1, 2, 1));
+ s.NextId += 3;
+ var firstUnit = s.NextId;
+ const int people = 7;
+ for (var turn = 0; turn < 2; turn++)
+ {
+ Training.Progress(Mvp, s, new List<Cause>());
+ Assert.Equal(people, s.Cohorts.Values.Sum(k => k.Count) + s.Units.Values.Where(u => u.Id >= firstUnit).Sum(u => u.Strength));
+ Assert.Equal(starting, s.Units.Values.Where(u => u.Id < cohort).Select(u => u.Canonical()));
+ Assert.Equal(0, s.Cities["tel_aviv"].Recruits);
+ }
+ var recruits = s.Units.Values.Where(u => u.Id >= firstUnit).ToArray();
+ Assert.Equal(3, After(s));
+ Assert.Equal(new[] { firstUnit, firstUnit + 1, firstUnit + 2 }, recruits.Select(u => u.Id));
+ Assert.Equal(new[] { 2, 4, 1 }, recruits.Select(u => u.Strength));
+ Assert.Equal(firstUnit + 3, s.NextId);
+ }
+
+ // R-TRAIN-003, R-UNIT-003: exercise the real resolver and save replay, not a manually serialised unit.
+ [Fact]
+ public void ACompletedRecruitUnitSurvivesCommandLogReplay()
+ {
+ var g = GameSession.New(Mvp, GoldenRun.Seed, Mode.Historical);
+ Assert.Empty(g.Step(new Command[] { new Train("tel_aviv", "recruit", 3) }).Rejected);
+ Assert.Single(g.State.Cohorts);
+ g.Step(new Command[0]);
+ Assert.Single(g.State.Cohorts);
+ g.Step(new Command[0]);
+
+ Assert.Equal(1, After(g.State));
+ var unit = Assert.Single(g.State.Units.Values, u => u.HomeCity == "tel_aviv");
+ Assert.Equal(("recruit", "israel", 3, 0), (unit.Type, unit.Side, unit.Strength, unit.Service));
+ Assert.Equal(0, g.State.Cities["tel_aviv"].Recruits);
+ var loaded = GameSession.Load(Mvp, g.Save.Write(), out var warning);
+ Assert.Empty(warning);
+ Assert.Equal(g.State.Hash(), loaded.State.Hash());
+ Assert.Equal("tel_aviv", loaded.State.Units[unit.Id].HomeCity);
+ Assert.Equal(unit.Canonical(), loaded.State.Units[unit.Id].Canonical());
+ }
+
+ // #1130 owner decision: a new recruit has three movement points; movement and service replay together.
+ [Fact]
+ public void AGraduatedRecruitMovesWithinItsBudgetAndReplays()
+ {
+ var g = GameSession.New(Mvp, GoldenRun.Seed, Mode.Historical);
+ Assert.Empty(g.Step(new Command[] { new Train("tel_aviv", "recruit", 3) }).Rejected);
+ for (int turn = 1; turn < Mvp.UnitTypes.Single(t => t.Id == "recruit").TrainingTurns; turn++) g.Step(new Command[0]);
+ var recruit = Assert.Single(g.State.Units.Values, u => u.Type == "recruit");
+ var target = Movement.Reachable(Mvp, g.State, recruit.Id).First(h => h.Value == 3).Key;
+
+ var step = g.Step(new Command[] { new Move(recruit.Id, target.Q, target.R), new Move(recruit.Id, recruit.Q, recruit.R) });
+ Assert.Equal("That hex is out of reach this turn", Assert.Single(step.Rejected).Reason);
+ var moved = g.State.Units[recruit.Id];
+ Assert.Equal((target.Q, target.R, "recruit", 3, 1), (moved.Q, moved.R, moved.Type, moved.Strength, moved.Service));
+ var loaded = GameSession.Load(Mvp, g.Save.Write(), out var warnings);
+ Assert.Empty(warnings);
+ Assert.Equal(g.State.Hash(), loaded.State.Hash());
+ Assert.Equal("tel_aviv", moved.HomeCity);
+ Assert.Equal("tel_aviv", loaded.State.Units[recruit.Id].HomeCity);
+ Assert.Equal(moved.Canonical(), loaded.State.Units[recruit.Id].Canonical());
+ }
+
+ // R-UNIT-004: six service turns is owner accepted; training time is not service.
+ [Fact]
+ public void ARecruitPromotesAfterServiceAndKeepsItsFormation()
+ {
+ var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ var id = s.NextId++;
+ s.Units.Add(id, new Unit(id, "recruit", 3, 4, 4, "israel", 3, "hold", "8"));
+ var why = new List<Cause>();
+ TurnResolver.Resolve(Mvp, s, s.Date.AddDays(7), 7 / 365.0, why);
+ Assert.Equal(("recruit", 5), (s.Units[id].Type, s.Units[id].Service));
+ TurnResolver.Resolve(Mvp, s, s.Date.AddDays(7), 7 / 365.0, why);
+ var veteran = s.Units[id];
+ Assert.Equal((id, "veteran_soldier", 3, 4, 6, "israel", 3, "hold", "8"),
+ (veteran.Id, veteran.Type, veteran.Q, veteran.R, veteran.Service, veteran.Side, veteran.Strength, veteran.Order, veteran.OrderTarget));
+ Assert.Single(why, x => x.Message.Contains("veteran soldiers"));
+ TurnResolver.Resolve(Mvp, s, s.Date.AddDays(7), 7 / 365.0, why);
+ Assert.Equal(veteran.Canonical(), s.Units[id].Canonical());
+ }
+
+ // R-UNIT-004: service, promotion and upkeep must all replay through the existing command-log save schema.
+ [Fact]
+ public void ATrainedVeteranSurvivesReplay()
+ {
+ var g = GameSession.New(Mvp, GoldenRun.Seed, Mode.Historical);
+ Assert.Empty(g.Step(new Command[] { new Train("tel_aviv", "recruit", 3) }).Rejected);
+ for (int turn = 1; turn < Mvp.UnitTypes.Single(t => t.Id == "recruit").TrainingTurns; turn++) g.Step(new Command[0]);
+ var threshold = Mvp.Rules.Mvp!.VeteranSoldierService!.Value;
+ for (int service = 1; service <= threshold; service++)
+ {
+ g.Step(new Command[0]);
+ var u = Assert.Single(g.State.Units.Values, x => x.HomeCity == "tel_aviv");
+ Assert.Equal("tel_aviv", u.HomeCity);
+ Assert.Equal(service, u.Service);
+ Assert.Equal(service < threshold ? "recruit" : "veteran_soldier", u.Type);
+ }
+ var loaded = GameSession.Load(Mvp, g.Save.Write(), out var warnings);
+ Assert.Empty(warnings);
+ Assert.Equal(g.State.Hash(), loaded.State.Hash());
+ Assert.Equal(g.State.Describe(), loaded.State.Describe());
+ }
+
+ // R-UNIT-001, R-UNIT-004: content must not create a recruit that cannot pay upkeep or promotes to an unknown type.
+ [Theory]
+ [InlineData("side: israel, class: infantry, facility: military_camp", "facility: military_camp", "types[recruit].side")]
+ [InlineData(" - { id: veteran_soldier, kind: unit, side: israel, class: infantry, movement_points: 3 }\n", "", "types[veteran_soldier]")]
+ public void TrainingRequiresTheMilitaryTypes(string oldText, string newText, string field)
+ {
+ var files = Fixture.Gdd();
+ Assert.Contains(oldText, files["unit_types.yaml"]);
+ files["unit_types.yaml"] = files["unit_types.yaml"].Replace(oldText, newText);
+ var e = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(files)));
+ Assert.Equal("unit_types.yaml", e.File);
+ Assert.Equal(field, e.Field);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/MilitaryUnitTests.cs b/sim/Statecraft.Sim.Tests/MilitaryUnitTests.cs
index 68bfcc676..383a4cf3c 100644
--- a/sim/Statecraft.Sim.Tests/MilitaryUnitTests.cs
+++ b/sim/Statecraft.Sim.Tests/MilitaryUnitTests.cs
@@ -30,14 +30,28 @@ public class MilitaryUnitTests
Assert.Equal("2:artillery@3,4/1|side=israel", new Unit(2, "artillery", 3, 4, 1, side: "israel").Canonical());
}
- // R-UNIT-001: the game's military types are Israel's three, with their class (Q-UNIT-1; owner, 18 October 2026, #741).
+ // R-HOUSE-003, R-UNIT-002: home affects housing, so it is state and survives the immutable clone.
[Fact]
- public void TheRealGameHasTheThreeIsraeliMilitaryTypes()
+ public void AFormationsHomeCityChangesItsHashAndSurvivesAClone()
+ {
+ var s = new GameState();
+ s.Units.Add(1, new Unit(1, "recruit", 0, 0, side: "israel", strength: 3, homeCity: "tel_aviv"));
+ var copy = s.Clone();
+ Assert.Equal("tel_aviv", copy.Units[1].HomeCity);
+ Assert.Equal(s.Hash(), copy.Hash());
+ copy.Units[1] = new Unit(1, "recruit", 0, 0, side: "israel", strength: 3, homeCity: "jerusalem");
+ Assert.NotEqual(s.Hash(), copy.Hash());
+ Assert.Equal("tel_aviv", s.Units[1].HomeCity);
+ }
+
+ // R-UNIT-001: the recruit now joins the three military types introduced by #741, with its side and class.
+ [Fact]
+ public void TheRealGameHasTheFourIsraeliMilitaryTypes()
{
var c = ContentLoader.Load(RealContentTests.ContentRoot());
- Assert.Equal(new[] { ("veteran_soldier", "unit", "israel", "infantry"), ("artillery", "unit", "israel", "artillery"), ("armoured_car", "unit", "israel", "armour") },
+ Assert.Equal(new[] { ("recruit", "unit", "israel", "infantry"), ("veteran_soldier", "unit", "israel", "infantry"), ("artillery", "unit", "israel", "artillery"), ("armoured_car", "unit", "israel", "armour") },
c.UnitTypes.Where(t => t.Side == "israel").Select(t => (t.Id, t.Kind, t.Side, t.Class)));
- Assert.Equal("", c.UnitTypes.Single(t => t.Id == "recruit").Side); // a count per city until PR 3 (R-TRAIN-003)
+ Assert.Equal("israel", c.UnitTypes.Single(t => t.Id == "recruit").Side); // R-TRAIN-003: now a formation.
}
// R-UNIT-001: a military type needs both a side and a class; a type with neither still loads.
diff --git a/sim/Statecraft.Sim.Tests/MilitaryUpkeepTests.cs b/sim/Statecraft.Sim.Tests/MilitaryUpkeepTests.cs
new file mode 100644
index 000000000..2309c49f6
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/MilitaryUpkeepTests.cs
@@ -0,0 +1,141 @@
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>Q-UNIT-3: military units pay Money in resolver step 7, and never pay ongoing Arms upkeep.</summary>
+public class MilitaryUpkeepTests
+{
+ // A real turn must pay for the military unit; a hash containing a unit alone does not prove that it was charged.
+ [Theory]
+ [InlineData("recruit")]
+ [InlineData("veteran_soldier")]
+ [InlineData("artillery")]
+ [InlineData("armoured_car")]
+ public void MilitaryUnitsPayInStepSeven(string type)
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ var empty = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);
+ var army = empty.Clone();
+ var id = army.NextId++;
+ army.Units.Add(id, new Unit(id, type, 0, 0, side: "israel", strength: 3));
+ var withoutArmy = Simulation.Step(c, empty, new Command[0]);
+ var withArmy = Simulation.Step(c, army, new Command[0]);
+ Assert.True(withArmy.State.Treasury - withArmy.State.Debt < withoutArmy.State.Treasury - withoutArmy.State.Debt,
+ "The same turn with a military unit must pay its Money upkeep");
+ Assert.Equal(withoutArmy.State.Arms, withArmy.State.Arms);
+ Assert.Contains(withArmy.Why, x => x.System == "economy" && x.Target == "treasury" && x.Message.Contains("military upkeep"));
+ }
+
+ // R-UNIT-010, R-MONEY-003: production can fund upkeep; housing still happens after payment.
+ [Theory]
+ [InlineData(false, 2, 0)]
+ [InlineData(true, 5, 2)]
+ public void ProductionFundsUpkeepBeforeHousingAndAShortfallBorrows(bool mappedAbsorption, int refugees, int waiting)
+ {
+ var files = Fixture.Gdd();
+ files["rules.yaml"] = files["rules.yaml"].Replace("military_upkeep_per_turn: 0.1", "military_upkeep_per_turn: 2");
+ // Isolate step 8's existing residents from step 9's later arrivals.
+ files["aliyah.yaml"] = Fixture.Files["aliyah.yaml"].Replace("europe: 230", "europe: 0");
+ if (mappedAbsorption)
+ {
+ // R-MIN-001, R-MIN-002: a vacant Immigration office with the full budget houses floor(5 * 0.75) = 3.
+ files["offices.yaml"] = Fixture.Files["offices.yaml"] + " - id: immigration_minister\n title: Minister of Immigration\n";
+ files["rules.yaml"] = files["rules.yaml"]
+ .Replace("budget_start: { finance_minister: 1.0 }", "budget_start: { immigration_minister: 1.0, finance_minister: 0.0 }")
+ + " minister_systems:\n absorption: immigration_minister\n";
+ }
+ var c = ContentLoader.Load(Fixture.Write(files));
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Treasury = 0;
+ s.Cities["town_a"] = s.Cities["town_a"].WithCounts(10, 6, refugees);
+ s.Units.Add(1, new Unit(1, "recruit", 1, 0, side: "israel", strength: 3));
+ var debt = s.Debt;
+ var arms = s.Arms;
+ var why = new List<Cause>();
+ TurnResolver.Resolve(c, s, s.Date.AddMonths(3), 0.25, why);
+
+ Assert.Equal(0, s.Treasury);
+ Assert.Equal(debt + 2 - 6 * 1.2 * 0.25, s.Debt, 9);
+ Assert.Equal(arms, s.Arms);
+ Assert.Equal(3, s.Units[1].Strength); // No silent attrition or disbanding to hide the shortfall.
+ Assert.Equal(waiting, s.Cities["town_a"].Refugees);
+ Assert.Equal(10 + refugees - waiting, s.Cities["town_a"].Civilians);
+ Assert.Equal(refugees - waiting,
+ Assert.Single(why, x => x.Message.Contains("immigrants housed")).Delta);
+ var production = why.FindIndex(x => x.Message.Contains("jobs paid"));
+ var upkeep = why.FindIndex(x => x.Message.EndsWith("(military upkeep)"));
+ var housing = why.FindIndex(x => x.Message.Contains("immigrants housed"));
+ Assert.True(production >= 0 && upkeep > production && housing > upkeep);
+ Assert.Contains(why, x => x.System == "economy" && x.Target == "debt" && x.Message.EndsWith("for military upkeep"));
+ }
+
+ // R-UNIT-010: per formation per turn, irrespective of strength, weekly/monthly length or civilian tokens.
+ [Theory]
+ [InlineData(1, 1 / 52.0)]
+ [InlineData(7, 1 / 12.0)]
+ public void OnlyIsraeliMilitaryFormationsPay(int strength, double yearFraction)
+ {
+ var files = Fixture.Gdd();
+ files["unit_types.yaml"] += " - { id: enemy, kind: unit, side: egypt, class: infantry, movement_points: 3 }\n";
+ var c = ContentLoader.Load(Fixture.Write(files));
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Units.Add(1, new Unit(1, "recruit", 1, 0, side: "israel", strength: strength));
+ s.Units.Add(2, new Unit(2, "veteran_soldier", 1, 0, side: "israel", strength: strength));
+ s.Units.Add(3, new Unit(3, "enemy", 1, 0, side: "egypt", strength: strength));
+ s.Units.Add(4, new Unit(4, "halutz", 1, 0));
+ s.Units.Add(5, new Unit(5, "veteran_soldier", 1, 0)); // default record without a military side
+ var why = new List<Cause>();
+ TurnResolver.Resolve(c, s, s.Date.AddDays(7), yearFraction, why);
+ Assert.Equal(-0.2, Assert.Single(why, x => x.Message.EndsWith("(military upkeep)")).Delta, 9);
+ }
+
+ // R-UNIT-010: graduation in step 4 makes a formation eligible for upkeep in the same turn's step 7.
+ [Fact]
+ public void ANewlyGraduatedFormationPaysThisTurn()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ var s = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);
+ var id = s.NextId++;
+ s.Cohorts.Add(id, new Cohort(id, "recruit", "tel_aviv", 3, 1, 3));
+ var why = new List<Cause>();
+ // The Israeli formations on the board, not every starting row: a brigade dated after the start arrives later (R-UNIT-009).
+ var israelBefore = s.Units.Values.Count(u => u.Side == "israel");
+ TurnResolver.Resolve(c, s, s.Date.AddDays(7), 7 / 365.0, why);
+ Assert.Equal(-(israelBefore + 1) * c.Rules.Mvp!.MilitaryUpkeepPerTurn!.Value,
+ Assert.Single(why, x => x.Message.EndsWith("(military upkeep)")).Delta);
+ var formed = Assert.Single(s.Units.Values, u => u.Id >= c.StartingForces.Count);
+ Assert.Equal(("recruit", 0), (formed.Type, formed.Service));
+ }
+
+ // R-UNIT-010: the legacy resolver does not acquire military rules just because a state has a unit.
+ [Fact]
+ public void TheLegacyLoopDoesNotChargeUpkeepOrAdvanceService()
+ {
+ var c = ContentLoader.Load(Fixture.Write());
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Units.Add(1, new Unit(1, "recruit", 1, 0, side: "israel", strength: 3));
+ var before = s.Hash();
+ var why = new List<Cause>();
+ TurnResolver.Resolve(c, s, s.Date.AddDays(7), 7 / 365.0, why);
+ Assert.Equal(before, s.Hash());
+ Assert.Empty(why);
+ }
+
+ // R-UNIT-010, R-UNIT-004: values are explicit, finite and in range rather than defaulting missing keys to zero.
+ [Theory]
+ [InlineData("military_upkeep_per_turn: 0.1", "", "military_upkeep_per_turn", "required")]
+ [InlineData("military_upkeep_per_turn: 0.1", "military_upkeep_per_turn: -1", "military_upkeep_per_turn", ">= 0")]
+ [InlineData("military_upkeep_per_turn: 0.1", "military_upkeep_per_turn: .nan", "military_upkeep_per_turn", "finite")]
+ [InlineData("military_upkeep_per_turn: 0.1", "military_upkeep_per_turn: .inf", "military_upkeep_per_turn", "finite")]
+ [InlineData("veteran_soldier_service: 3", "", "veteran_soldier_service", "required")]
+ [InlineData("veteran_soldier_service: 3", "veteran_soldier_service: 0", "veteran_soldier_service", ">= 1")]
+ public void TheMilitaryRulesAreRequiredAndInRange(string line, string replacement, string field, string reason)
+ {
+ var files = Fixture.Gdd();
+ files["rules.yaml"] = files["rules.yaml"].Replace(" " + line + "\n", replacement == "" ? "" : " " + replacement + "\n");
+ var e = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(files)));
+ Assert.Equal("rules.yaml", e.File);
+ Assert.Equal("mvp." + field, e.Field);
+ Assert.Contains(reason, e.Message);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/MoneyTests.cs b/sim/Statecraft.Sim.Tests/MoneyTests.cs
index bf365078a..883af5bca 100644
--- a/sim/Statecraft.Sim.Tests/MoneyTests.cs
+++ b/sim/Statecraft.Sim.Tests/MoneyTests.cs
@@ -85,7 +85,7 @@ public class MoneyTests
}
// R-MONEY-002, owner option 3 (18 October 2026, #884): in the real MVP no civilian place pays upkeep, so a turn with
- // every kind built charges nothing and names no upkeep cause.
+ // every kind built names no civilian upkeep cause; military formations still pay their accepted upkeep.
[Fact]
public void TheMvpChargesNoCivilianUpkeep()
{
@@ -99,7 +99,8 @@ public class MoneyTests
Assert.Equal(0, Cities.AnnualUpkeep(C, s, C.Rules.Mvp!));
var why = new List<Cause>();
TurnResolver.Resolve(C, s, s.Date.AddMonths(1), 1 / 12.0, why);
- Assert.DoesNotContain(why, x => x.Message.Contains("upkeep"));
+ Assert.DoesNotContain(why, x => x.Message.Contains("civilian upkeep", StringComparison.Ordinal));
+ Assert.Contains(why, x => x.Message.EndsWith("(military upkeep)", StringComparison.Ordinal) && x.Delta < 0);
}
// R-MONEY-001 (D-C3): a guard, not a change. The real game runs the GDD loop, its debt and foreign currency are in the
diff --git a/sim/Statecraft.Sim.Tests/MovementTests.cs b/sim/Statecraft.Sim.Tests/MovementTests.cs
index f9fa0343e..95f281db7 100644
--- a/sim/Statecraft.Sim.Tests/MovementTests.cs
+++ b/sim/Statecraft.Sim.Tests/MovementTests.cs
@@ -78,7 +78,7 @@ public class MovementTests
}
// R-MOVE-001: the real game's numbers, design values this PR proposes (Q-MOVE-1): one cost per land biome of hexes.json,
- // none for lake and sea, and the movement points of the three military types.
+ // none for lake and sea, and the movement points of the four military types.
[Fact]
public void TheRealGameHasACostForEveryLandBiomeAndPointsForEveryMilitaryType()
{
@@ -88,7 +88,7 @@ public class MovementTests
new SortedDictionary<string, int>(costs));
Assert.Equal(new SortedSet<string>(costs.Keys), new SortedSet<string>(c.Hexes.Where(h => h.Land).Select(h => h.Biome)));
Assert.DoesNotContain(c.Hexes, h => h.Land && (h.Biome == "sea" || h.Biome == "lake"));
- Assert.Equal(new[] { ("veteran_soldier", 3), ("artillery", 2), ("armoured_car", 5), ("egyptian_army", 3), ("arab_legion", 3),
+ Assert.Equal(new[] { ("recruit", 3), ("veteran_soldier", 3), ("artillery", 2), ("armoured_car", 5), ("egyptian_army", 3), ("arab_legion", 3),
("syrian_army", 3), ("iraqi_army", 3), ("arab_liberation_army", 3) }, // the Arab types: #743, owner, 20 October 2026
c.UnitTypes.Where(t => t.Side != "").Select(t => (t.Id, t.MovementPoints)));
}
diff --git a/sim/Statecraft.Sim.Tests/RaidTests.cs b/sim/Statecraft.Sim.Tests/RaidTests.cs
index 7cd662834..a841c5906 100644
--- a/sim/Statecraft.Sim.Tests/RaidTests.cs
+++ b/sim/Statecraft.Sim.Tests/RaidTests.cs
@@ -172,6 +172,17 @@ public class RaidTests
Assert.Equal(Orders.Hold, next.Units[2].Order);
}
+ // R-CTRL-010 with R-HOUSE-003 (Q-HOUSE-5, #1130): a withdrawing formation keeps its home city, so it still counts in
+ // that city's housing after it steps out.
+ [Fact]
+ public void AWithdrawingFormationKeepsItsHomeCity()
+ {
+ var c = Load();
+ var formation = new Unit(1, "soldier", 1, 0, side: "israel", strength: 2, homeCity: "town_a");
+ var next = Step(c, Awaiting(c, formation), Raid()).State;
+ Assert.Equal(((2, 0), "town_a"), ((next.Units[1].Q, next.Units[1].R), next.Units[1].HomeCity));
+ }
+
// R-CTRL-009: HistoricalAI leaves out a Raid the sim would refuse, so its orders are never rejected and the capture waits.
[Fact]
public void HistoricalAIWaitsWhenRaidIsRefused()
diff --git a/sim/Statecraft.Sim.Tests/StartingForcesTests.cs b/sim/Statecraft.Sim.Tests/StartingForcesTests.cs
index 805141f37..ec3e0e7d9 100644
--- a/sim/Statecraft.Sim.Tests/StartingForcesTests.cs
+++ b/sim/Statecraft.Sim.Tests/StartingForcesTests.cs
@@ -14,7 +14,6 @@ public class StartingForcesTests
/// <summary>The fixture's military types: Israel's brigade type and one Egyptian type (design values for the test).</summary>
const string Types = Fixture.GddUnitTypes
- + " - { id: veteran_soldier, kind: unit, side: israel, class: infantry, movement_points: 3 }\n"
+ " - { id: egyptian_army, kind: unit, side: egypt, class: infantry, movement_points: 3 }\n";
/// <summary>One units_1948.yaml row in the fixture's map (an army row with one anchor from 15 May 1948) and its anchor's
diff --git a/sim/Statecraft.Sim.Tests/StructuredEffectTests.cs b/sim/Statecraft.Sim.Tests/StructuredEffectTests.cs
index e85efffcf..a336bed6c 100644
--- a/sim/Statecraft.Sim.Tests/StructuredEffectTests.cs
+++ b/sim/Statecraft.Sim.Tests/StructuredEffectTests.cs
@@ -128,7 +128,9 @@ from: 1948-05-15
// at run time. A site has no window yet and starts unbuilt, so a site target is refused until sites carry a date.
[Theory]
[InlineData(" grant_units:\n - { type: tank, n: 1 }\n", "grant_units[0].type", "unknown unit type")]
- [InlineData(" grant_units:\n - { type: recruit, n: 1 }\n", "grant_units[0].type", "not a unit")]
+ [InlineData(" grant_units:\n - { type: civilian, n: 1 }\n", "grant_units[0].type", "not a unit")]
+ [InlineData(" grant_units:\n - { type: recruit, n: 1 }\n", "grant_units[0].type", "military strength")]
+ [InlineData(" grant_units:\n - { type: veteran_soldier, n: 1 }\n", "grant_units[0].type", "military strength")]
[InlineData(" grant_units:\n - { type: halutz, n: 0 }\n", "grant_units[0].n", "at least 1")]
[InlineData(" grant_units:\n - { type: halutz, n: -2 }\n", "grant_units[0].n", "at least 1")]
[InlineData(" grant_units:\n - { type: halutz, n: 1, at: nowhere }\n", "grant_units[0].at", "unknown city")]
diff --git a/sim/Statecraft.Sim.Tests/TrainingTests.cs b/sim/Statecraft.Sim.Tests/TrainingTests.cs
index 103355857..964de9906 100644
--- a/sim/Statecraft.Sim.Tests/TrainingTests.cs
+++ b/sim/Statecraft.Sim.Tests/TrainingTests.cs
@@ -213,7 +213,8 @@ public class TrainingTests
var late = Step(c, done, new CancelTraining(id));
Assert.Equal("There is no such training group", Assert.Single(late.Rejected).Reason);
Assert.Equal(Step(c, done).State.Hash(), late.State.Hash());
- Assert.Equal(1, late.State.Cities["town_a"].Recruits);
+ Assert.Equal(0, late.State.Cities["town_a"].Recruits);
+ Assert.Equal(1, Assert.Single(late.State.Units.Values).Strength);
}
// R-TRAIN-001, R-TRAIN-002
@@ -250,8 +251,10 @@ public class TrainingTests
s = Step(Mvp, s).State;
}
Assert.Empty(s.Cohorts);
- Assert.Equal(3, s.Cities["tel_aviv"].Recruits);
- Assert.DoesNotContain(s.Units.Keys, id => id >= Mvp.StartingForces.Count); // the starting forces only (R-UNIT-006): a recruit is a count until Phase 5; the enemy may have destroyed one (R-ENEMY-003)
+ Assert.Equal(0, s.Cities["tel_aviv"].Recruits);
+ // Phase 5 (R-UNIT-003): one formation per completed cohort, after the starting forces; the enemy may have destroyed a starting force (R-ENEMY-003).
+ var formed = Assert.Single(s.Units.Values, u => u.Id >= Mvp.StartingForces.Count);
+ Assert.Equal(("recruit", 3), (formed.Type, formed.Strength));
}
/// <summary>The timing rule, the plan's reading of D-A6 (Task 4.3) and not part of the owner's ruling: the turn a cohort is ordered in is its first training turn, so a cohort
@@ -269,7 +272,9 @@ public class TrainingTests
Assert.Single(t1.Cohorts);
Assert.Equal(0, t1.Cities["tel_aviv"].Recruits);
Assert.Empty(t2.Cohorts);
- Assert.Equal(2, t2.Cities["tel_aviv"].Recruits);
+ Assert.Equal(0, t2.Cities["tel_aviv"].Recruits);
+ Assert.Equal(Mvp.StartingForces.Count + 1, t2.Units.Count);
+ Assert.Equal(2, Assert.Single(t2.Units.Values, u => u.Type == "recruit").Strength);
var u0 = Step(Mvp, start, new Train("tel_aviv", "halutz", 2)).State; // halutz: 4 turns, done at the end of T+3
var u2 = Step(Mvp, Step(Mvp, u0).State).State;
diff --git a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
index cbe6bd531..d006b0c76 100644
--- a/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
+++ b/sim/Statecraft.Sim.Tests/TreasuryFloorTests.cs
@@ -22,8 +22,9 @@ public class TreasuryFloorTests
if (firstDebt == null && s.Debt > 0) firstDebt = s.Turn;
}
// 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);
+ // sent the reserves home a turn after the first truce; the GDD loop now lowers the call-up with the rung (R-WAR-002),
+ // which made it turn 5. The Israeli formations' Money upkeep (R-UNIT-010, #1130) brings it back to turn 4.
+ Assert.Equal(4, 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/TruceTests.cs b/sim/Statecraft.Sim.Tests/TruceTests.cs
index e67a96d6e..95331405f 100644
--- a/sim/Statecraft.Sim.Tests/TruceTests.cs
+++ b/sim/Statecraft.Sim.Tests/TruceTests.cs
@@ -126,6 +126,20 @@ public class TruceTests
Assert.Equal(Combat.Attack, t.Units[1].Order);
}
+ /// <summary>R-COMBAT-009 with Q-HOUSE-5 (#1130): ending an attack for a truce keeps the formation's home city, so it
+ /// stays housed there.</summary>
+ [Fact]
+ public void AcceptingATruceKeepsTheFormationsHomeCity()
+ {
+ var c = Load(TruceEvents);
+ var s = State(c, new DateTime(1948, 6, 15));
+ s.Units[1] = new Unit(1, "soldier", 3, 0, side: "israel", strength: 5, order: Combat.Attack, orderTarget: "2,0", homeCity: "tel_aviv");
+ s.PendingEvents.Add("first_truce");
+ Assert.Null(EventSystem.Choose(c, s, "first_truce", "accept", new List<Cause>()));
+ Assert.Equal("", s.Units[1].Order);
+ Assert.Equal("tel_aviv", s.Units[1].HomeCity);
+ }
+
/// <summary>The two truce cards as the fixture needs them: the accepting option and one that fights on. Fixture
/// texts, not the cards'.</summary>
static readonly Dictionary<string, string> TruceEvents = new Dictionary<string, string>
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
index 559f55a39..92d4dc812 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=81.75032828298673 [4054700560EB2C47]
+debt=89.95032828298672 [40567CD22DB7F913]
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 2a48139cd..701b98ccf 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=206.14012071283815 [4069C47BDE6EE43A]
+debt=223.94012071283805 [406BFE1578087DD0]
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 642ed69a5..04924fd51 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 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
+hash1950 f3ec68b734a3beb24df9a873e0400f0253aed48f3cde2ea12415f1890dcaa5b0
+hash1952 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b
+smoke5 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85
+smoke-orders ee6bfee561120532416c1aff2cd7cd741256aaafb443d19b414031356b680ae6
+scenario-reckless 6650ed3e18610fc3f53e7b8b815c0a1057d43cde08b47c0f1c6fb61ddb577fc1
+scenario-cautious 95982cf8d54e4040f40ecdceee5a53dc8c8f63df8a892c2d57496f66243cf120
+scenario-mvp-absorb-first d6d47fd8eaed15787d6a92214752c4d672095b317fc0b829b0002f2dee021ed5
+mvp-end 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b
+scenario-mvp-defeat 584a828a24355f522b8717646a7173b4567d2c202c111c048461d435fd66ccb1
diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
index 2a48139cd..701b98ccf 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=206.14012071283815 [4069C47BDE6EE43A]
+debt=223.94012071283805 [406BFE1578087DD0]
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 520e82083..25d3c1dfc 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
@@ -43,7 +43,7 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=20.9605919260477 [4034F5E95A3B2D31]
+debt=24.360591926047697 [40385C4FC0A19396]
fx=80.85238326859616 [4054368D728D91CC]
rung=5;cf=0;
mob=0.8 [3FE999999999999A]
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 9ca2c636b..503854354 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
@@ -43,7 +43,7 @@ pop{
veterans=667938.2378207468 [4124624479C3A414]
sit[
treasury=0 [0000000000000000]
-debt=272.9253282829867 [40710ECE250797DE]
+debt=281.1253282829867 [40719201583ACB11]
fx=94.52989672613671 [4057A1E9D3F540F0]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
index 64d5819a8..b10f8df9f 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
@@ -46,7 +46,7 @@ sit[
fx_crisis
housing_crisis
treasury=0 [0000000000000000]
-debt=281.64012071283815 [40719A3DEF37721D]
+debt=299.4401207128381 [4072B70ABC043EE9]
fx=-74.99043132809655 [C052BF633A14C6F2]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
index fba0a2b6d..a76606917 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
@@ -43,7 +43,7 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=20.9605919260477 [4034F5E95A3B2D31]
+debt=24.360591926047697 [40385C4FC0A19396]
fx=80.85238326859616 [4054368D728D91CC]
rung=5;cf=0;
mob=0.8 [3FE999999999999A]
diff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.cs
index ab0adbc50..bec25ff49 100644
--- a/sim/Statecraft.Sim/Cities.cs
+++ b/sim/Statecraft.Sim/Cities.cs
@@ -126,11 +126,13 @@ namespace Statecraft.Sim
/// <summary>R-HOUSE-003 (Q-HOUSE-5): the people who take the city's housing: its civilians, craftsmen, recruits and groups
/// in training (a halutz group too, until it becomes a movable unit and leaves). Refugees wait for housing and are not
- /// in it. Summed as integers, so the order of the training groups cannot change it.</summary>
+ /// in it. Israeli formations retain their home city's housing after graduation, including when they move or become
+ /// veterans. Summed as integers, so the order of the training groups and formations cannot change it.</summary>
public static int Housed(GameState s, City x)
{
var n = x.Civilians + x.Craftsmen + x.Recruits;
foreach (var k in s.Cohorts.Values) if (k.City == x.Id) n += k.Count;
+ foreach (var u in s.Units.Values) if (u.Side == "israel" && u.HomeCity == x.Id) n += u.Strength;
return n;
}
diff --git a/sim/Statecraft.Sim/Combat.cs b/sim/Statecraft.Sim/Combat.cs
index f20355373..a061948bb 100644
--- a/sim/Statecraft.Sim/Combat.cs
+++ b/sim/Statecraft.Sim/Combat.cs
@@ -78,7 +78,7 @@ namespace Statecraft.Sim
{
var u = s.Units[id];
if (!Player(u) || u.Order != Attack) continue;
- s.Units[id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "");
+ s.Units[id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "", u.HomeCity);
why.Add(new Cause("map", id.ToString(CultureInfo.InvariantCulture), 0, $"Unit {id}'s attack on hex {u.OrderTarget} ends: a truce is on"));
}
}
@@ -120,7 +120,7 @@ namespace Statecraft.Sim
var refused = Check(c, s, unitId, q, r, enemy);
if (refused != null) return refused;
var u = s.Units[unitId]; var target = Hex(q!.Value, r!.Value);
- s.Units[unitId] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, Attack, target);
+ s.Units[unitId] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, Attack, target, u.HomeCity);
why.Add(new Cause("map", unitId.ToString(CultureInfo.InvariantCulture), 0, $"Unit {unitId} will attack hex {target}", enemy ? Attack : ""));
return null;
}
@@ -247,7 +247,7 @@ namespace Statecraft.Sim
static void End(GameState s, Unit u, string line, List<Cause> why)
{
- s.Units[u.Id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "");
+ s.Units[u.Id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "", u.HomeCity);
why.Add(new Cause("map", u.Id.ToString(CultureInfo.InvariantCulture), 0, line));
}
@@ -278,7 +278,7 @@ namespace Statecraft.Sim
if (!s.Units.TryGetValue(d.Id, out var u)) continue;
if (Retreat(c, s, mvp, u) is (int, int) to)
{
- s.Units[u.Id] = new Unit(u.Id, u.Type, to.Item1, to.Item2, u.Service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ s.Units[u.Id] = new Unit(u.Id, u.Type, to.Item1, to.Item2, u.Service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
why.Add(new Cause("map", u.Id.ToString(CultureInfo.InvariantCulture), 0, $"Unit {u.Id} retreated to hex {Hex(to.Item1, to.Item2)}"));
}
else
@@ -310,7 +310,7 @@ namespace Statecraft.Sim
if (s.Units.TryGetValue(id, out var x) && (top == null || x.Strength > top.Strength)) top = x;
if (top == null) break;
if (top.Strength <= 1) { s.Units.Remove(top.Id); removed.Add(top.Id); }
- else s.Units[top.Id] = new Unit(top.Id, top.Type, top.Q, top.R, top.Service, top.Side, top.Strength - 1, top.Order, top.OrderTarget);
+ else s.Units[top.Id] = new Unit(top.Id, top.Type, top.Q, top.R, top.Service, top.Side, top.Strength - 1, top.Order, top.OrderTarget, top.HomeCity);
}
return taken;
}
diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.cs
index 691713ff7..42563fdef 100644
--- a/sim/Statecraft.Sim/Content.cs
+++ b/sim/Statecraft.Sim/Content.cs
@@ -584,6 +584,10 @@ namespace Statecraft.Sim
/// <summary>The Arms one recruit group takes when its training starts (R-ARMS-003; D-G6, Q-UNIT-3, #781). Required in the
/// GDD loop, &gt;= 0.</summary>
public int? ArmsPerRecruitGroup { get; set; }
+ /// <summary>IL millions per Israeli military formation per turn, not per strength point (R-UNIT-010; Q-UNIT-3).</summary>
+ public double? MilitaryUpkeepPerTurn { get; set; }
+ /// <summary>Turns served as a recruit before promotion to veteran_soldier (R-UNIT-004; Q-UNIT-2).</summary>
+ public int? VeteranSoldierService { get; set; }
/// <summary>Turns of work after which a halutz unit becomes a veteran_halutz (R-VET-001; D-D9, Q-VET-1). Required in
/// the GDD loop, at least 1.</summary>
public int? VeteranHalutzService { get; set; }
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index 398f55dc1..6f2f53e2c 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -1088,6 +1088,7 @@ namespace Statecraft.Sim
{
var at = $"types[{x.Id}]";
if (x.Kind != "population" && x.Kind != "unit") throw new ContentException(uf, at + ".kind", "must be population or unit");
+ if (x.Id == "recruit" && x.Side != "israel") throw new ContentException(uf, at + ".side", "a recruit must be an Israeli military unit (R-UNIT-003)");
// R-UNIT-001: a type with a side or a class is military, and needs both; the sides are units_1948.yaml's.
if (x.Side != "" || x.Class != "")
{
@@ -1133,6 +1134,9 @@ namespace Statecraft.Sim
if (x.TrainingTurns < 1) throw new ContentException(uf, at + ".training_turns", "must be >= 1");
if (!(x.TrainingCost >= 0 && IsFinite(x.TrainingCost))) throw new ContentException(uf, at + ".training_cost", "must be a finite number >= 0");
}
+ // R-UNIT-004: promotion must not create a unit whose military type is missing or belongs to another side.
+ if (c.UnitTypes.Any(t => t.Id == "recruit") && !c.UnitTypes.Any(t => t.Id == "veteran_soldier" && t.Kind == "unit" && t.Side == "israel" && t.Class == "infantry"))
+ throw new ContentException(uf, "types[veteran_soldier]", "required as an Israeli infantry unit for recruit promotion");
// R-CITY-003: the arrivals are spread over the cities, so there must be one to take them.
if (c.Cities.Count == 0) throw new ContentException(cf, "cities", "the GDD loop needs at least one city to take the arrivals");
foreach (var (file, r) in new[] { ("rules.yaml", c.Rules) }.Concat(c.EraRules.OrderBy(kv => kv.Key, StringComparer.Ordinal).Select(kv => ("rules/" + kv.Key + ".yaml", kv.Value))))
@@ -1195,6 +1199,11 @@ namespace Statecraft.Sim
if (!(m.ArmsPrice >= 0 && IsFinite(m.ArmsPrice.Value))) throw new ContentException(file, "mvp.arms_price", "must be a finite number >= 0");
if (m.ArmsPerRecruitGroup == null) throw new ContentException(file, "mvp.arms_per_recruit_group", "required when eras.yaml systems.loop is gdd");
if (m.ArmsPerRecruitGroup < 0) throw new ContentException(file, "mvp.arms_per_recruit_group", "must be >= 0");
+ // R-UNIT-010, R-UNIT-004: omitted values must not silently make upkeep free or promotion immediate.
+ if (m.MilitaryUpkeepPerTurn == null) throw new ContentException(file, "mvp.military_upkeep_per_turn", "required when eras.yaml systems.loop is gdd");
+ if (!(m.MilitaryUpkeepPerTurn >= 0 && IsFinite(m.MilitaryUpkeepPerTurn.Value))) throw new ContentException(file, "mvp.military_upkeep_per_turn", "must be a finite number >= 0");
+ if (m.VeteranSoldierService == null) throw new ContentException(file, "mvp.veteran_soldier_service", "required when eras.yaml systems.loop is gdd");
+ if (m.VeteranSoldierService < 1) throw new ContentException(file, "mvp.veteran_soldier_service", "must be >= 1");
// R-VET-001, R-VET-002: required, so a missing key is not read as 0 (a veteran after no work, or one that builds nothing).
foreach (var (key, v) in new[] { ("veteran_halutz_service", m.VeteranHalutzService), ("veteran_progress", m.VeteranProgress) })
{
diff --git a/sim/Statecraft.Sim/Corridors.cs b/sim/Statecraft.Sim/Corridors.cs
index a8646dd56..4fc06f1b0 100644
--- a/sim/Statecraft.Sim/Corridors.cs
+++ b/sim/Statecraft.Sim/Corridors.cs
@@ -112,7 +112,7 @@ namespace Statecraft.Sim
if (u.Type != "halutz") continue;
var service = u.Service + 1;
var promoted = service >= r.VeteranHalutzService!.Value;
- s.Units[u.Id] = new Unit(u.Id, promoted ? Projects.VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ s.Units[u.Id] = new Unit(u.Id, promoted ? Projects.VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
if (promoted) why.Add(new Cause("map", w.Id, 1, "A group of halutzim became veteran pioneers"));
}
s.Corridors[w.Id] = cur;
diff --git a/sim/Statecraft.Sim/EnemyAI.cs b/sim/Statecraft.Sim/EnemyAI.cs
index 15e46dd9c..14f3bfa36 100644
--- a/sim/Statecraft.Sim/EnemyAI.cs
+++ b/sim/Statecraft.Sim/EnemyAI.cs
@@ -55,7 +55,7 @@ namespace Statecraft.Sim
// fortify (Movement.Move), and step 2 would resolve it inside the truce (owner, #1263).
if (truce && u.Order == Combat.Attack)
{
- s.Units[id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "");
+ s.Units[id] = new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, "", "", u.HomeCity);
why.Add(new Cause("map", id.ToString(System.Globalization.CultureInfo.InvariantCulture), 0,
$"Unit {id}'s attack on hex {u.OrderTarget} ends: a truce is on"));
}
diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.cs
index 5156675eb..f73f12118 100644
--- a/sim/Statecraft.Sim/EventRules.cs
+++ b/sim/Statecraft.Sim/EventRules.cs
@@ -127,6 +127,9 @@ namespace Statecraft.Sim
var type = c.UnitTypes.FirstOrDefault(t => t.Id == g.Type)
?? throw new ContentException(e.File, G(".type"), $"unknown unit type '{g.Type}'");
if (type.Kind != "unit") throw new ContentException(e.File, G(".type"), $"'{g.Type}' is not a unit type (kind {type.Kind})");
+ // R-EFX-003: this schema has neither strength nor a sourced military formation. Do not turn a recruit
+ // into a default-side, zero-strength unit now that training produces military units (R-UNIT-003).
+ if (type.Side != "") throw new ContentException(e.File, G(".type"), "grant_units does not specify military strength; use recruit training instead");
if (g.N < 1) throw new ContentException(e.File, G(".n"), "must be at least 1");
if (g.At == "" && c.Cities.Count(x => x.Facilities.Contains(EventSystem.MilitaryCamp)) != 1)
throw new ContentException(e.File, G(".at"), "required: no single city has the military camp, so name a city");
diff --git a/sim/Statecraft.Sim/GddState.cs b/sim/Statecraft.Sim/GddState.cs
index 3e9a2ab7f..4a62dc134 100644
--- a/sim/Statecraft.Sim/GddState.cs
+++ b/sim/Statecraft.Sim/GddState.cs
@@ -50,8 +50,8 @@ namespace Statecraft.Sim
/// Craftsmen take the jobs first (R-CRAFT-002).</summary>
public int Employed { get; }
public int Refugees { get; }
- /// <summary>The recruits who finished basic training here (GDD "Progression"; R-TRAIN-003). A count until Phase 5 makes
- /// soldiers units.</summary>
+ /// <summary>Legacy city recruit count, retained for canonical compatibility. New training completes into
+ /// State.Units (R-TRAIN-003), never this field; saves replay their command log rather than city snapshots.</summary>
public int Recruits { get; }
/// <summary>The craftsmen trained here (D-D4; R-CRAFT-001): a count, not movable units (D-A2), and not part of
/// <see cref="Civilians"/>.</summary>
@@ -122,10 +122,13 @@ namespace Statecraft.Sim
/// <summary>The unit's standing order and what it names, or "" for none (R-UNIT-001). Later Phase 5 PRs set them.</summary>
public string Order { get; }
public string OrderTarget { get; }
+ /// <summary>The city whose housing includes this formation (R-HOUSE-003, Q-HOUSE-5), independent of its current hex.
+ /// Empty for units without a known home, including pioneers.</summary>
+ public string HomeCity { get; }
- public Unit(int id, string type, int q, int r, int service = 0, string side = "", int strength = 0, string order = "", string orderTarget = "")
+ public Unit(int id, string type, int q, int r, int service = 0, string side = "", int strength = 0, string order = "", string orderTarget = "", string homeCity = "")
{
- Id = id; Type = type; Q = q; R = r; Service = service; Side = side; Strength = strength; Order = order; OrderTarget = orderTarget;
+ Id = id; Type = type; Q = q; R = r; Service = service; Side = side; Strength = strength; Order = order; OrderTarget = orderTarget; HomeCity = homeCity;
}
/// <summary>The record as the state hash writes it. Each field after the hex is written only when it is not at its
@@ -136,7 +139,8 @@ namespace Statecraft.Sim
+ (Side == "" ? "" : "|side=" + Side)
+ (Strength == 0 ? "" : "|strength=" + Strength.ToString(CultureInfo.InvariantCulture))
+ (Order == "" ? "" : "|order=" + Order)
- + (OrderTarget == "" ? "" : "|target=" + OrderTarget);
+ + (OrderTarget == "" ? "" : "|target=" + OrderTarget)
+ + (HomeCity == "" ? "" : "|home=" + HomeCity);
}
/// <summary>A group of a city's people in training (GDD "Progression"; R-TRAIN-001): <see cref="Count"/> population units
diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.cs
index f340c30e8..fe4c6206d 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 = "f70d7cc2d9438c3b0859a957842fae9a456198d1a1160f962b61fec5b28af0df";
+ public const string Hash1950 = "f3ec68b734a3beb24df9a873e0400f0253aed48f3cde2ea12415f1890dcaa5b0";
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 = "ca78893d57bd7235dd923f29b611e0c12e99d702312c24b5bfc72ac82b3d14bf";
+ public const string Hash1952 = "6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b";
public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);
diff --git a/sim/Statecraft.Sim/Military.cs b/sim/Statecraft.Sim/Military.cs
new file mode 100644
index 000000000..3359852b9
--- /dev/null
+++ b/sim/Statecraft.Sim/Military.cs
@@ -0,0 +1,35 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Statecraft.Sim
+{
+ /// <summary>Service and Money upkeep for the GDD's military formations (Phase 5 PR 3).</summary>
+ public static class Military
+ {
+ /// <summary>R-UNIT-004: recruits already in play serve this turn. Run before training completes, so training time
+ /// never counts as service. Promotion preserves the formation and its standing order; combat adds no service.</summary>
+ public static void Serve(GameState s, MvpRules r, List<Cause> why)
+ {
+ foreach (var u in s.Units.Values.ToList())
+ {
+ if (u.Type != "recruit" || u.Side != "israel") continue;
+ var service = u.Service + 1;
+ var veteran = service >= r.VeteranSoldierService!.Value;
+ s.Units[u.Id] = new Unit(u.Id, veteran ? "veteran_soldier" : u.Type, u.Q, u.R, service,
+ u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
+ if (veteran) why.Add(new Cause("city", "units", u.Strength, "Recruits became veteran soldiers"));
+ }
+ }
+
+ /// <summary>R-UNIT-010: step 7 pays per Israeli military formation, including this turn's graduates. The national
+ /// Treasury borrows a shortfall (R-MONEY-003); upkeep never consumes Arms (Q-UNIT-3).</summary>
+ public static void PayUpkeep(Content c, GameState s, MvpRules r, List<Cause> why)
+ {
+ var count = s.Units.Values.Count(u => u.Side == "israel" && c.UnitTypes.Any(t => t.Id == u.Type && t.Side == "israel"));
+ var cost = count * r.MilitaryUpkeepPerTurn!.Value;
+ if (cost == 0) return;
+ why.Add(new Cause("economy", "treasury", -cost, $"{PlayerText.Change(c, "treasury", -cost)} (military upkeep)"));
+ EconomySystem.PayOrBorrow(c, s, cost, "for military upkeep", why);
+ }
+ }
+}
diff --git a/sim/Statecraft.Sim/Movement.cs b/sim/Statecraft.Sim/Movement.cs
index da630f5dd..d03921d85 100644
--- a/sim/Statecraft.Sim/Movement.cs
+++ b/sim/Statecraft.Sim/Movement.cs
@@ -73,7 +73,7 @@ namespace Statecraft.Sim
// is given, with the hex it names), so a unit that goes out and comes back the same turn is not fortified; hold moves with
// the unit. The order step at the end of the turn only sees the final hex.
var fortified = u.Order == "fortify" || u.Order == "fortifying";
- s.Units[unitId] = new Unit(u.Id, u.Type, q, r, u.Service, u.Side, u.Strength, fortified ? "" : u.Order, fortified ? "" : u.OrderTarget);
+ s.Units[unitId] = new Unit(u.Id, u.Type, q, r, u.Service, u.Side, u.Strength, fortified ? "" : u.Order, fortified ? "" : u.OrderTarget, u.HomeCity);
spent[unitId] = used + cost;
why.Add(new Cause("map", unitId.ToString(CultureInfo.InvariantCulture), cost,
FormattableString.Invariant($"Unit {unitId} moved to hex {q},{r} for {cost} movement points"), enemy ? Kind : ""));
diff --git a/sim/Statecraft.Sim/Orders.cs b/sim/Statecraft.Sim/Orders.cs
index e8501d247..a011e16ef 100644
--- a/sim/Statecraft.Sim/Orders.cs
+++ b/sim/Statecraft.Sim/Orders.cs
@@ -24,7 +24,7 @@ namespace Statecraft.Sim
static string Hex(Unit u) => string.Format(CultureInfo.InvariantCulture, "{0},{1}", u.Q, u.R);
static Unit With(Unit u, string order, string target) =>
- new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, order, target);
+ new Unit(u.Id, u.Type, u.Q, u.R, u.Service, u.Side, u.Strength, order, target, u.HomeCity);
/// <summary>R-ORDER-001's refusals: null when <see cref="Give"/> takes the order, else the reason shown to the player.
/// Changes nothing: the unit card asks it before it offers fortify or hold (#754). Refused for an unknown order or
diff --git a/sim/Statecraft.Sim/Projects.cs b/sim/Statecraft.Sim/Projects.cs
index 0dd2b9588..e007e5879 100644
--- a/sim/Statecraft.Sim/Projects.cs
+++ b/sim/Statecraft.Sim/Projects.cs
@@ -91,7 +91,7 @@ namespace Statecraft.Sim
if (u.Type == "halutz")
{
var service = u.Service + 1;
- u = new Unit(u.Id, service >= r.VeteranHalutzService!.Value ? VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ u = new Unit(u.Id, service >= r.VeteranHalutzService!.Value ? VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
}
}
}
@@ -234,7 +234,7 @@ namespace Statecraft.Sim
if (u.Type != "halutz") continue;
var service = u.Service + 1;
var promoted = service >= r.VeteranHalutzService!.Value;
- s.Units[u.Id] = new Unit(u.Id, promoted ? VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ s.Units[u.Id] = new Unit(u.Id, promoted ? VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
if (promoted) why.Add(new Cause("map", w.Site, 1, "A group of halutzim became veteran pioneers"));
}
Corridors.Advance(c, s, next, why); // R-COR-002: after the sites (Phase 4 PR 2)
diff --git a/sim/Statecraft.Sim/SettlementControl.cs b/sim/Statecraft.Sim/SettlementControl.cs
index 0af56dfdb..156b05bdf 100644
--- a/sim/Statecraft.Sim/SettlementControl.cs
+++ b/sim/Statecraft.Sim/SettlementControl.cs
@@ -111,7 +111,7 @@ namespace Statecraft.Sim
foreach (var (from, _) in moved) s.Units[from.Id] = from; // back as it was
return $"Unit {u.Id} has no free hex next to {name} to withdraw to";
}
- var w = new Unit(u.Id, u.Type, to.Value.Q, to.Value.R, u.Service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ var w = new Unit(u.Id, u.Type, to.Value.Q, to.Value.R, u.Service, u.Side, u.Strength, u.Order, u.OrderTarget, u.HomeCity);
s.Units[u.Id] = w;
moved.Add((u, w));
}
diff --git a/sim/Statecraft.Sim/Training.cs b/sim/Statecraft.Sim/Training.cs
index a5822b6f9..f57fec1e8 100644
--- a/sim/Statecraft.Sim/Training.cs
+++ b/sim/Statecraft.Sim/Training.cs
@@ -81,9 +81,8 @@ namespace Statecraft.Sim
var cost = count * type.TrainingCost;
// Owner decision "Allow borrowing" (2026-10-15, #468 question 1): a short Treasury borrows, as map actions do.
EconomySystem.PayOrBorrow(c, s, cost, "for training", why);
- // PLACEHOLDER (owner question, #377): trainees leave the civilians, and housing (R-CITY-004) counts civilians only,
- // so their places are free for waiting refugees while they train. Social cohesion (R-CITY-005) also moves: its
- // employed share is employed over civilians, so it rises when civilians without work leave for training.
+ // R-HOUSE-003: trainees remain housed as a cohort, and recruits keep their home city's housing as formations.
+ // A pioneer unit leaves city housing; a craftsman remains. The employed share also reads the new counts.
s.Cities[city] = x.WithCounts(x.Civilians - count, x.Employed, x.Refugees);
var id = s.NextId++;
// The plan's reading of D-A6, not part of the owner's ruling: the turn of the order is the first training turn, so
@@ -122,8 +121,8 @@ namespace Statecraft.Sim
}
/// <summary>R-TRAIN-003, step 4 of the turn (spec 2026-10-12 section 2.3, D-A6): in ascending id, each cohort has one turn
- /// less to go. One that reaches 0 leaves the state: recruits and craftsmen join the city's counts (R-CRAFT-001), and
- /// halutzim become one movable unit per group at the city's settlement hex, taking the next ids in turn.</summary>
+ /// less to go. One that reaches 0 leaves the state: a recruit cohort becomes one military formation with its count
+ /// as strength (R-UNIT-003), craftsmen join the city's count, and halutzim become one unit per group at its hex.</summary>
public static void Progress(Content c, GameState s, List<Cause> why)
{
foreach (var k in s.Cohorts.Values.ToList())
@@ -132,7 +131,14 @@ namespace Statecraft.Sim
s.Cohorts.Remove(k.Id);
var type = c.UnitTypes.First(t => t.Id == k.Type);
var name = PlayerText.Settlement(c, k.City);
- if (type.Kind == "unit")
+ if (type.Id == "recruit")
+ {
+ var hex = c.SettlementHexes.First(h => h.Id == k.City);
+ var id = s.NextId++;
+ s.Units.Add(id, new Unit(id, type.Id, hex.Q, hex.R, side: type.Side, strength: k.Count, homeCity: k.City));
+ why.Add(new Cause("city", k.City, k.Count, $"{name}: {Groups(k.Count)} finished {Course(type.Facility)} and are recruits"));
+ }
+ else if (type.Kind == "unit")
{
var hex = c.SettlementHexes.First(h => h.Id == k.City); // every settlement has one (ValidateMap)
for (int i = 0; i < k.Count; i++) { var id = s.NextId++; s.Units.Add(id, new Unit(id, type.Id, hex.Q, hex.R)); }
@@ -144,12 +150,6 @@ namespace Statecraft.Sim
s.Cities[k.City] = x.WithCraftsmen(x.Craftsmen + k.Count);
why.Add(new Cause("city", k.City, k.Count, $"{name}: {Groups(k.Count)} finished {Course(type.Facility)} and are craftsmen"));
}
- else
- {
- var x = s.Cities[k.City];
- s.Cities[k.City] = x.WithRecruits(x.Recruits + k.Count);
- why.Add(new Cause("city", k.City, k.Count, $"{name}: {Groups(k.Count)} finished {Course(type.Facility)} and are recruits"));
- }
}
}
}
diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.cs
index 90c640f5b..fcdda6d2e 100644
--- a/sim/Statecraft.Sim/TurnResolver.cs
+++ b/sim/Statecraft.Sim/TurnResolver.cs
@@ -19,6 +19,7 @@ namespace Statecraft.Sim
Combat.Resolve(c, s, why); // 2. combat, in ascending attacker id (R-COMBAT-002)
SettlementControl.Capture(c, s, next, why); // 3. capture, in ordinal settlement id (R-CTRL-004, R-CTRL-005)
Orders.Settle(s, why); // 3b. after combat: fortify given this turn is set, and lost where a unit left its hex (R-ORDER-002)
+ Military.Serve(s, r, why); // service by formations already in play, before graduation
Training.Progress(c, s, why); // 4. training
Projects.Advance(c, s, next, why); // 5. construction
Projects.AdvanceCity(c, s, next, why); // and the city projects (R-PROJ-003)
@@ -27,6 +28,7 @@ namespace Statecraft.Sim
Pools.Consume(c, s, r, why); // 7. consumption: the nation eats, then imports (R-FOOD-002)
Prisoners.Upkeep(c, s, r, why); // then the prisoners eat, and the soldiers held are paid for (R-POW-002, R-POW-005)
EconomySystem.PayCivilianUpkeep(c, s, r, yearFraction, why); // and pays Money upkeep (R-MONEY-002)
+ Military.PayUpkeep(c, s, r, why); // military formations pay Money, never Arms (R-UNIT-010)
Cities.House(c, s, r, why); // 8. housing, then the housing condition; Social cohesion is morale, which the effects web moves after the resolution
Cities.UpdateCondition(c, s, r, why);
Cities.Arrive(c, s, r, next, why); // 9. arrivals
diff --git a/tools/web_check.py b/tools/web_check.py
index 620f70602..56191b5dd 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 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"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK hash1950 f3ec68b734a3beb24df9a873e0400f0253aed48f3cde2ea12415f1890dcaa5b0" --expect "GOLDEN OK hash1952 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0b"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "smoke-orders" --expect "SMOKE ORDERS OK 1948-06-15 ee6bfee561120532416c1aff2cd7cd741256aaafb443d19b414031356b680ae6"
(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),