Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

sim: the national Arms pool, bought with Money and used by recruit training (R-ARMS-001 to R-ARMS-003, fixes #781) (#1047)

Beri15f1250585a3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae5a5cfd3..2eccad0bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -18,6 +18,13 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
- The Cabinet, Budget, Defence, Why, How to play and Settings screens each gain an X in the header that closes
them (the same close as Escape): a phone has no Escape key, and re-tapping the lit rail button was the only way
out (v0.1.1 playtest feedback).
+- The national Arms pool in the GDD loop (R-ARMS-001 to R-ARMS-003; fixes #781): one Arms is the equipment package for a
+ 1,000-person recruit group, and the state holds 12 on 15 May 1948. A `BuyArms(count)` order pays IL 1m an Arms,
+ borrows a short Treasury and costs 1 Attention whatever the count; recruit training takes 1 Arms a group when it
+ starts and is refused with a reason without one; cancelling the group gives those Arms back (#1047). The owner
+ approved all four values (#781); they are labelled design values. An event option can also move the stock with an
+ `arms` effect, in whole units and never below 0, and the no-gain rule for sensitive events covers it (R-EFX-001,
+ R-EFX-002); no event uses it yet. The goldens move only by the new `arms=12` line.
## [0.1.2] - 2026-10-19
diff --git a/content/rules.yaml b/content/rules.yaml
index e439446c2..de0821cdd 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -19,6 +19,7 @@ attention_cost:
stop_work: 0 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6: unit orders are free)
start_project: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6, D-C5, Q-PROJ-5: the map action's cost)
cancel_project: 0.5 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6, D-C5, Q-PROJ-5: cancel_training's cost)
+ buy_arms: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6, D-G6, #781: one order, whatever the quantity)
# Turn length on each security rung, rungs 1 to 5 (R-TURN-001). The GDD MVP plays monthly turns on every rung (D-B1), so
# turns from 15 May 1948 end on the 15th of each month.
turn_lengths: [month, month, month, month, month]
@@ -74,6 +75,13 @@ mvp:
# about what the legacy direct cut (fx_crisis_food_per_year) took over the same weeks. Neither is a historical figure.
k_food: 0.1 # DESIGN VALUE: owner-set balance, not a historical figure (D-C2: food_supply lost with an empty Food stock)
cover_months: 3 # DESIGN VALUE: owner-set balance, not a historical figure (D-C2: months of need a full Food stock holds)
+ # The national Arms pool (R-ARMS-001 to R-ARMS-003; D-G6). The owner approved these values on 18 October 2026 (#781:
+ # "Approve as drafted"; the balance pass, #813, may tune them). One Arms is the equipment package for one recruit group of
+ # people_per_unit (1,000) people, so training takes 1 a group. The reasoning, and the AI-drafted historical cross-check a
+ # person still has to check, are in research_notes/GDD phase 2/arms-values-draft.md.
+ 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)
# 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/schema/event.schema.json b/content/schema/event.schema.json
index 87cc045be..ca6d990b4 100644
--- a/content/schema/event.schema.json
+++ b/content/schema/event.schema.json
@@ -114,7 +114,7 @@
"additionalProperties": false,
"required": ["target", "delta"],
"properties": {
- "target": { "type": "string", "minLength": 1, "description": "An indicator id from model.yaml, or a special target: treasury or fx_reserves (game money), food (the national Food stock, whole units; the Arms target arrives with its pool, #781)." },
+ "target": { "type": "string", "minLength": 1, "description": "An indicator id from model.yaml, or a special target: treasury or fx_reserves (game money), food (the national Food stock, whole units) or arms (the national Arms stock, whole units; #781)." },
"delta": { "type": "number" }
}
}
diff --git a/docs/GDD.md b/docs/GDD.md
index 54f9ecb68..98a152bdf 100644
--- a/docs/GDD.md
+++ b/docs/GDD.md
@@ -50,7 +50,7 @@ The player can choose ministers. TBD: minister roles, available candidates, appo
| Resource or parameter | Role | Still to define |
|---|---|---|
| Money | Funds development and other paid actions. Craftsmen earn more money. | Income per job, construction costs and upkeep. |
-| Arms | Available military equipment. | Decided, D-G6: "From events (sourced arms deals) and Money. Training and attacks consume it" ([impact plan §5](superpowers/specs/2026-10-12-gdd-v0.1-impact-and-plan.md)). Open, asked of Amir ([#856](https://github.com/eyalgolan/statecraft-israel/pull/856#issuecomment-6231351946), #781): the stock on 15 May 1948 and what one unit is, the price in IL millions, Arms per recruit, and the Attention cost of the buy order. Whether replacements consume it is open. |
+| Arms | Available military equipment. | Decided, D-G6: "From events (sourced arms deals) and Money. Training and attacks consume it" ([impact plan §5](superpowers/specs/2026-10-12-gdd-v0.1-impact-and-plan.md)). The four numbers asked on #856 and #781 are set (owner, 18 October 2026, #781: "Approve as drafted"), labelled design values in `rules.yaml`: one Arms is the equipment package for one 1,000-person recruit group, 12 Arms on 15 May 1948, IL 1m an Arms, 1 a recruit group, and 1 Attention for the buy order whatever the quantity (R-ARMS-001 to R-ARMS-003). Whether replacements consume it is open. |
| Food | Available food supply. | Production, imports, consumption and storage; stockpile or supply capacity. |
| Social cohesion (לכידות חברתית) | National parameter describing cohesion in society. Proposed influences include housing, employment and shortages. | Scale, thresholds and gameplay effects; effects of military decisions and events. |
| International Support | National parameter describing support from other countries. Proposed influences include military decisions and events. | Scale, thresholds and gameplay effects. |
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 6b7715bcd..08ada636d 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -19,10 +19,10 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r
"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression 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 9922495a92307f87d7b5338cd8501fb60ad0424ea6b19ef2d1ec55c44a8bdfb8"
- # and "GOLDEN OK hash1952 722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08"
+ # one GOLDEN OK line per manifest golden (#394), e.g. "GOLDEN OK hash1950 4f1202cfa20e1f3cc7521c7b3baac386330b77fdbacc25928d781b1659747340"
+ # and "GOLDEN OK hash1952 283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2"
uv run tools/web_check.py unity/Builds/Web-gzip --query "golden&smoke=5" "${golden_expect[@]}" \
- --expect "SMOKE OK 5 turns 1948-10-15 3005405d64abc6e7418fa1f0d35c36ce5f64ed3af7c5a4c24a73d5dfdb16121f"
+ --expect "SMOKE OK 5 turns 1948-10-15 8d000459d26a08a49583adfc88c14799ce6e6f653dcecff1e30b5e737f0959aa"
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
@@ -48,7 +48,7 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r
"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression 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 3005405d64abc6e7418fa1f0d35c36ce5f64ed3af7c5a4c24a73d5dfdb16121f"
+ --expect "SMOKE OK 5 turns 1948-10-15 8d000459d26a08a49583adfc88c14799ce6e6f653dcecff1e30b5e737f0959aa"
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/WRITING_EVENTS.md b/docs/WRITING_EVENTS.md
index b7471d611..85ba88b11 100644
--- a/docs/WRITING_EVENTS.md
+++ b/docs/WRITING_EVENTS.md
@@ -78,18 +78,19 @@ Write plain description. Do not put words in anyone's mouth: no invented quotes
Tags are free-form, but these five are sensitive (checked without regard to case): `holocaust`, `terror`, `massacre`,
`war-casualties`, `displacement`. An event with any of them:
-- cannot give a positive delta to any resource in any option: `treasury`, `fx_reserves`, `food`, `food_supply`, `morale`
- (standing for Social cohesion) or `intl_standing` (standing for International Support). The loader refuses: it would
- reward the atrocity. Owner decision of 15 October 2026 (Q-EFX-2, "Extend it"); until then the rule covered money only;
+- cannot give a positive delta to any resource in any option: `treasury`, `fx_reserves`, `food`, `arms`, `food_supply`,
+ `morale` (standing for Social cohesion) or `intl_standing` (standing for International Support). The loader refuses:
+ it would reward the atrocity. Owner decision of 15 October 2026 (Q-EFX-2, "Extend it"); until then the rule covered
+ money only;
- needs `status: sensitivity-reviewed` before any build is shared. That status is set by the maintainer, not by you.
Submit it as `fact-checked`. `Statecraft.Cli --release-gate`, the `-shareable` build and `tools/package_release.py`
refuse to release while any sensitive event is not `sensitivity-reviewed`, and a test requires every sensitive event
in `content/` to carry exactly that status once reviewed.
For `displacement`, the no-gain rule has no exception: no option may raise Money, Food, Arms, Social cohesion,
-International Support or score (R-EFX-007). Arms and score are not event-effect targets yet, so the loader already
-refuses them as unknown; do not add either target to an event. The rule applies when those targets exist. No event in
-`content/` uses `displacement` yet.
+International Support or score (R-EFX-007). Score is not an event-effect target yet, so the loader already refuses
+it as unknown; do not add it to an event. The rule applies when that target exists. No event in `content/` uses
+`displacement` yet.
The other tag used so far is `security`. It has no rule attached.
@@ -254,9 +255,9 @@ An option that did not happen can say who put it forward, and on what record (R-
- `treasury` or `fx_reserves`, in game money;
- `food`, the national Food stock, in whole units (one unit is one population unit's food for a month). The delta
rounds to whole units and the stock never drops below 0, so a larger cut than the stock takes what is there. The
- Arms stock becomes a target with its pool (#781). Note that the monthly import (R-FOOD-002) refills the stock to
- `cover_months` of the need unless the foreign-currency crisis is on, so outside a crisis a cut only matters if it
- leaves less than one month's need; a gain stays.
+ Arms stock becomes a target with its pool (#781): `arms` moves it the same way. Note that the monthly import
+ (R-FOOD-002) refills the stock to `cover_months` of the need unless the foreign-currency crisis is on, so outside a
+ crisis a cut only matters if it leaves less than one month's need; a gain stays.
`delta` must be a finite number. Any other target is an error. Policy ids (`rationing`, ...) are not effect targets;
use `set_policy` for those.
@@ -339,8 +340,8 @@ Errors are printed as `file: field: message`. These are the messages you are mos
| `at least one option required` | `options` is empty. |
| `at most one option can be historical` | Two options have `historical: true`. |
| `hard anchor needs a historical option` | `anchor: hard` and no option is `historical`. |
-| `unknown target` | An effect `target` is neither an indicator nor `treasury`, `fx_reserves` or `food`. |
-| `sensitive events cannot reward` | A sensitive-tagged event with a positive `treasury`, `fx_reserves`, `food`, `food_supply`, `morale` or `intl_standing` delta. |
+| `unknown target` | An effect `target` is neither an indicator nor `treasury`, `fx_reserves`, `food` or `arms`. |
+| `sensitive events cannot reward` | A sensitive-tagged event with a positive `treasury`, `fx_reserves`, `food`, `arms`, `food_supply`, `morale` or `intl_standing` delta. |
| `must be 1-5` | `set_rung` outside 1 to 5. |
| `unknown policy` | `set_policy` names a policy that does not exist. |
| `needs the GDD loop` | `grant_units` or `city_effects` in content that runs the legacy loop. |
diff --git a/docs/determinism.md b/docs/determinism.md
index de1a4b575..6ff56205c 100644
--- a/docs/determinism.md
+++ b/docs/determinism.md
@@ -28,9 +28,9 @@ final `GameState.Hash()` is pinned:
| Run | Ends | Hash |
|---|---|---|
-| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `9922495a92307f87d7b5338cd8501fb60ad0424ea6b19ef2d1ec55c44a8bdfb8` |
-| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08` |
-| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08` |
+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `4f1202cfa20e1f3cc7521c7b3baac386330b77fdbacc25928d781b1659747340` |
+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2` |
+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2` |
`hash1952` stops at the first turn on or after 1 January 1952, which is the game's last turn, so it is the same run as
`mvp-end` (`DeterminismTests.TheWholeGameToItsEndIsFixed`). Both names are kept (spec 2026-10-12 section 3 step 6): a
@@ -39,7 +39,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 3005405d64abc6e7418fa1f0d35c36ce5f64ed3af7c5a4c24a73d5dfdb16121f`.
+ministers): `SMOKE OK 5 turns 1948-10-15 8d000459d26a08a49583adfc88c14799ce6e6f653dcecff1e30b5e737f0959aa`.
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:
@@ -50,7 +50,7 @@ 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 3005405d64abc6e7418fa1f0d35c36ce5f64ed3af7c5a4c24a73d5dfdb16121f"
+ --expect "SMOKE OK 5 turns 1948-10-15 8d000459d26a08a49583adfc88c14799ce6e6f653dcecff1e30b5e737f0959aa"
```
**When a golden moves.** The test fails with the lines that changed, grouped by section (`[ind]`, `[pol]`, `[bud]`,
@@ -298,3 +298,11 @@ The hash reads the state keys, so it never sees a record outside its window. An
| #457 item 9 (official records) | 1952 | `722d90a2` | owner ruling "Follow the official records" (18 October 2026, #457): `education_registration_1951` opens on 12 February 1951, its first cited plenum record (was 29 November 1950), so the card fires on 15 February 1951 instead of 15 December 1950 and its morale cost lands two turns later. At the end only coalition stability moves (0.443222 to 0.443592). The same PR's Education vacancy from 19 May to 8 October 1951 (item 8) and the 14 May 1948 start (item 2, unchanged) move no golden: measured with the event date as before (was `548a6acc`) |
| #457 item 9 (official records) | mvp-end | `722d90a2` | same; the same run as hash1952 (was `548a6acc`) |
| #457 item 9 (official records) | scenario-mvp-defeat | `19143463` | same card date; at the end only coalition stability moves (0.457037 to 0.457407), and the scenario still ends in `defeat_economy` on 15 January 1952 (was `d1e0dcf6`) |
+| GDD Phase 2 PR 3b | 1950 | `4f1202cf` | the national Arms pool (R-ARMS-001 to R-ARMS-003, #781; owner, 18 October 2026: "Approve as drafted"): the new `arms=` line, 12 at the start. The reference player trains no recruits and buys no Arms, so it stays 12 and nothing else moves (was `9922495a`) |
+| GDD Phase 2 PR 3b | 1952 | `28334950` | same; `arms=12` at the end (was `722d90a2`) |
+| GDD Phase 2 PR 3b | mvp-end | `28334950` | same; the same run as hash1952 (was `722d90a2`) |
+| GDD Phase 2 PR 3b | smoke5 | `8d000459` | same; `arms=12` (was `3005405d`) |
+| GDD Phase 2 PR 3b | scenario-cautious | `a6108c91` | same; no scenario trains recruits or buys Arms, so `arms=12` (was `6507ddc3`) |
+| GDD Phase 2 PR 3b | scenario-reckless | `a0f094a1` | same (was `8041988a`) |
+| GDD Phase 2 PR 3b | scenario-mvp-absorb-first | `dee4f039` | same (was `be13c409`) |
+| GDD Phase 2 PR 3b | scenario-mvp-defeat | `e71076f7` | same; the defeat run is unchanged apart from `arms=12` (was `19143463`) |
diff --git a/docs/gdd/cutover-resource-layer.md b/docs/gdd/cutover-resource-layer.md
index 35b908261..d6c667a82 100644
--- a/docs/gdd/cutover-resource-layer.md
+++ b/docs/gdd/cutover-resource-layer.md
@@ -14,6 +14,7 @@ As a player of the MVP, I want the real game to switch to the GDD loop with mont
- Food and Arms are national pools, whole numbers (D-C2, decided 15 October 2026 [S2]). Arms comes from sourced arms-deal events and from Money, and training and attacks consume it (D-G6, decided 15 October 2026 [S2]).
- One unit of Food is one population unit's food for a month. The nation eats its head count in units each turn, and a monthly import keeps the stock at a set number of months of cover, except while foreign currency is exhausted, when nothing is imported. The stock never goes below zero, and the share left unmet is kept (`Q-POOL-2`, `Q-POOL-4` and `Q-POOL-5`, decided 15 October 2026 [S3]; R-FOOD-001 and R-FOOD-002).
- Food supply stays the zero-to-one level the screens and events read. It carries a term from the months of cover: none at a full stock, the most when the stock is empty, and the unmet share lowers it further; rationing and events still act on top (the maintainer's food rule, 16 October 2026 [S6]; R-FOOD-003). The two numbers, `k_food` and `cover_months`, are labelled design values.
+- One unit of Arms is the equipment package for a recruit group of 1,000 people. The stock starts at 12 units, a `BuyArms` order adds units at IL 1m each and borrows a short Treasury, and recruit training takes 1 unit a group (R-ARMS-001 to R-ARMS-003). These numbers and the buy order's cost of 1 attention are labelled design values the owner approved [S7].
- Social cohesion is the `morale` indicator on its zero-to-one scale, shown to the player as Social cohesion, its thresholds as situations, and International Support is the `intl_standing` indicator on its zero-to-one scale, under its player name (D-C1, decided 15 October 2026 [S2]; proposed R-NAT-001 and R-NAT-003).
- An event option's effects may target Money, Food, Arms, Social cohesion and International Support; any other target is a load error (proposed R-EFX-001 [S2]). An option tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise any of the five resources or foreign currency unless the same option carries a matching cost (the sensitive-option answer of 15 October 2026 [S2]; proposed R-EFX-002). The owner chose to add a real cost: the check is a net of zero or less across the five resources, with the cost falling on a different resource than the gain (owner, 15 October 2026 [S3]; the plan [S2]).
- The historical run has at most six months without any event, and at most two months in wartime, the full-war level of the war state counting as wartime (owner, 15 October 2026 [S3] and [S4]; the gap rule, docs/m3-rulings.md). Five war event cards are rewritten as decisions taken during or after the event, and the first truce and Rhodes cards are accepted as arriving late (`Q-CUT-3`, "Mixed" [S2]). The Altalena card opens on 15 June 1948 without the Kfar Vitkin clause, and the Ten Days card is rewritten (the owner on #567, recorded in the plan [S2]). Cards whose text changed go back to `fact-checked` until the owner re-reviews them (`Q-CUT-4`, decided 15 October 2026 [S3]).
@@ -50,6 +51,7 @@ As a player of the MVP, I want the real game to switch to the GDD loop with mont
- [S4] The owner's decisions recorded on #375, 15 October 2026, https://github.com/eyalgolan/statecraft-israel/issues/375#issuecomment-6183538544, checked 2026-10-15
- [S5] The owner's answers on #375, 15 October 2026, https://github.com/eyalgolan/statecraft-israel/issues/375#issuecomment-6178976670, checked 2026-10-15
- [S6] The maintainer's food rule on #382, 16 October 2026 (option (b)), https://github.com/eyalgolan/statecraft-israel/issues/382#issuecomment-6213237277, checked 2026-10-16
+- [S7] The owner's decision on #781, 18 October 2026, "Approve as drafted", https://github.com/eyalgolan/statecraft-israel/issues/781#issuecomment-6251995002, checked 2026-10-18
## Open questions
diff --git a/docs/gdd/training.md b/docs/gdd/training.md
index 42e473775..98c7c71a5 100644
--- a/docs/gdd/training.md
+++ b/docs/gdd/training.md
@@ -10,6 +10,7 @@ As a player of the MVP, I want to send Tel Aviv's civilians without work to basi
- Pioneers build more: `PioneerWork(unit, build_camp, site)` at a camp site takes 6 turns and IL 2m, labelled design values an agent proposed and the owner accepted (#927; the balance pass, #813, may tune them), and follows the yishuv build's rules. Built, the site's city has the facility from the next turn, with no capacity limit (`Q-CAMP-1`, `Q-CAMP-3` [S4]) (R-CAMP-001).
- The camp sites are `Camp 80` near Pardes Hanna, for Hadera, and Tzrifin, for Rishon LeZion, both military camps (`Q-CAMP-2` [S5]; owner, "Both military", #927). A camp serves the city nearest by hex, and a tie goes to the nearest by km (R-CAMP-002). Both rows are drafts: their sources were read by AI agents for the research note, and Tzrifin's exact position and a GIS clearance are still gaps.
- `Train(city, track, n)` takes civilians without a job into training as recruits (military camp) or halutzim (Hakhshara). It costs 1 Attention and IL 0.5m per group, both placeholders, paid at once. A short Treasury borrows the rest, as map actions do (owner decision on #468) (R-TRAIN-001).
+- Basic training takes 1 unit of Arms a group when it starts, a design value the owner approved (#781); too few Arms refuses the order with a reason, and cancelling the group returns its Arms to the pool (owner, #1047). Pioneer training takes no Arms (R-ARMS-003).
- It is refused, with the state unchanged, for fewer than 1 group (unitless), more than the city's civilians without a job, an unknown city or track, a city without the facility, or the legacy loop (R-TRAIN-001).
- People in training are neither civilians nor recruits: they hold no job and are not counted by housing or Social cohesion while they train.
- `CancelTraining(cohort)` returns the people as civilians without a job; the Money spent is not returned (D-A3 [S2]). It costs 0.5 Attention, a placeholder (R-TRAIN-002).
@@ -31,7 +32,7 @@ As a player of the MVP, I want to send Tel Aviv's civilians without work to basi
## Out of scope
-- The start camps of Jerusalem (Schneller) and Petah Tikva (Tel HaShomer), which the owner ruled the cities already have (#375); this PR keeps the start facilities as they are. Training capacity, recruits as units and combat (Phase 5), veterans, craftsmen (D-D4), Arms consumed by training (D-G6), and any display (PRs 7 and 8).
+- The start camps of Jerusalem (Schneller) and Petah Tikva (Tel HaShomer), which the owner ruled the cities already have (#375); this PR keeps the start facilities as they are. Training capacity, recruits as units and combat (Phase 5), veterans, craftsmen (D-D4), and any display (PRs 7 and 8).
## Sources
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 6406e8a9f..53f4fdf78 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -90,7 +90,7 @@ Training is step 4 of the turn in the approved order (§2.3, D-A6): it runs befo
R-TRAIN-001: `Train(city, track, n)` takes `n` of the city's civilians without a job into a cohort that trains as `track` (a unit type with a `facility`: `recruit` in a military camp, `halutz` in a Hakhshara, `craftsman` at industry, R-CRAFT-001) for the type's `training_turns`, counting the turn it was ordered in. The Treasury pays `n * training_cost` at once. When the Treasury holds less, the shortfall is borrowed, as for map actions: it is added to the debt and the Treasury stops at 0 (owner decision "Allow borrowing", 15 October 2026). The trainees leave the civilians at once; the cohort takes the next id, which units share. It is refused, with the state unchanged and the Attention refunded, when the city or track is unknown, `n` is below 1, the city lacks the facility, or it has fewer civilians without a job. A city has a facility when `cities.yaml` gives it one at the start or a camp site of that kind built for it is in the state (R-CAMP-001). The legacy loop refuses it before charging Attention.
-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 cohort that does not exist, or has finished, is refused with the state unchanged.
+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.
@@ -172,6 +172,16 @@ R-FOOD-002: In step 7 the nation eats the turn's need from the stock as far as i
R-FOOD-003: `food_supply` stays the 0 to 1 level the UI, the situations and the events read (Q-POOL-3, decided 15 October 2026), with a stock term inside its effect sum: `k_food * (stock - full) / full - unmet / need`, where `full` is `cover_months` of the last need. The term is exactly 0 at a full stock, `-k_food` when the stock is empty, and the unmet share lowers it further; rationing, the other effects and event shifts act on top as before, and the level's clamp to 0..1 bounds the result. The GDD loop requires the `food_supply` indicator.
+## Arms
+
+The national Arms pool (D-G6, decided 15 October 2026: "From events (sourced arms deals) and Money. Training and attacks consume it"). The four numbers are the owner's (18 October 2026, #781: "Approve as drafted"); each is a labelled design value in `rules.yaml`, and the balance pass (#813) may tune them. An event can move the Arms stock (R-EFX-001, R-EFX-002), and the Arms an attack spends is Phase 5 (Q-COMBAT-4).
+
+R-ARMS-001: Arms is a national stock of whole units (`GameState.Arms`, hashed as `arms=` only when not 0); one Arms is the equipment package for one recruit group of `people_per_unit` (1,000) people. A new game starts the stock at `arms_start` (12). It never goes below 0. `arms_start`, `arms_price` and `arms_per_recruit_group` are required in the GDD loop (`rules.yaml` `mvp:`); a missing or negative value is a load error.
+
+R-ARMS-002: `BuyArms(count)` adds `count` units to the stock at once, with no delivery delay, and the Treasury pays `count * arms_price` (IL 1m an Arms), borrowing what it lacks (R-MONEY-003). It is refused, state and Attention unchanged, for fewer than one unit or a stock that would pass a whole number's range; the legacy loop refuses it before charging Attention. Its Attention cost is `attention_cost.buy_arms` (1), whatever the count.
+
+R-ARMS-003: Recruit training (R-TRAIN-001) takes `arms_per_recruit_group` (1) Arms for each group when it starts, after its other checks and before it pays. A stock short of that refuses the order with a reason naming the need and the stock, state and Attention unchanged (Q-UNIT-3). Pioneer training takes no Arms. The cohort keeps the Arms it took, and the state hash writes them with it; cancelling the cohort (R-TRAIN-002) returns them to the pool, up to the most the stock can hold, although the Money stays paid (owner, 18 October 2026, #1047: "Refund on cancel").
+
## Defeat
The game can be lost (D-B5, decided: "Money and Food exhausted for N turns, or a war loss. Values for the owner. Coalition collapse is off in the MVP"; Phase 7 PR 5, #8). This part covers the economic defeat; the war loss waits for Phase 5's enemy units (#749). The defeat texts are the owner's pick (Q-DEF-4, #784, open): until then the game ends with the code `defeat_economy`, and its reason reads "Money and Food ran out", the plan's short option (a).
@@ -200,11 +210,11 @@ R-NAT-003: International Support is the 0 to 1 `intl_standing` indicator, shown
R-NAT-004: "Low international support" (`low_intl_support`) is a situation on `intl_standing` with the same bands and, likewise, no effect of its own (Q-NAT-3).
-R-EFX-001: An option's effect may target an indicator id from `model.yaml`, `treasury` or `fx_reserves` (game money), or `food`, the national Food stock: the effect moves the stock by whole units (the delta rounds half away from zero) and the stock never drops below 0, so a cut larger than the stock applies only to what is there. Any other target is a load error naming file and field. The Arms stock becomes a target with its pool (#781).
+R-EFX-001: An option's effect may target an indicator id from `model.yaml`, `treasury` or `fx_reserves` (game money), or `food`, the national Food stock: the effect moves the stock by whole units (the delta rounds half away from zero) and the stock never drops below 0, so a cut larger than the stock applies only to what is there. Any other target is a load error naming file and field. The Arms stock becomes a target with its pool (#781): `arms` moves it the same way.
-R-EFX-002: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed.
+R-EFX-002: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `arms`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed.
-R-EFX-007: An option of an event tagged `displacement` cannot raise Money (`treasury` or `fx_reserves`), Food (`food` or `food_supply`), Arms, Social cohesion (`morale`), International Support (`intl_standing`) or score, with no exception (Q-DEP-6(a), owner ruling of 18 October 2026). Arms and score are not event-effect targets yet and remain unknown targets under R-EFX-001; when those targets exist, this rule covers them. The tag also receives R-EFX-005's ban on unit grants and positive city effects.
+R-EFX-007: An option of an event tagged `displacement` cannot raise Money (`treasury` or `fx_reserves`), Food (`food` or `food_supply`), Arms (`arms`), Social cohesion (`morale`), International Support (`intl_standing`) or score, with no exception (Q-DEP-6(a), owner ruling of 18 October 2026). Score is not an event-effect target yet and remains an unknown target under R-EFX-001; when that target exists, this rule covers it. The tag also receives R-EFX-005's ban on unit grants and positive city effects.
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); project unlock comes with the records it acts on (#735).
diff --git a/research_notes/GDD phase 2/arms-values-draft.md b/research_notes/GDD phase 2/arms-values-draft.md
new file mode 100644
index 000000000..fde3c1367
--- /dev/null
+++ b/research_notes/GDD phase 2/arms-values-draft.md
@@ -0,0 +1,99 @@
+# The national Arms pool: the four values and their reasoning (research note, 2026-10-18)
+
+Status: the values are the owner's design values, approved on #781 on 18 October 2026 ("Approve as drafted",
+https://github.com/eyalgolan/statecraft-israel/issues/781#issuecomment-6251995002). They are in `content/rules.yaml`
+(`mvp:` and `attention_cost:`), each labelled `# DESIGN VALUE`, and the balance pass (#813) may tune them. The
+historical cross-check further down is **an AI draft: a person must check it**. None of its sources is in `content/`,
+and none carries a `checked:` date.
+
+## The approved values
+
+| # | Question (#781) | Approved value | Key |
+|---|---|---|---|
+| 1a | What one Arms is | The equipment package for one 1,000-person recruit group | (definition, R-ARMS-001) |
+| 1b | Stock on 15 May 1948 | 12 Arms | `mvp.arms_start: 12` |
+| 2 | Price | IL 1m per Arms; a short Treasury borrows the rest (R-MONEY-003) | `mvp.arms_price: 1` |
+| 3 | Arms per recruit group | 1, taken when training starts; without one the training is refused with a reason, the state unchanged and the Attention refunded (Q-UNIT-3) | `mvp.arms_per_recruit_group: 1` |
+| 4 | Attention for the buy order | 1 per order, whatever the quantity | `attention_cost.buy_arms: 1` |
+
+## Reasoning
+
+The owner gave the values, not a written rationale. What follows is how the values fit the rules already in the repo,
+written by Claude when building the pool.
+
+- **One Arms per recruit group.** A training group is one population unit, `people_per_unit` (1,000) people
+ (`Training.cs`, R-TRAIN-001). Defining one Arms as that group's equipment makes training cost exactly 1 Arms, so the
+ stock reads directly as "groups the state can still equip". Arms stays a whole number (spec §2.2).
+- **12 on 15 May 1948.** The units already on the map carry their own weapons (Q-UNIT-4). The stock is the spare
+ equipment for new recruits: 12 recruit groups, 12,000 soldiers, before the first purchase.
+- **IL 1m per Arms.** Twice a recruit group's `training_cost` (IL 0.5m) and a twentieth of `treasury_start` (IL 20m).
+ At this price buying Arms is a real Money decision: equipping a group costs IL 1.5m in all (Arms plus training).
+ This answers the draft's own caveat that at its price "Money will rarely limit Arms in play".
+- **1 Attention per order.** It matches `train`, `map_action`, `start_project` and `choose_event_option` (each 1). One
+ order buys any whole number of Arms, so the Attention cost does not scale with the amount, and with 4 Attention a
+ turn a purchase still competes with training and events.
+- Not a number, but part of the rule: a purchase arrives at once, with no delivery delay. No plan text asks for a
+ delay, and adding one would be a new rule.
+- Cancelling a recruit cohort (R-TRAIN-002) returns its Arms to the pool, though not the Money (owner, #1047,
+ 18 October 2026: "Refund on cancel").
+
+## Where the approved values differ from the AI draft
+
+The AI draft posted on #781 (https://github.com/eyalgolan/statecraft-israel/issues/781#issuecomment-6251471128)
+proposed a smaller unit. The owner approved different numbers:
+
+| # | AI draft (18 October 2026) | Approved |
+|---|---|---|
+| 1a | One unit = the weapons and basic ammunition for 100 soldiers (a tenth of a group) | One Arms = the equipment for a 1,000-person group |
+| 1b | 100 units (10 groups' equipment) | 12 Arms (12 groups) |
+| 2 | IL 0.004m a unit (alternative 0.005), derived from 1948 plan prices | IL 1m an Arms, a design value |
+| 3 | 10 units per group | 1 per group |
+| 4 | 1 Attention per order | 1 Attention per order (unchanged) |
+
+In the draft's unit, 12 Arms would be 120 units, a little above the draft's 100. The draft's price, scaled to a whole
+group's kit, would be about IL 0.037m (10 x IL 0.0037m); the approved IL 1m is about 27 times that. The approved price
+is therefore a balance value, not a historical price, which is how it is labelled.
+
+The draft chose a tenth-of-a-group unit so that attacks (Q-COMBAT-4, Phase 5, #747) could spend Arms in small whole
+amounts. With the approved unit, the Arms an attack spends is still open and is set by that PR.
+
+## Historical cross-check (AI draft, a person must check)
+
+Kept from the draft as an order-of-magnitude cross-check only. Claude read these sources on the web on 18 October
+2026. No person has checked them.
+
+1. Wikipedia, "Arms shipments from Czechoslovakia to Israel",
+ https://en.wikipedia.org/wiki/Arms_shipments_from_Czechoslovakia_to_Israel. The 14 January 1948 contract was for
+ 200 MG 34, 4,500 rifles and 50,400,000 rounds. The *Nora* arrived on 2 April 1948 with 4,500 rifles and 200
+ machine guns; the 28 April shipment brought 10,000 rifles and 1,415 machine guns. Total confirmed deliveries to
+ October 1948: 34,500 rifles and 5,515 MG 34s. The page gives no prices. It is a secondary source; it cites Morris,
+ *1948*.
+ - Against the approved stock: the two April sea shipments alone (about 14,500 rifles) are about 14 groups' rifles,
+ the same order as 12 Arms.
+2. Ben-Gurion Archive, diary, 1 February 1948 (English translation),
+ https://bengurionarchive.bgu.ac.il/en/node/15272. A procurement list with planned prices, not paid invoices:
+ "10,000 rifles 480,000", "25 million bullets 2,057,000 ($ 82.3 per thousand)", "1,500 [heavy] machine [guns]s
+ 669,000", "40,000 shells 960,000", plus 40 75 mm guns at $400,000; total $4,566,000.
+ - The draft's derivation: 100 rifles ($4,800) + 100,000 rounds ($8,230) + 4 heavy machine guns ($1,784) =
+ $14,814 per 100 soldiers. The 4 machine guns (for "a few") are Claude's assumption. At about $4.03 to the
+ Palestine pound (Claude's figure, not in the repo) that is about IL 0.0037m; at the repo's 1950-51 rate of
+ IL 0.36 per US$ (`rules.yaml`) about IL 0.0053m.
+3. Lapidot, "The Ten-Day Battle", https://www.daat.ac.il/DAAT/english/history/lapidot/34.htm. Jerusalem's weapons
+ only: 1,011 rifles and 502 sub-machine guns on 15 May 1948, attributed to Izhak Levy, *Jerusalem in the War of
+ Independence*, p. 473. City level only.
+4. Wikipedia, "Tanks of the Israel Defense Forces", https://en.wikipedia.org/wiki/Tanks_of_the_Israel_Defense_Forces.
+ States that by September 1947 the Haganah had 10,489 rifles, 702 light machine guns, 2,666 sub-machine guns and
+ 186 medium machine guns. The sentence has no direct citation on the page.
+
+Not reached: a national Haganah or IDF weapons count dated 15 May 1948; any paid contract price for the Czech deals;
+a sourced 1948 IL-to-US$ rate.
+
+## What a person must check
+
+1. Source 1's quantities and dates against Morris, *1948*, or another printed history.
+2. Source 2's figures against the Hebrew diary original, and whether the plan prices are the prices paid.
+3. Whether a national weapons count for 15 May 1948 exists (Gelber's work on arms procurement is the likely place),
+ and whether 12 spare groups' equipment is not wildly off it.
+4. The $14,814 sum (4 machine guns for "a few") and the $4.03 rate, if the balance pass (#813) wants a historical
+ anchor for the price.
+5. Any later `sources:` entry from this note needs a person's check first (CONTENT_POLICY §2).
diff --git a/sim/Statecraft.Sim.Tests/CommandGuardTests.cs b/sim/Statecraft.Sim.Tests/CommandGuardTests.cs
index 9e75c7671..7c42d9bee 100644
--- a/sim/Statecraft.Sim.Tests/CommandGuardTests.cs
+++ b/sim/Statecraft.Sim.Tests/CommandGuardTests.cs
@@ -25,6 +25,7 @@ public class CommandGuardTests
[typeof(StopWork)] = new StopWork(1),
[typeof(StartProject)] = new StartProject("housing", "tel_aviv", 1, 0),
[typeof(CancelProject)] = new CancelProject(1),
+ [typeof(BuyArms)] = new BuyArms(0), // refused (fewer than one unit), as GovernmentTests.ARefusedGddOrderRefundsItsAttention needs
};
static IEnumerable<Type> CommandTypes() =>
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index 0c7c99241..636d44c8e 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -122,6 +122,11 @@ public class DesignValuesTests
("projects.yaml", "projects[industry].capacity"),
("projects.yaml", "projects[industry].condition"),
("projects.yaml", "projects[industry].job_slots"),
+ // The national Arms pool (Phase 2 PR 3b; #781, owner 18 October 2026: "Approve as drafted").
+ ("rules.yaml", "attention_cost.buy_arms"),
+ ("rules.yaml", "mvp.arms_start"),
+ ("rules.yaml", "mvp.arms_price"),
+ ("rules.yaml", "mvp.arms_per_recruit_group"),
};
@@ -211,6 +216,7 @@ public class DesignValuesTests
Assert.Equal((100, 5, 60), (m.ObjectivePoints, m.ObjectiveBonusPerMonth, m.ObjectiveBonusCap)); // D-B6, D-B2
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(12, c.Cities.Count);
foreach (var x in c.Cities) // the listed housing and job values are the ones Cities.Init starts from
Assert.Equal(((int)x.Housing!.Value, (int)x.Jobs!.Value), (x.HousingCapacity, x.JobSlots));
diff --git a/sim/Statecraft.Sim.Tests/EventTests.cs b/sim/Statecraft.Sim.Tests/EventTests.cs
index e0e0792ba..f5213d6e6 100644
--- a/sim/Statecraft.Sim.Tests/EventTests.cs
+++ b/sim/Statecraft.Sim.Tests/EventTests.cs
@@ -117,15 +117,56 @@ options:
Assert.Contains(why, w => w.Target == "food" && w.Delta == -3);
}
- /// <summary>R-EFX-001: any target that is not an indicator, `treasury`, `fx_reserves` or `food` is a load error
- /// naming file and field. `arms` pins the boundary: the Arms stock becomes a target with its pool (#781).</summary>
+ /// <summary>R-EFX-001: an `arms` effect moves the national Arms stock (#781) as `food` moves Food: whole units,
+ /// rounding half away from zero, the stock in 0..int.MaxValue, and the cause carries the change that applied.</summary>
+ [Theory]
+ [InlineData("7", 0, 7)]
+ [InlineData("2.5", 100, 103)]
+ [InlineData("-2.5", 100, 97)]
+ [InlineData("-10", 3, 0)]
+ [InlineData("2147483647", 100, 2147483647)]
+ public void AnOptionCanMoveTheArmsStock(string delta, int start, int expected)
+ {
+ var ev = Shortage.Replace("target: fx_reserves\n delta: -10", "target: arms\n delta: " + delta);
+ var c = Load(new Dictionary<string, string> { ["shortage.yaml"] = ev });
+ var s = State(c, new DateTime(1948, 6, 1)); s.Arms = start; var why = new List<Cause>();
+ EventSystem.Trigger(c, s, why);
+ Assert.Null(EventSystem.Choose(c, s, "shortage", "import", why));
+ Assert.Equal(expected, s.Arms);
+ Assert.Contains(why, w => w.Target == "arms" && w.Delta == expected - start);
+ }
+
+ /// <summary>R-EFX-001: the event card's preview (R-EVT-005) names an Arms effect in whole units.</summary>
[Fact]
- public void AnUnknownTargetNamesTheField()
+ public void ThePreviewShowsAnArmsEffectInUnits()
{
- var ev = Shortage.Replace("target: fx_reserves", "target: arms");
+ var ev = Shortage.Replace("target: fx_reserves\n delta: -10", "target: arms\n delta: -2");
+ var c = Load(new Dictionary<string, string> { ["shortage.yaml"] = ev });
+ var s = State(c, new DateTime(1948, 6, 1));
+ var o = c.Events.Single().Options.Single(x => x.Id == "import");
+ Assert.Contains(EventSystem.OptionEffects(c, s, o), l => l.Target == "arms" && l.Delta == -2 && l.Message == "Arms -2 units");
+ }
+
+ /// <summary>R-EFX-001: an Arms delta beyond the int range is a load error naming file and field, as for Food.</summary>
+ [Fact]
+ public void AnArmsDeltaBeyondTheIntRangeIsALoadError()
+ {
+ var ev = Shortage.Replace("target: fx_reserves\n delta: -10", "target: arms\n delta: -3000000000");
var ex = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string> { ["shortage.yaml"] = ev }));
Assert.Equal("events/shortage.yaml", ex.File);
Assert.Equal("events[shortage].options[import].effects.arms", ex.Field);
+ Assert.Contains("arms delta out of range", ex.Message);
+ }
+
+ /// <summary>R-EFX-001: any target that is not an indicator, `treasury`, `fx_reserves`, `food` or `arms` is a load error
+ /// naming file and field.</summary>
+ [Fact]
+ public void AnUnknownTargetNamesTheField()
+ {
+ var ev = Shortage.Replace("target: fx_reserves", "target: steel");
+ var ex = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string> { ["shortage.yaml"] = ev }));
+ Assert.Equal("events/shortage.yaml", ex.File);
+ Assert.Equal("events[shortage].options[import].effects.steel", ex.Field);
Assert.Contains("unknown target", ex.Message);
}
@@ -499,12 +540,13 @@ options:
/// <summary>R-EFX-002 (owner decision of 15 October 2026 on Q-EFX-2, "Extend it"): a sensitive option may not raise any
/// resource. The legacy indicators stand for Food (food_supply), Social cohesion (morale) and International Support
- /// (intl_standing); `food` is Food's own target.</summary>
+ /// (intl_standing); `food` is Food's own target, and `arms` the Arms stock's (#781).</summary>
[Theory]
[InlineData("food_supply")]
[InlineData("morale")]
[InlineData("intl_standing")]
[InlineData("food")]
+ [InlineData("arms")]
public void SensitiveEventCannotRaiseFoodCohesionOrSupport(string target)
{
var ex = Assert.Throws<ContentException>(() => LoadWithStanding(Sensitive("war-casualties", target, "0.02")));
@@ -518,15 +560,17 @@ options:
[InlineData("morale", "-0.02")]
[InlineData("food", "0")]
[InlineData("food", "-5")]
+ [InlineData("arms", "0")]
+ [InlineData("arms", "-5")]
[InlineData("intl_standing", "-0.05")]
public void SensitiveEventMayCostOrNotChangeFoodCohesionOrSupport(string target, string delta)
{
Assert.Single(LoadWithStanding(Sensitive("terror", target, delta)).Events);
}
- /// <summary>R-EFX-007 (Q-DEP-6(a)): a displacement option cannot raise any available resource target. Arms and
- /// score are kept in this test as explicit boundaries: neither is an event-effect target on this HEAD, so the
- /// loader refuses them as unknown rather than inventing a target in this PR.</summary>
+ /// <summary>R-EFX-007 (Q-DEP-6(a)): a displacement option cannot raise any available resource target, Arms included
+ /// (#781). Score is kept as an explicit boundary: it is not an event-effect target yet, so the loader refuses it as
+ /// unknown.</summary>
[Theory]
[InlineData("treasury", "sensitive events cannot reward")]
[InlineData("fx_reserves", "sensitive events cannot reward")]
@@ -534,7 +578,7 @@ options:
[InlineData("food_supply", "sensitive events cannot reward")]
[InlineData("morale", "sensitive events cannot reward")]
[InlineData("intl_standing", "sensitive events cannot reward")]
- [InlineData("arms", "unknown target")]
+ [InlineData("arms", "sensitive events cannot reward")]
[InlineData("score", "unknown target")]
public void ADisplacementOptionCannotRaiseAnything(string target, string reason)
{
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index 34f6e1a16..ccc847968 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -240,7 +240,7 @@ series:
}
/// <summary>The fixture's attention_cost line with the GDD command kinds added (replaces "map_action: 1 }").</summary>
- public const string GddCosts = "map_action: 1, assign_workers: 1, train: 1, cancel_training: 1, pioneer_work: 0, stop_work: 0, start_project: 1, cancel_project: 0.5 }";
+ public const string GddCosts = "map_action: 1, assign_workers: 1, train: 1, cancel_training: 1, pioneer_work: 0, stop_work: 0, start_project: 1, cancel_project: 0.5, buy_arms: 1 }";
public const string GddRules = @"
mvp:
@@ -268,6 +268,9 @@ mvp:
objective_bonus_cap: 60
k_food: 0.1
cover_months: 3
+ arms_start: 20
+ arms_price: 0.25
+ arms_per_recruit_group: 2
veteran_halutz_service: 4
veteran_progress: 2
housing_start_condition: 0.5
diff --git a/sim/Statecraft.Sim.Tests/GddStateTests.cs b/sim/Statecraft.Sim.Tests/GddStateTests.cs
index 90b82bc51..9ea1a8391 100644
--- a/sim/Statecraft.Sim.Tests/GddStateTests.cs
+++ b/sim/Statecraft.Sim.Tests/GddStateTests.cs
@@ -67,7 +67,8 @@ public class GddStateTests
Assert.Equal(units.Length, new HashSet<string>(Array.ConvertAll(units, U)).Count);
string K(Cohort k) { var s = new GameState(); s.Cohorts.Add(k.Id, k); return s.Hash(); }
var cohorts = new[] { new Cohort(1, "recruit", "a", 1, 1), new Cohort(2, "recruit", "a", 1, 1), new Cohort(1, "halutz", "a", 1, 1),
- new Cohort(1, "recruit", "b", 1, 1), new Cohort(1, "recruit", "a", 2, 1), new Cohort(1, "recruit", "a", 1, 2) };
+ new Cohort(1, "recruit", "b", 1, 1), new Cohort(1, "recruit", "a", 2, 1), new Cohort(1, "recruit", "a", 1, 2),
+ new Cohort(1, "recruit", "a", 1, 1, arms: 1) };
Assert.Equal(cohorts.Length, new HashSet<string>(Array.ConvertAll(cohorts, K)).Count);
string W(SiteWork w) { var s = new GameState(); s.Sites[w.Site] = w; return s.Hash(); }
var works = new[] { new SiteWork("a", 1, 1, null), new SiteWork("b", 1, 1, null), new SiteWork("a", 2, 1, null), new SiteWork("a", 1, 2, null),
diff --git a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
index c15353a68..eab323f10 100644
--- a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
+++ b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
@@ -470,5 +470,12 @@ public class PlayerTextTests
var c = ContentLoader.Load(RealContentTests.ContentRoot());
Assert.Equal("Food +7 units", PlayerText.Change(c, Pools.FoodTarget, 7));
}
+
+ [Fact]
+ public void ChangeRendersTheArmsStockInUnits()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ Assert.Equal("Arms -2 units", PlayerText.Change(c, Pools.ArmsTarget, -2));
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/PoolsTests.cs b/sim/Statecraft.Sim.Tests/PoolsTests.cs
index 97727da9a..15eddda0f 100644
--- a/sim/Statecraft.Sim.Tests/PoolsTests.cs
+++ b/sim/Statecraft.Sim.Tests/PoolsTests.cs
@@ -207,4 +207,116 @@ public class PoolsTests
Assert.Equal("mvp.k_food", ex.Field);
Assert.Contains("food_supply", ex.Message);
}
+
+ // R-ARMS-001: the Arms stock starts at arms_start in the GDD loop; the legacy loop has no pool.
+ [Fact]
+ public void TheArmsStockStartsAtTheRulesValue()
+ {
+ Assert.Equal(20, Simulation.NewGame(Gdd(), 1, Mode.Historical).Arms);
+ Assert.Equal(Real.Rules.Mvp!.ArmsStart!.Value, Simulation.NewGame(Real, GoldenRun.Seed, Mode.Historical).Arms);
+ Assert.Equal(0, Simulation.NewGame(ContentLoader.Load(Fixture.Write()), 1, Mode.Historical).Arms);
+ }
+
+ // R-ARMS-001: the stock reaches the hash only when set (R-LOOP-002), and a clone does not share it.
+ [Fact]
+ public void TheArmsStockIsHashedOnlyWhenSet()
+ {
+ var legacy = Simulation.NewGame(ContentLoader.Load(Fixture.Write()), 1, Mode.Historical);
+ Assert.DoesNotContain("\narms=", legacy.Describe());
+ var s = Simulation.NewGame(Gdd(), 1, Mode.Historical);
+ Assert.Contains("\narms=20", s.Describe());
+ var other = s.Clone(); other.Arms = 19;
+ Assert.NotEqual(s.Hash(), other.Hash());
+ Assert.Equal(20, s.Arms);
+ }
+
+ // R-ARMS-002: BuyArms adds whole units at once and the Treasury pays arms_price for each.
+ [Fact]
+ public void BuyingArmsCostsMoney()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var r = Simulation.Step(c, s, new Command[] { new BuyArms(4) });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(24, r.State.Arms);
+ Assert.Equal(Step(c, s).Treasury - 4 * 0.25, r.State.Treasury, 9);
+ Assert.Contains(r.Why, x => x.System == "economy" && x.Target == "arms" && x.Delta == 4 && x.Message == "Bought 4 Arms, cost IL 1.0m");
+ Assert.Equal(1.0, c.Rules.AttentionCost["buy_arms"]); // before the rung step (R-GOV-002)
+ }
+
+ // R-ARMS-002 with R-MONEY-003: a short Treasury borrows the shortfall, as every GDD cost does.
+ [Fact]
+ public void AShortTreasuryBorrowsForArms()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Treasury = 0.5;
+ s.Debt = 3;
+ var why = new List<Cause>();
+ Assert.Null(Pools.BuyArms(c, s, 4, why));
+ Assert.Equal((0.0, 24), (s.Treasury, s.Arms));
+ Assert.Equal(3.5, s.Debt, 9);
+ Assert.Contains(why, x => x.System == "economy" && x.Target == "debt" && x.Message == "Borrowed IL 0.5m for Arms");
+ }
+
+ // R-ARMS-002: fewer than one unit is refused, the state as if the order had not been given (Attention refunded too),
+ // and so is the order in the legacy loop.
+ [Theory]
+ [InlineData(0)]
+ [InlineData(-3)]
+ public void BuyingLessThanOneUnitIsRefused(int count)
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var r = Simulation.Step(c, s, new Command[] { new BuyArms(count) });
+ Assert.Equal("Buy at least 1 Arms", Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).Hash(), r.State.Hash());
+ var legacy = ContentLoader.Load(Fixture.Write());
+ var l = Simulation.NewGame(legacy, 1, Mode.Historical);
+ Assert.Equal("That order is not available in this game", Assert.Single(Simulation.Step(legacy, l, new Command[] { new BuyArms(1) }).Rejected).Reason);
+ }
+
+ // R-ARMS-002: a purchase that would take the stock past a whole number's range is refused, never wrapped.
+ [Fact]
+ public void APurchaseBeyondTheStocksRangeIsRefused()
+ {
+ var c = Gdd();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var after = s.Clone();
+ Assert.Equal("That is more Arms than the stock can hold", Pools.BuyArms(c, after, int.MaxValue, new List<Cause>()));
+ Assert.Equal(s.Hash(), after.Hash());
+ }
+
+ // R-ARMS-001 to R-ARMS-003: missing or negative values are load errors, never a default.
+ [Theory]
+ [InlineData(" arms_start: 20\n", " arms_start: -1\n", "mvp.arms_start", ">= 0")]
+ [InlineData(" arms_start: 20\n", "", "mvp.arms_start", "required")]
+ [InlineData(" arms_price: 0.25\n", "", "mvp.arms_price", "required")]
+ [InlineData(" arms_price: 0.25\n", " arms_price: -0.1\n", "mvp.arms_price", "finite number >= 0")]
+ [InlineData(" arms_price: 0.25\n", " arms_price: .inf\n", "mvp.arms_price", "finite number >= 0")]
+ [InlineData(" arms_per_recruit_group: 2\n", "", "mvp.arms_per_recruit_group", "required")]
+ [InlineData(" arms_per_recruit_group: 2\n", " arms_per_recruit_group: -2\n", "mvp.arms_per_recruit_group", ">= 0")]
+ public void TheArmsValuesAreRequired(string line, string replacement, string field, string message)
+ {
+ var files = Fixture.Gdd();
+ Assert.Contains(line, files["rules.yaml"]);
+ files["rules.yaml"] = files["rules.yaml"].Replace(line, replacement);
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(files)));
+ Assert.Equal(field, ex.Field);
+ Assert.Contains(message, ex.Message);
+ }
+
+ // R-ARMS-002: the order survives a save (the `arms N` line) and replays to the same state.
+ [Fact]
+ public void TheArmsOrderSurvivesASave()
+ {
+ var g = GameSession.New(Real, GoldenRun.Seed, Mode.Historical);
+ g.Step(new Command[] { new BuyArms(25) });
+ g.Step(new Command[0]);
+ var text = g.Save.Write();
+ Assert.Contains("\narms 25\n", text);
+ var loaded = GameSession.Load(Real, text, out _).State;
+ Assert.Equal(g.State.Hash(), loaded.Hash());
+ Assert.Equal(Real.Rules.Mvp!.ArmsStart!.Value + 25, loaded.Arms);
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/SaveGameTests.cs b/sim/Statecraft.Sim.Tests/SaveGameTests.cs
index 6a901c941..e690f507b 100644
--- a/sim/Statecraft.Sim.Tests/SaveGameTests.cs
+++ b/sim/Statecraft.Sim.Tests/SaveGameTests.cs
@@ -29,7 +29,7 @@ public class SaveGameTests
new Command[] { new SetPolicy("odd id with spaces%", 0.5), new MapAction("transit_camp", 4, 0) },
new Command[] { new AssignWorkers("town_a", "job", 1) }, // a GDD order: the legacy fixture refuses it
new Command[] { new Train("town_a", "halutz", 1), new CancelTraining(1) }, // GDD orders too
- new Command[] { new PioneerWork(1, "build_yishuv", "site_a"), new StopWork(1), new StartProject("housing", "town_a", 1, 1), new CancelProject(1) },
+ new Command[] { new PioneerWork(1, "build_yishuv", "site_a"), new StopWork(1), new StartProject("housing", "town_a", 1, 1), new CancelProject(1), new BuyArms(2) },
new Command[] { new SecurityOrder(1) }, new Command[0],
};
foreach (var o in orders) g.Step(o);
diff --git a/sim/Statecraft.Sim.Tests/TrainingTests.cs b/sim/Statecraft.Sim.Tests/TrainingTests.cs
index 2fbe3f0a7..7af6d9190 100644
--- a/sim/Statecraft.Sim.Tests/TrainingTests.cs
+++ b/sim/Statecraft.Sim.Tests/TrainingTests.cs
@@ -326,4 +326,62 @@ public class TrainingTests
Assert.Empty(s.Cohorts);
Assert.DoesNotContain("train[", s.Describe());
}
+
+ // R-ARMS-003: a recruit cohort takes arms_per_recruit_group Arms per group when its training starts (the fixture: 2 a
+ // group from a stock of 20); pioneer training takes none.
+ [Fact]
+ public void ARecruitCohortUsesArms()
+ {
+ var c = Town();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var r = Step(c, s, new Train("town_a", "recruit", 3));
+ Assert.Empty(r.Rejected);
+ Assert.Equal(20 - 3 * 2, r.State.Arms);
+ Assert.Contains(r.Why, x => x.System == "city" && x.Target == "arms" && x.Delta == -6 && x.Message == "Town A: basic training took 6 Arms");
+ Assert.Equal(20, Step(c, s, new Train("town_a", "halutz", 3)).State.Arms);
+ }
+
+ // R-ARMS-003, R-TRAIN-002 (owner, #1047, 18 October 2026: "Refund on cancel"): cancelling a recruit cohort returns the
+ // Arms its training took when it started, even if arms_per_recruit_group has changed since; the Money stays paid.
+ [Fact]
+ public void CancellingARecruitCohortReturnsTheArmsItTook()
+ {
+ var c = Town();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var trained = Step(c, s, new Train("town_a", "recruit", 3)).State;
+ Assert.Equal(14, trained.Arms);
+ c.Rules.Mvp!.ArmsPerRecruitGroup = 5; // the refund is what was taken (3 x 2), not today's 3 x 5
+ var cancelled = Step(c, trained, new CancelTraining(trained.Cohorts.Keys.Single()));
+ Assert.Empty(cancelled.Rejected);
+ Assert.Equal(20, cancelled.State.Arms);
+ Assert.Contains(cancelled.Why, x => x.System == "city" && x.Target == "arms" && x.Delta == 6 && x.Message == "Town A: basic training returned 6 Arms");
+ trained.Arms = int.MaxValue - 1; // the pool was filled meanwhile: the refund stops at the most the stock holds
+ Assert.Equal(int.MaxValue, Step(c, trained, new CancelTraining(trained.Cohorts.Keys.Single())).State.Arms);
+ var halutz = Step(c, s, new Train("town_a", "halutz", 3)).State;
+ var back = Step(c, halutz, new CancelTraining(halutz.Cohorts.Keys.Single()));
+ Assert.Equal(20, back.State.Arms);
+ Assert.DoesNotContain(back.Why, x => x.Target == "arms");
+ }
+
+ // R-ARMS-003: too few Arms refuses the training with a reason, the state as if the order had not been given (Attention
+ // refunded too); a stock of exactly the need trains.
+ [Fact]
+ public void TooFewArmsRefusesTheTraining()
+ {
+ var c = Town();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Arms = 5;
+ var r = Step(c, s, new Train("town_a", "recruit", 3));
+ Assert.Equal("Town A: not enough Arms for basic training (need 6, have 5)", Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).State.Hash(), r.State.Hash());
+ s.Arms = 6;
+ var exact = Step(c, s, new Train("town_a", "recruit", 3));
+ Assert.Empty(exact.Rejected);
+ Assert.Equal(0, exact.State.Arms);
+ // Orders in one turn draw on the stock in turn: the second finds it short.
+ s.Arms = 7;
+ s.Attention = 10; // both orders affordable, so only the Arms can refuse the second
+ var two = Step(c, s, new Train("town_a", "recruit", 3), new Train("town_a", "recruit", 1));
+ Assert.Equal("Town A: not enough Arms for basic training (need 2, have 1)", Assert.Single(two.Rejected).Reason);
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
index 513072050..707f28340 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1950.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
@@ -125,4 +125,5 @@ cproj[
2:housing@tel_aviv,-4,20/done,1949-08-15
3:housing@tel_aviv,-3,19/1
next=4
-food=3003,1001,0
\ No newline at end of file
+food=3003,1001,0
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1952.txt b/sim/Statecraft.Sim.Tests/golden/hash1952.txt
index b2adb8630..3f1e57c5d 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1952.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1952.txt
@@ -162,4 +162,5 @@ next=8
obj{
first_new_yishuv=1950-03-15
score=100
-food=2738,1390,0
\ No newline at end of file
+food=2738,1390,0
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txt
index 611327332..abc786676 100644
--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt
+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt
@@ -2,11 +2,11 @@
# 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 9922495a92307f87d7b5338cd8501fb60ad0424ea6b19ef2d1ec55c44a8bdfb8
-hash1952 722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08
-smoke5 3005405d64abc6e7418fa1f0d35c36ce5f64ed3af7c5a4c24a73d5dfdb16121f
-scenario-reckless 8041988a2c6b5b72a8351fd79ab07c2afca0672f686586cc8b7f9777c2061038
-scenario-cautious 6507ddc31437eaf8b0a8858a84c539860dcd7a6febacb0f1d142cb59489e2a9f
-scenario-mvp-absorb-first be13c409eae4391f3da89cec7573c0dfa817884e47ce45ce50976e21d7f03bfe
-mvp-end 722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08
-scenario-mvp-defeat 191434636c6a68e6a9d318d38f2eacd9a33e0995592cecf9b1987df91410baa0
+hash1950 4f1202cfa20e1f3cc7521c7b3baac386330b77fdbacc25928d781b1659747340
+hash1952 283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2
+smoke5 8d000459d26a08a49583adfc88c14799ce6e6f653dcecff1e30b5e737f0959aa
+scenario-reckless a0f094a16688042d2b71a02c29e2c637acad574391bfc8a22f38f2ebf15f42ba
+scenario-cautious a6108c91ccdea0977dc7937583378c2aefa1060f380566ae76f75ad719ea759d
+scenario-mvp-absorb-first dee4f0397b176ea6e9919dedc8f5b153370e4e6c3e9267a66d673fdb3d4f7adb
+mvp-end 283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2
+scenario-mvp-defeat e71076f7754e2a6da1eb91db7b509d4b87c02d1cb74ffb2db5ea60b97a0ecf48
diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
index b2adb8630..3f1e57c5d 100644
--- a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
+++ b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
@@ -162,4 +162,5 @@ next=8
obj{
first_new_yishuv=1950-03-15
score=100
-food=2738,1390,0
\ No newline at end of file
+food=2738,1390,0
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
index 25f8c1bc5..1da77e8d3 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
@@ -100,4 +100,5 @@ city{
tel_aviv=248,106,256,106,8,c0.34471009036144573 [3FD60FBAE92D0804]
tiberias=6,2,6,2,0,c0.35 [3FD6666666666666]
zikhron_yaakov=2,1,2,1,0,c0.35 [3FD6666666666666]
-food=2253,751,0
\ No newline at end of file
+food=2253,751,0
+arms=12
\ No newline at end of file
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 2bbb8db5d..199d013fe 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
@@ -108,4 +108,5 @@ city{
tel_aviv=248,106,302,90,10,c0.253441763530126 [3FD03863CD735B73],jobs=manual
tiberias=6,2,7,2,0,c0.26428571428571435 [3FD0EA0EA0EA0EA2]
zikhron_yaakov=2,1,3,1,0,c0.3 [3FD3333333333333]
-food=2556,852,0
\ No newline at end of file
+food=2556,852,0
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
index 50f3f49fa..bac1bc93f 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-defeat.txt
@@ -134,4 +134,5 @@ city{
tiberias=6,2,13,2,0,c0 [0000000000000000]
zikhron_yaakov=2,1,4,1,0,c0 [0000000000000000]
food=0,1390,1390
-exhausted=3
\ No newline at end of file
+exhausted=3
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
index 24abfc20c..ad0695a8c 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
@@ -98,4 +98,5 @@ city{
tel_aviv=248,106,256,106,8,c0.34471009036144573 [3FD60FBAE92D0804]
tiberias=6,2,6,2,0,c0.35 [3FD6666666666666]
zikhron_yaakov=2,1,2,1,0,c0.35 [3FD6666666666666]
-food=2253,751,0
\ No newline at end of file
+food=2253,751,0
+arms=12
\ No newline at end of file
diff --git a/sim/Statecraft.Sim/AttentionSystem.cs b/sim/Statecraft.Sim/AttentionSystem.cs
index b96143913..5fad4662e 100644
--- a/sim/Statecraft.Sim/AttentionSystem.cs
+++ b/sim/Statecraft.Sim/AttentionSystem.cs
@@ -8,11 +8,11 @@ namespace Statecraft.Sim
public static class AttentionSystem
{
static readonly HashSet<string> Kinds = new HashSet<string>
- { "set_policy", "allocate_budget", "choose_event_option", "set_mobilization", "security_order", "appoint", "map_action", "assign_workers", "train", "cancel_training", "pioneer_work", "stop_work", "start_project", "cancel_project" };
+ { "set_policy", "allocate_budget", "choose_event_option", "set_mobilization", "security_order", "appoint", "map_action", "assign_workers", "train", "cancel_training", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms" };
/// <summary>The kinds only the GDD v0.1 loop runs. Rules price them only when systems.loop is gdd, and the legacy loop
/// refuses them before charging Attention.</summary>
- static readonly HashSet<string> GddKinds = new HashSet<string> { "assign_workers", "train", "cancel_training", "pioneer_work", "stop_work", "start_project", "cancel_project" };
+ static readonly HashSet<string> GddKinds = new HashSet<string> { "assign_workers", "train", "cancel_training", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms" };
public static IReadOnlyCollection<string> CommandKinds => Kinds;
diff --git a/sim/Statecraft.Sim/Commands.cs b/sim/Statecraft.Sim/Commands.cs
index fb3d15276..1451c2d15 100644
--- a/sim/Statecraft.Sim/Commands.cs
+++ b/sim/Statecraft.Sim/Commands.cs
@@ -121,6 +121,14 @@ namespace Statecraft.Sim
public CancelProject(int project) { Project = project; }
}
+ /// <summary>Buys <see cref="Count"/> Arms with Money (Pools.BuyArms, R-ARMS-002, D-G6). GDD v0.1 loop only.</summary>
+ public sealed class BuyArms : Command
+ {
+ public override string Kind => Pools.BuyArmsKind;
+ public int Count { get; }
+ public BuyArms(int count) { Count = count; }
+ }
+
public sealed class Rejection
{
public Command Command { get; } public string Reason { get; }
@@ -156,6 +164,7 @@ namespace Statecraft.Sim
case StopWork _: break;
case StartProject p: Text(p.ProjectKind, "ProjectKind"); Text(p.City, "City"); break;
case CancelProject _: break;
+ case BuyArms _: break;
case SetMobilization _: case SecurityOrder _: break;
default: throw new ArgumentException("unknown command type " + cmd.GetType().Name, "commands");
}
diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.cs
index e986431bb..04b1d0512 100644
--- a/sim/Statecraft.Sim/Content.cs
+++ b/sim/Statecraft.Sim/Content.cs
@@ -556,6 +556,13 @@ namespace Statecraft.Sim
/// <summary>The months of the nation's need the Food stock holds when full: the start stock and the level the monthly
/// imports keep (R-FOOD-001, R-FOOD-002). Required in the GDD loop, at least 1.</summary>
public int? CoverMonths { get; set; }
+ /// <summary>The national Arms stock on 15 May 1948, in Arms units (R-ARMS-001; D-G6, #781). Required in the GDD loop, &gt;= 0.</summary>
+ public int? ArmsStart { get; set; }
+ /// <summary>The Money one Arms unit costs, in IL millions (R-ARMS-002; D-G6, #781). Required in the GDD loop, finite and &gt;= 0.</summary>
+ public double? ArmsPrice { get; set; }
+ /// <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>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 ed3b63ca2..82142d3aa 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -1152,6 +1152,13 @@ namespace Statecraft.Sim
if (!(m.KFood >= 0 && m.KFood <= 1)) throw new ContentException(file, "mvp.k_food", "must be between 0 and 1");
if (m.CoverMonths == null) throw new ContentException(file, "mvp.cover_months", "required when eras.yaml systems.loop is gdd");
if (m.CoverMonths < 1) throw new ContentException(file, "mvp.cover_months", "must be >= 1");
+ // R-ARMS-001 to R-ARMS-003: required, so a missing key is never read as 0 (no stock, free Arms, or training without them).
+ if (m.ArmsStart == null) throw new ContentException(file, "mvp.arms_start", "required when eras.yaml systems.loop is gdd");
+ if (m.ArmsStart < 0) throw new ContentException(file, "mvp.arms_start", "must be >= 0");
+ if (m.ArmsPrice == null) throw new ContentException(file, "mvp.arms_price", "required when eras.yaml systems.loop is gdd");
+ 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-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/EventRules.cs b/sim/Statecraft.Sim/EventRules.cs
index 38ec13382..7db40028b 100644
--- a/sim/Statecraft.Sim/EventRules.cs
+++ b/sim/Statecraft.Sim/EventRules.cs
@@ -9,13 +9,13 @@ namespace Statecraft.Sim
static class EventRules
{
public static readonly HashSet<string> SensitiveTags = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "holocaust", "terror", "massacre", "war-casualties", "displacement" };
- public static readonly HashSet<string> SpecialTargets = new HashSet<string> { "treasury", "fx_reserves", Pools.FoodTarget };
+ public static readonly HashSet<string> SpecialTargets = new HashSet<string> { "treasury", "fx_reserves", Pools.FoodTarget, Pools.ArmsTarget };
/// <summary>Targets a sensitive event's options may not raise (CONTENT_POLICY section 4: no mechanic rewards violence against
/// civilians). Owner decision of 15 October 2026 on Q-EFX-2, "Extend it": every resource, not money alone. Until the
/// GDD resources exist as targets the legacy indicators stand for them: Money (treasury, fx_reserves), Food
/// (food_supply), Social cohesion (morale) and International Support (intl_standing). Food also has its own target
- /// (`food`, R-EFX-001); Arms has no target yet and joins the rule with its pool (#781).</summary>
- public static readonly HashSet<string> NoGainTargets = new HashSet<string> { "treasury", "fx_reserves", Pools.FoodTarget, "food_supply", "morale", "intl_standing" };
+ /// (`food`, R-EFX-001); Arms joins the rule with its pool (#781).</summary>
+ public static readonly HashSet<string> NoGainTargets = new HashSet<string> { "treasury", "fx_reserves", Pools.FoodTarget, Pools.ArmsTarget, "food_supply", "morale", "intl_standing" };
public static void Validate(Content c, HashSet<string> offices, HashSet<string> indicators)
{
@@ -87,8 +87,8 @@ namespace Statecraft.Sim
throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), "unknown target");
Active(F($"options[{o.Id}].effects.{fx.Target}"), fx.Target);
ContentLoader.Finite(e.File, F($"options[{o.Id}].effects.{fx.Target}.delta"), fx.Delta);
- if (fx.Target == Pools.FoodTarget && Math.Abs(fx.Delta) > int.MaxValue)
- throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), "food delta out of range");
+ if ((fx.Target == Pools.FoodTarget || fx.Target == Pools.ArmsTarget) && Math.Abs(fx.Delta) > int.MaxValue)
+ throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), $"{fx.Target} delta out of range");
if (sensitive && NoGainTargets.Contains(fx.Target) && fx.Delta > 0)
throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), $"sensitive events cannot reward {fx.Target}");
}
diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.cs
index 1440c9bae..f1a142ca6 100644
--- a/sim/Statecraft.Sim/EventSystem.cs
+++ b/sim/Statecraft.Sim/EventSystem.cs
@@ -93,6 +93,14 @@ namespace Statecraft.Sim
s.Food = (int)(s.Food + applied);
change = applied;
}
+ else if (fx.Target == Pools.ArmsTarget)
+ {
+ // R-EFX-001 (#781): the Arms stock moves exactly as the Food stock does above.
+ var want = (long)Math.Round(delta, MidpointRounding.AwayFromZero);
+ var applied = Math.Max(-(long)s.Arms, Math.Min(want, (long)int.MaxValue - s.Arms));
+ s.Arms = (int)(s.Arms + applied);
+ change = applied;
+ }
else if (fx.Target == "fx_reserves") s.FxReserves += delta;
else change = EffectsSystem.Shift(c, s, fx.Target, delta);
why.Add(new Cause("events", fx.Target, change, $"{PlayerText.Change(c, fx.Target, change)} ({title})"));
@@ -158,7 +166,7 @@ namespace Statecraft.Sim
/// <summary>R-EVT-005: every effect of an option, in the order choosing it applies them (Resolve): the numeric
/// effects, the unit grants and city effects (R-EFX-006), the policies it sets (by id), the security level, then rejoin.
- /// Each amount is the option's own; Resolve may apply less where an indicator meets its bound or the Food stock its floor, and rounds Food to whole units. The
+ /// Each amount is the option's own; Resolve may apply less where an indicator meets its bound or the Food or Arms stock its floor, and rounds both to whole units. The
/// event card will read this list (Q-EVT-4, owner 17 October 2026; Phase 7 PR 8), so no number is computed in Unity.</summary>
public static List<Cause> OptionEffects(Content c, GameState s, EventOption o)
{
diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.cs
index e1d10cf72..be44f8757 100644
--- a/sim/Statecraft.Sim/GameState.cs
+++ b/sim/Statecraft.Sim/GameState.cs
@@ -87,6 +87,8 @@ namespace Statecraft.Sim
public int FoodUnmet;
/// <summary>Consecutive turn ends with Money and Food both exhausted (R-END-001, R-END-002); 0 when either was not.</summary>
public int ExhaustedTurns;
+ /// <summary>The national Arms stock (R-ARMS-001; D-G6): one Arms is the equipment package for one 1,000-person recruit group. Never below 0.</summary>
+ public int Arms;
public double TotalPopulation => Population.Values.Sum();
@@ -212,6 +214,7 @@ namespace Statecraft.Sim
.Append(',').Append(FoodUnmet.ToString(CultureInfo.InvariantCulture));
}
if (ExhaustedTurns != 0) { Sep(); Nl(); sb.Append("exhausted=").Append(ExhaustedTurns.ToString(CultureInfo.InvariantCulture)); }
+ if (Arms != 0) { Sep(); Nl(); sb.Append("arms=").Append(Arms.ToString(CultureInfo.InvariantCulture)); }
return sb.ToString();
}
}
diff --git a/sim/Statecraft.Sim/GddState.cs b/sim/Statecraft.Sim/GddState.cs
index 325b2fa93..0fd6e748a 100644
--- a/sim/Statecraft.Sim/GddState.cs
+++ b/sim/Statecraft.Sim/GddState.cs
@@ -139,8 +139,9 @@ namespace Statecraft.Sim
}
/// <summary>A group of a city's people in training (GDD "Progression"; R-TRAIN-001): <see cref="Count"/> population units
- /// becoming <see cref="Type"/> (a unit_types.yaml id with a facility) in <see cref="TurnsLeft"/> more turns. Immutable; a
- /// change replaces the record.</summary>
+ /// becoming <see cref="Type"/> (a unit_types.yaml id with a facility) in <see cref="TurnsLeft"/> more turns, holding the
+ /// <see cref="Arms"/> its training took when it started (R-ARMS-003), which a cancel returns. Immutable; a change replaces the
+ /// record.</summary>
public sealed class Cohort
{
public int Id { get; }
@@ -148,14 +149,17 @@ namespace Statecraft.Sim
public string City { get; }
public int Count { get; }
public int TurnsLeft { get; }
+ public int Arms { get; }
- public Cohort(int id, string type, string city, int count, int turnsLeft) { Id = id; Type = type; City = city; Count = count; TurnsLeft = turnsLeft; }
+ public Cohort(int id, string type, string city, int count, int turnsLeft, int arms = 0) { Id = id; Type = type; City = city; Count = count; TurnsLeft = turnsLeft; Arms = arms; }
/// <summary>The same cohort with <paramref name="turnsLeft"/> turns to go.</summary>
- public Cohort WithTurnsLeft(int turnsLeft) => new Cohort(Id, Type, City, Count, turnsLeft);
+ public Cohort WithTurnsLeft(int turnsLeft) => new Cohort(Id, Type, City, Count, turnsLeft, Arms);
- /// <summary>The record as the state hash writes it.</summary>
- public string Canonical() => string.Format(CultureInfo.InvariantCulture, "{0}:{1}@{2}x{3}/{4}", Id, Type, City, Count, TurnsLeft);
+ /// <summary>The record as the state hash writes it. Arms only when the cohort holds some, so cohorts without Arms hash as
+ /// before.</summary>
+ public string Canonical() => string.Format(CultureInfo.InvariantCulture, "{0}:{1}@{2}x{3}/{4}", Id, Type, City, Count, TurnsLeft)
+ + (Arms == 0 ? "" : "|arms=" + Arms.ToString(CultureInfo.InvariantCulture));
}
/// <summary>Pioneer work at a designated site (sites.yaml; R-SITE-001 to R-SITE-003): <see cref="Unit"/> building it with
diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.cs
index b26488393..c0465d835 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 = "9922495a92307f87d7b5338cd8501fb60ad0424ea6b19ef2d1ec55c44a8bdfb8";
+ public const string Hash1950 = "4f1202cfa20e1f3cc7521c7b3baac386330b77fdbacc25928d781b1659747340";
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 = "722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08";
+ public const string Hash1952 = "283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2";
public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);
diff --git a/sim/Statecraft.Sim/PlayerText.cs b/sim/Statecraft.Sim/PlayerText.cs
index 9abf2f54e..f1e0a69f4 100644
--- a/sim/Statecraft.Sim/PlayerText.cs
+++ b/sim/Statecraft.Sim/PlayerText.cs
@@ -121,7 +121,7 @@ namespace Statecraft.Sim
return Signed(r, "", Fixed(Math.Abs(r), decimals) + "%", signed: true);
}
- /// <summary>"+5 units" for a change to a whole-unit national stock (the Food pool; R-EFX-001).</summary>
+ /// <summary>"+5 units" for a change to a whole-unit national stock (the Food and Arms pools; R-EFX-001).</summary>
public static string UnitsChange(double change)
{
var r = Math.Round(Finite(change, nameof(change)), 0, MidpointRounding.AwayFromZero);
@@ -130,7 +130,7 @@ namespace Statecraft.Sim
/// <summary>"Morale +4.1%" or "Treasury -IL 2.0m": the name and the change, in the target's unit.</summary>
public static string Change(Content c, string id, double change) =>
- (id == Pools.FoodTarget ? "Food" : Target(c, id)) + " "
- + (id == Pools.FoodTarget ? UnitsChange(change) : IsMoney(c, id) ? MoneyChange(c, id, change) : PercentChange(change));
+ (id == Pools.FoodTarget ? "Food" : id == Pools.ArmsTarget ? "Arms" : Target(c, id)) + " "
+ + (id == Pools.FoodTarget || id == Pools.ArmsTarget ? UnitsChange(change) : IsMoney(c, id) ? MoneyChange(c, id, change) : PercentChange(change));
}
}
diff --git a/sim/Statecraft.Sim/Pools.cs b/sim/Statecraft.Sim/Pools.cs
index 170a073e0..1db1b0bef 100644
--- a/sim/Statecraft.Sim/Pools.cs
+++ b/sim/Statecraft.Sim/Pools.cs
@@ -18,6 +18,12 @@ namespace Statecraft.Sim
/// <summary>The event-effect target that moves the Food stock itself (R-EFX-001).</summary>
public const string FoodTarget = "food";
+ /// <summary>The event-effect target that moves the Arms stock (R-EFX-001, #781).</summary>
+ public const string ArmsTarget = "arms";
+
+ /// <summary>The command kind that buys Arms with Money (R-ARMS-002).</summary>
+ public const string BuyArmsKind = "buy_arms";
+
/// <summary>R-FOOD-001: the stock starts at cover_months of the start's need, so food_supply starts at its level.</summary>
public static void Init(Content c, GameState s)
{
@@ -26,6 +32,21 @@ namespace Statecraft.Sim
s.FoodNeed = Need(s, r);
s.Food = r.CoverMonths!.Value * s.FoodNeed;
s.FoodUnmet = 0;
+ s.Arms = r.ArmsStart!.Value; // R-ARMS-001; the loader requires it in the GDD loop
+ }
+
+ /// <summary>R-ARMS-002 (D-G6): <paramref name="count"/> Arms join the stock at once, and the Treasury pays
+ /// count * arms_price, borrowing what it lacks (R-MONEY-003). Refused, state untouched, for fewer than one unit or a
+ /// stock that would pass a whole number's range. Step has already refused it in the legacy loop.</summary>
+ public static string? BuyArms(Content c, GameState s, int count, List<Cause> why)
+ {
+ if (count < 1) return "Buy at least 1 Arms";
+ if ((long)s.Arms + count > int.MaxValue) return "That is more Arms than the stock can hold";
+ var cost = count * c.RulesAt(s.Date).Mvp!.ArmsPrice!.Value;
+ EconomySystem.PayOrBorrow(c, s, cost, "for Arms", why);
+ s.Arms += count;
+ why.Add(new Cause("economy", "arms", count, FormattableString.Invariant($"Bought {count} Arms, cost {PlayerText.Money(c, "treasury", cost)}")));
+ return null;
}
/// <summary>The nation's need for one turn: its head count in population units, rounded half away from zero.</summary>
diff --git a/sim/Statecraft.Sim/SaveGame.cs b/sim/Statecraft.Sim/SaveGame.cs
index 1974fbbbd..93a1e191b 100644
--- a/sim/Statecraft.Sim/SaveGame.cs
+++ b/sim/Statecraft.Sim/SaveGame.cs
@@ -39,7 +39,7 @@ namespace Statecraft.Sim
/// &lt;command&gt; ... policy ID LEVEL | budget OFFICE=SHARE,... | event ID OPTION | mobilize LEVEL |
/// security DELTA | appoint OFFICE PERSON | map ACTION Q R | work CITY ROLE N |
/// train CITY TRACK N | untrain COHORT | pioneer UNIT ACTION SITE | stop UNIT |
- /// project KIND CITY Q R | unproject PROJECT
+ /// project KIND CITY Q R | unproject PROJECT | arms N
/// end &lt;hex&gt; GameState.Hash() after the last turn (checks the replay)
/// Doubles are IEEE bit patterns in hex, so replays are exact; strings are percent-escaped (Uri.EscapeDataString).
/// </summary>
@@ -125,6 +125,7 @@ namespace Statecraft.Sim
StopWork w => $"stop {Int(w.Unit)}",
StartProject p => $"project {Esc(p.ProjectKind)} {Esc(p.City)} {Int(p.Q)} {Int(p.R)}",
CancelProject p => $"unproject {Int(p.Project)}",
+ BuyArms a => $"arms {Int(a.Count)}",
_ => throw new ArgumentException($"Cannot save command kind '{cmd.Kind}'", nameof(cmd)),
};
@@ -220,6 +221,7 @@ namespace Statecraft.Sim
case "stop": Arity(2); return new StopWork(I(f[1]));
case "project": Arity(5); return new StartProject(Str(f[1]), Str(f[2]), I(f[3]), I(f[4]));
case "unproject": Arity(2); return new CancelProject(I(f[1]));
+ case "arms": Arity(2); return new BuyArms(I(f[1]));
default: throw new SaveException(line, $"unknown command '{f[0]}'");
}
}
diff --git a/sim/Statecraft.Sim/Scenario.cs b/sim/Statecraft.Sim/Scenario.cs
index a036221c6..c1690dffa 100644
--- a/sim/Statecraft.Sim/Scenario.cs
+++ b/sim/Statecraft.Sim/Scenario.cs
@@ -66,6 +66,7 @@ namespace Statecraft.Sim
["train"] = new[] { "city", "track", "count" }, ["cancel_training"] = new[] { "cohort" },
["pioneer_work"] = new[] { "unit", "action", "site" }, ["stop_work"] = new[] { "unit" },
["start_project"] = new[] { "project", "city", "q", "r" }, ["cancel_project"] = new[] { "project" },
+ ["buy_arms"] = new[] { "count" },
};
public static IReadOnlyCollection<string> Kinds => Allowed.Keys;
@@ -97,6 +98,7 @@ namespace Statecraft.Sim
case "stop_work": return new StopWork(Whole(c, "unit"));
case "start_project": return new StartProject(Str(c, "project"), Str(c, "city"), Whole(c, "q"), Whole(c, "r"));
case "cancel_project": return new CancelProject(Whole(c, "project"));
+ case "buy_arms": return new BuyArms(Whole(c, "count"));
default: throw new InvalidDataException($"command kind '{kind}' has no builder");
}
}
@@ -137,6 +139,7 @@ namespace Statecraft.Sim
AssignWorkers w => $"{w.City} {w.Role} {w.Count}", Train t => $"{t.City} {t.Track} {t.Count}", CancelTraining t => t.Cohort.ToString(CultureInfo.InvariantCulture),
PioneerWork p => FormattableString.Invariant($"{p.Unit} {p.Action} {p.Site}"), StopWork w => w.Unit.ToString(CultureInfo.InvariantCulture),
StartProject p => FormattableString.Invariant($"{p.ProjectKind} {p.City} {p.Q},{p.R}"), CancelProject p => p.Project.ToString(CultureInfo.InvariantCulture),
+ BuyArms a => a.Count.ToString(CultureInfo.InvariantCulture),
_ => c.Kind,
};
}
diff --git a/sim/Statecraft.Sim/Simulation.cs b/sim/Statecraft.Sim/Simulation.cs
index 7bda72a6d..3c97bab0a 100644
--- a/sim/Statecraft.Sim/Simulation.cs
+++ b/sim/Statecraft.Sim/Simulation.cs
@@ -176,6 +176,8 @@ namespace Statecraft.Sim
return Projects.StartCity(c, s, p.ProjectKind, p.City, p.Q, p.R, why);
case CancelProject p:
return Projects.CancelCity(c, s, p.Project, why);
+ case BuyArms a:
+ return Pools.BuyArms(c, s, a.Count, why);
case SecurityOrder o:
// long arithmetic: an extreme delta clamps to the ladder's end instead of wrapping around.
SecuritySystem.SetRung(c, s, (int)Math.Max(1L, Math.Min(5L, (long)s.Rung + o.Delta)), why);
diff --git a/sim/Statecraft.Sim/Training.cs b/sim/Statecraft.Sim/Training.cs
index b03a976cf..a5822b6f9 100644
--- a/sim/Statecraft.Sim/Training.cs
+++ b/sim/Statecraft.Sim/Training.cs
@@ -74,6 +74,10 @@ namespace Statecraft.Sim
if (!HasFacility(c, s, city, type.Facility)) return $"{name} has no {Place(type.Facility)}";
var idle = Idle(x);
if (count > idle) return FormattableString.Invariant($"{name} has {idle} civilians without work");
+ // R-ARMS-003 (D-G6, Q-UNIT-3): a recruit group takes arms_per_recruit_group Arms when its training starts; a short
+ // stock refuses the order. Pioneer training takes none. The cohort keeps the count, and cancelling (R-TRAIN-002) returns it.
+ var arms = type.Id == "recruit" ? (long)count * c.RulesAt(s.Date).Mvp!.ArmsPerRecruitGroup!.Value : 0;
+ if (arms > s.Arms) return FormattableString.Invariant($"{name}: not enough Arms for {Course(type.Facility)} (need {arms}, have {s.Arms})");
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);
@@ -85,14 +89,20 @@ namespace Statecraft.Sim
// 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
// with training_turns 3 an order on turn T is done at the end of T+2 (TrainingTests.ACohortOrderedOnTurnTWithThreeTurnsFinishesAtTheEndOfTurnTPlusTwo). For "done at the end of
// T+3", open the cohort with type.TrainingTurns + 1 here; nothing else changes.
- s.Cohorts.Add(id, new Cohort(id, type.Id, city, count, type.TrainingTurns));
+ s.Cohorts.Add(id, new Cohort(id, type.Id, city, count, type.TrainingTurns, (int)arms));
why.Add(new Cause("city", city, -count, $"{name}: {Groups(count)} began {Course(type.Facility)}, cost {PlayerText.Money(c, "treasury", cost)}"));
+ if (arms > 0)
+ {
+ s.Arms -= (int)arms;
+ why.Add(new Cause("city", "arms", -arms, FormattableString.Invariant($"{name}: {Course(type.Facility)} took {arms} Arms")));
+ }
return null;
}
/// <summary>R-TRAIN-002 (D-A3): the cohort's people return to its city as civilians without work, and the Money spent is
- /// not returned. Refused, state untouched, for a cohort that does not exist, including one that has finished. Step has
- /// already refused it in the legacy loop.</summary>
+ /// not returned. The Arms its training took go back to the pool (R-ARMS-003; owner, #1047: "Refund on cancel"). Refused,
+ /// state untouched, for a cohort that does not exist, including one that has finished. Step has already refused it in
+ /// the legacy loop.</summary>
public static string? Cancel(Content c, GameState s, int cohort, List<Cause> why)
{
if (!s.Cohorts.TryGetValue(cohort, out var k)) return "There is no such training group";
@@ -102,6 +112,12 @@ namespace Statecraft.Sim
var type = c.UnitTypes.First(t => t.Id == k.Type);
why.Add(new Cause("city", k.City, k.Count,
$"{PlayerText.Settlement(c, k.City)}: {Groups(k.Count)} left {Course(type.Facility)}; the Money spent is not returned"));
+ if (k.Arms > 0)
+ {
+ var back = (int)Math.Min(k.Arms, (long)int.MaxValue - s.Arms); // the stock stops at int.MaxValue, as an event or a purchase leaves it
+ s.Arms += back;
+ why.Add(new Cause("city", "arms", back, FormattableString.Invariant($"{PlayerText.Settlement(c, k.City)}: {Course(type.Facility)} returned {back} Arms")));
+ }
return null;
}
diff --git a/tools/web_check.py b/tools/web_check.py
index 5c7abe2ac..7428605fb 100644
--- a/tools/web_check.py
+++ b/tools/web_check.py
@@ -8,7 +8,7 @@ fail on a failure line or a timeout. Uses Chrome for Testing from the Playwright
--enable-logging=stderr --v=1 as INFO:CONSOLE... "text", source: ...
Usage (from the repo root):
- uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK hash1950 9922495a92307f87d7b5338cd8501fb60ad0424ea6b19ef2d1ec55c44a8bdfb8" --expect "GOLDEN OK hash1952 722d90a214d8f328fa9e534ab19a8e973de21cdee645aaa6983fe88b3cc55c08"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK hash1950 4f1202cfa20e1f3cc7521c7b3baac386330b77fdbacc25928d781b1659747340" --expect "GOLDEN OK hash1952 283349502eb580123fcea6bf64ca174f913627132a1325f3dbf00743435623e2"
Options: --query Q (page URL query, without '?'), --expect TEXT (repeatable), --fail REGEX (default: GOLDEN FAIL|SMOKE FAIL|BOOT FAIL),
--timeout SECONDS (default 300), --stall SECONDS (fail when no console message arrives for that long; 0 = off),
--swiftshader (software WebGL when there is no GPU), --dpr N (default 1), --shots DIR (reassemble the player's
diff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.cs
index fb02936c1..ae9eb76fb 100644
--- a/unity/Assets/Scripts/UI/SimBridge.cs
+++ b/unity/Assets/Scripts/UI/SimBridge.cs
@@ -132,6 +132,8 @@ namespace Statecraft.Game.UI
return Unknown("city_project", p.ProjectKind, Content.ProjectKinds.Select(x => x.Id)) ?? Unknown("city", p.City, Content.Cities.Select(x => x.Id));
case CancelProject x:
return Unknown("city_project", x.Project.ToString(System.Globalization.CultureInfo.InvariantCulture), State.CityProjects.Keys.Select(k => k.ToString(System.Globalization.CultureInfo.InvariantCulture)));
+ // Buying Arms (#781): no ids; the sim refuses a count below one itself.
+ case BuyArms _: return null;
default: return text["order.invalid"];
}
}
diff --git a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs
index 63e2030bc..894b829bd 100644
--- a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs
+++ b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs
@@ -33,6 +33,7 @@ public class SimBridgeGuardTests
[typeof(StopWork)] = new StopWork(1),
[typeof(StartProject)] = new StartProject("housing", "tel_aviv", 1, 0),
[typeof(CancelProject)] = new CancelProject(1),
+ [typeof(BuyArms)] = new BuyArms(0),
};
static IEnumerable<Type> CommandTypes() =>
@@ -48,8 +49,8 @@ public class SimBridgeGuardTests
}
/// <summary>The command types whose order is one per turn by design, so their key is their kind (SimBridge.Key's
- /// default): one budget, one call-up level, one security order.</summary>
- static readonly HashSet<Type> OnePerTurn = new HashSet<Type> { typeof(AllocateBudget), typeof(SetMobilization), typeof(SecurityOrder) };
+ /// default): one budget, one call-up level, one security order, one Arms purchase (its count is the whole order).</summary>
+ static readonly HashSet<Type> OnePerTurn = new HashSet<Type> { typeof(AllocateBudget), typeof(SetMobilization), typeof(SecurityOrder), typeof(BuyArms) };
/// <summary>Every other command type has its own branch in SimBridge.Key, so its orders are not one per turn by accident
/// (a new type with a Validate branch and no Key branch would silently keep only the last order of the turn).</summary>