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: GDD Phase 3 PR 1, the twelve cities' census start values (refs #732) (#821)

Eyal Goland3843b1ca110
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ad285ba1c..394cf504e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,16 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
The checks file is now written in the bundle cache and copied beside the shipped bundles.
### Changed
+- The GDD game has its twelve cities (GDD Phase 3 PR 1, refs #732, #383; R-CITY-006, R-CITY-007): `content/cities.yaml`
+ holds the `city` and `town` rows of the 1948 settlements, each starting from its census population of 8 November 1948
+ (CBS Statistical Abstract No. 14, Table 11; Zikhron Ya'akov from No. 3; Rosh Pinna from Hebrew Wikipedia, as the owner
+ accepted on #569), with the CBS working share where one exists and labelled design values for the gaps (Q-START-1).
+ Every value carries a status (sourced, derived, wikipedia-only or design) and the loader refuses a historical value
+ without its sources and date. People become units to the nearest 1,000, at least 1 for a town with people
+ (Q-START-2): 511 units in all. With 211 employed units paying job income, `spending_per_capita_per_year` is re-derived
+ from the same Michaely anchor (IL 98.4m of internal debt over 1950-51) with that income included: 0.0001036, was
+ 0.000093 (owner, 16 October 2026, #821, option (a)); the run's 1950-51 debt rise is 98.7m. Every golden moves
+ (docs/determinism.md, rebaseline history).
- The top bar's Money figure is labelled net: "Money (net)", "כסף (נטו)" in Hebrew, and its tooltip says the same (refs
#681; owner, 16 October 2026: "keep one top-bar figure and label it as net (cash minus debt)"). The value is unchanged,
cash minus debt; the Budget screen still shows money and debt separately.
diff --git a/content/cities.yaml b/content/cities.yaml
index 246cea5bd..7beae1fb5 100644
--- a/content/cities.yaml
+++ b/content/cities.yaml
@@ -1,14 +1,102 @@
-# The GDD v0.1 cities and their start values (GDD "Cities and construction"; docs/rules/mvp.md R-CITY-001 to R-CITY-005).
-# Every number below is a design value: the owner's balance, set or accepted in review (Q-CUT-1, owner, 15 October 2026:
-# "Labelled design values"). None is a claim about Tel Aviv in 1948. Counts are population units of rules.yaml
-# mvp.people_per_unit people (D-A1). The MVP has one city so far (D-A4: Tel Aviv); Phase 3 adds the others.
-# DesignValuesTests lists every number here (R-LOOP-005); changing one is a balance edit that re-pins the goldens.
+# The MVP's twelve Jewish cities and towns (the `city` and `town` rows of map/settlements_1948.yaml) and their start values
+# (GDD "Cities and construction"; docs/rules/mvp.md R-CITY-001 to R-CITY-007; GDD Phase 3 PR 1, #732). The six kibbutzim and
+# moshavim are not cities in Phase 3 (Q-START-4, owner, 15 October 2026, #375).
+#
+# Every value says what it is (R-CITY-006):
+# - sourced: read from the source named. derived: computed from sourced values. wikipedia-only: an owner-accepted
+# Wikipedia figure. These name their sources (with checked dates) and the day or month they describe.
+# - design: a labelled design value, not a historical figure for this city (Q-CUT-1, R-LOOP-005; DesignValuesTests lists
+# each one, and changing one is a balance edit that re-pins the goldens).
+#
+# people: residents of all groups on the census day, 8 November 1948 (the Registration of Population), used as the start
+# on 15 May 1948 ("Census values + defaults", owner, 15 October 2026, on #569). The census counted the people who
+# arrived between May and November 1948; Phase 3 PR 2 handles them (Q-ARRV-3). Source: CBS, Statistical Abstract of
+# Israel No. 14 (1963), Table 11, "Population in settlements numbering above 5,000 inhabitants on 31 XII 1962
+# (1948-1962)", pp. 30-31, unless the row says otherwise. Research: #569, research_notes/GDD phase 3/.
+#
+# employed_share: the share of the people in work on 8 November 1948 (mobilised soldiers counted in their civilian
+# occupation, CBS note).
+# - Five cities: the city's share in CBS, Statistical Abstract of Israel No. 1 (1949/50), Registration of Population
+# (8 XI 1948), Table 9, "Jewish population by occupational status and sex (%)", p. 26. It is a share of the Jewish
+# population, applied here to all residents.
+# - Seven towns with no city share: the national share, 314,781 working of 716,678 Jews, 43.9% (CBS, Statistical
+# Abstract of Israel No. 2 (1950/51), Table 9, p. 24), as a design value (Q-START-1, owner, 15 October 2026, #375).
+#
+# housing_capacity and job_slots: no source gives either for any city (#569: "Housing, 0 of 12"; the census counts
+# working people, not job slots). Design values (Q-START-1): housing equal to the start people, job slots equal to the
+# start employed, so every city starts full and every arrival needs a housing or industry project.
+#
+# Units (R-CITY-007): counts are population units of rules.yaml mvp.people_per_unit people (D-A1). The loader turns people
+# into units to the nearest unit (a half rounds up), with at least 1 for a city with people (Q-START-2, owner,
+# 15 October 2026, #375), and the employed to the nearest unit of people times employed_share. housing_capacity and
+# job_slots are already in units.
cities:
- - id: tel_aviv # a settlement id of map/settlements_1948.yaml
- housing_capacity: 120 # DESIGN VALUE: owner-set balance, not a historical figure (D-A4)
- job_slots: 90 # DESIGN VALUE: owner-set balance, not a historical figure (D-A4)
- civilians: 100 # DESIGN VALUE: owner-set balance, not a historical figure (D-A4)
- employed: 80 # DESIGN VALUE: owner-set balance, not a historical figure (D-A4)
+ - id: jerusalem
+ people: { value: 83984, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.342, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1950_num1.pdf", checked: 2026-10-15 }] }
+ housing_capacity: { value: 84, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 29, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: tel_aviv
+ # CBS row "Tel Aviv-Yafo": one city, Jaffa included (owner, 15 October 2026, on #569).
+ people: { value: 248459, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.426, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1950_num1.pdf", checked: 2026-10-15 }] }
+ housing_capacity: { value: 248, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 106, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
# D-D5 (owner, 14 October 2026): one military camp and one Hakhshara exist at the start, a design assumption, not a
# claim about 1948. More are built by pioneers (Phase 4).
facilities: [military_camp, hakhshara]
+ - id: haifa
+ people: { value: 98618, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.429, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1950_num1.pdf", checked: 2026-10-15 }] }
+ housing_capacity: { value: 99, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 42, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: tiberias
+ people: { value: 5555, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.334, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1950_num1.pdf", checked: 2026-10-15 }] }
+ housing_capacity: { value: 6, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 2, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: safed
+ people: { value: 2317, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.345, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1950_num1.pdf", checked: 2026-10-15 }] }
+ housing_capacity: { value: 2, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 1, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: petah_tikva
+ people: { value: 21879, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 22, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 10, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: rishon_lezion
+ # 10,433 by owner decision (CBS SA 14); the CBS 2006 release gives 11,100 (#569).
+ people: { value: 10433, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 10, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 5, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: zikhron_yaakov
+ # CBS SA No. 3 (1951/52), Settlements in Israel, p. 133: 1,935 on 8 November 1948. It replaces the owner-accepted Hebrew
+ # Wikipedia figure of about 1,900 (#569).
+ people: { value: 1935, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1952_num3.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 2, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 1, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: rosh_pinna
+ # Hebrew Wikipedia: about 350 people in May 1948, accepted by the owner (15 October 2026, on #569). CBS SA No. 3,
+ # p. 144, lists Rosh Pinna with no population. 350 people round to 0 units; Q-START-2 gives a city with people at least 1.
+ people: { value: 350, status: wikipedia-only, date: 1948-05, sources: [{ url: "https://he.wikipedia.org/wiki/%D7%A8%D7%90%D7%A9_%D7%A4%D7%99%D7%A0%D7%94", checked: 2026-10-14 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 1, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 0, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: rehovot
+ people: { value: 12522, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 13, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 5, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: hadera
+ people: { value: 11811, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 12, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 5, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
+ - id: netanya
+ people: { value: 11589, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf", checked: 2026-10-15 }] }
+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the national share)
+ housing_capacity: { value: 12, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-D1, Q-START-1: the start people)
+ job_slots: { value: 5, status: design } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, Q-START-1: the start employed)
diff --git a/content/rules.yaml b/content/rules.yaml
index 6b31aca16..ae41280fc 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -74,8 +74,12 @@ fx_start: 40
tax_per_capita_per_year: 0.0000545
# Spending above taxes is borrowed. The gap is set so 1950-51 borrowing matches the rise in internal debt, IL 65.4m (1950)
# + 33.0m (1951) = 98.4m (Michaely Table 5-2, same chapter). The 1951 fiscal tightening is not modelled, so the model
-# matches the two-year total, not each year: (98.4m - 6m reserve call-up) / ~2.40m person-years = 0.0000385 per person.
-spending_per_capita_per_year: 0.000093
+# matches the two-year total, not each year. Job income (R-CITY-002) also reaches the Treasury, so the gap must cover it
+# too (owner, 16 October 2026, #821, option (a)): the twelve cities' 211 employed units (cities.yaml; HistoricalAI assigns
+# no workers) x mvp.income_per_job_per_year 0.06 x 2 years = 25.32m, and (98.4m - 6m reserve call-up + 25.32m) / ~2.40m
+# person-years = 0.00004905 per person. Spending = tax 0.0000545 + 0.00004905 = 0.00010355, rounded to 0.0001036.
+# (M3's value was 0.0000545 + 0.0000385 = 0.000093, derived before job income existed.)
+spending_per_capita_per_year: 0.0001036
# Exports cover under a third of imports (spec section 3; EconomyCalibrationTests checks it every turn of 1950-51).
exports_per_year: 40
imports_per_capita_per_year: 0.00025
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index 23d887e88..f226e3bcd 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -19,9 +19,9 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r
"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression brotli -shareable -logFile "$PWD/unity-build-web-br.log"
git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.asset
uv run tools/web_check.py unity/Builds/Web-brotli --query "golden&smoke=5" \
- --expect "GOLDEN OK 1950 ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4" \
- --expect "GOLDEN OK 1952 b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915" \
- --expect "SMOKE OK 5 turns 1948-10-15 848969ce7236d5fb4b8af33c2e6a8445d0a437a002b93cb076d54450c3d79e0a"
+ --expect "GOLDEN OK 1950 ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144" \
+ --expect "GOLDEN OK 1952 ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca" \
+ --expect "SMOKE OK 5 turns 1948-10-15 4104103f4e52fe4159f7b8d6acab9d2b651cd3c124952cfa74ebfd7333718ad5"
bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-israel-vX.Y.Z-web.zip
```
diff --git a/docs/determinism.md b/docs/determinism.md
index 0c3abc781..15c35995c 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 | `ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4` |
-| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915` |
-| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915` |
+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144` |
+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca` |
+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca` |
`hash1952` stops at the first turn on or after 1 January 1952, which is the game's last turn, so it is the same run as
`mvp-end` (`DeterminismTests.TheWholeGameToItsEndIsFixed`). Both names are kept (spec 2026-10-12 section 3 step 6): a
@@ -39,15 +39,15 @@ check `hash1950` and `hash1952`.
A further value is pinned for the browser smoke run (`?smoke=5`: the golden seed, five turns played through the UI's 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 848969ce7236d5fb4b8af33c2e6a8445d0a437a002b93cb076d54450c3d79e0a`.
+ministers): `SMOKE OK 5 turns 1948-10-15 4104103f4e52fe4159f7b8d6acab9d2b651cd3c124952cfa74ebfd7333718ad5`.
It depends on the UI path as well as the sim (which option is first, the turn grid), so re-record it when either changes.
Check every build with:
```
uv run tools/web_check.py unity/Builds/Web-<compression> --query "golden&smoke=5" \
- --expect "GOLDEN OK 1950 ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4" \
- --expect "GOLDEN OK 1952 b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915" \
- --expect "SMOKE OK 5 turns 1948-10-15 848969ce7236d5fb4b8af33c2e6a8445d0a437a002b93cb076d54450c3d79e0a"
+ --expect "GOLDEN OK 1950 ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144" \
+ --expect "GOLDEN OK 1952 ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca" \
+ --expect "SMOKE OK 5 turns 1948-10-15 4104103f4e52fe4159f7b8d6acab9d2b651cd3c124952cfa74ebfd7333718ad5"
```
**When a golden moves.** The test fails with the lines that changed, grouped by section (`[ind]`, `[pol]`, `[bud]`,
@@ -231,3 +231,10 @@ The hash reads the state keys, so it never sees a record outside its window. An
| GDD Phase 2 PR 3 | scenario-cautious | `5553c31a` | the new `food=` line only (`food=2253,751,0`) (was `58eb01db`) |
| GDD Phase 2 PR 3 | scenario-reckless | `42041362` | the new `food=` line only (`food=2253,751,0`) (was `e2f409a5`) |
| GDD Phase 2 PR 3 | scenario-mvp-absorb-first | `e01bb37a` | the new `food=` line only (`food=2556,852,0`) (was `f8858f6e`) |
+| GDD Phase 3 PR 1 | 1950 | `ea730229` | GDD Phase 3 PR 1's twelve cities (#821, R-CITY-006, R-CITY-007): the `city{}` section holds the twelve census starts (511 units; Tel Aviv 248 civilians and 106 employed, was 100 and 80) with every job filled, and `spending_per_capita_per_year` is re-derived with their job income (0.0001036, was 0.000093; owner, 16 October 2026, option (a)). The reference player sends no `AssignWorkers` on the first turn, so it trains its halutz group on 15 May 1948 (was 15 August) and builds Mefalsim on 15 March 1949 (was 15 June): `score=115` with the early bonus (was 100) (was `ca953c98`) |
+| GDD Phase 3 PR 1 | 1952 | `ca887e45` | same; debt ends at 170.9 (was 157.0) and `coh` at 0.4213 (was 0.4521) (was `b42380ab`) |
+| GDD Phase 3 PR 1 | mvp-end | `ca887e45` | same; the same run as hash1952 (was `b42380ab`) |
+| GDD Phase 3 PR 1 | smoke5 | `4104103f` | the twelve cities and the new spending in the first five turns (was `848969ce`) |
+| GDD Phase 3 PR 1 | scenario-cautious | `5f162f0f` | the twelve cities and the new spending (was `5553c31a`) |
+| GDD Phase 3 PR 1 | scenario-reckless | `a10877e2` | same (was `42041362`) |
+| GDD Phase 3 PR 1 | scenario-mvp-absorb-first | `53852f2c` | same (was `e01bb37a`) |
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 631cacfcf..869543284 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -48,6 +48,10 @@ R-CITY-004: Each turn, `min(refugees, max(0, housing_capacity - civilians))` of
R-CITY-005: Social cohesion is `clamp(0, 1, cohesion_housing_weight * housed + cohesion_jobs_weight * employed)`, where `housed` is civilians over civilians and refugees (1 with nobody) and `employed` is employed over civilians (1 with none), over all cities. It is a placeholder while D-C1 is open: no other system reads it.
+R-CITY-006: The cities are the `city` and `town` rows of `map/settlements_1948.yaml`, in that file's order, and their start values are `cities.yaml`'s. Each of a city's values (`people`, `employed_share`, `housing_capacity`, `job_slots`) is required and has a status: `sourced` (read from the source named), `derived` (computed from sourced values), `wikipedia-only` (an owner-accepted Wikipedia figure) or `design` (a labelled design value, R-LOOP-005). A `sourced`, `derived` or `wikipedia-only` value has at least one source, each with a url and a checked date, and the day (YYYY-MM-DD) or month (YYYY-MM) it describes; the loader refuses a value without them, naming the file and field (GDD Phase 3 plan, review focus 3).
+
+R-CITY-007: A city starts with `civilians` = `people / people_per_unit` to the nearest unit (a half rounds up), and at least 1 when `people` is above 0 (Q-START-2, owner, 15 October 2026); `employed` = `people * employed_share / people_per_unit` to the nearest unit; `housing_capacity` and `job_slots` as written, in units. The loader refuses a city whose start employed is above its job slots. The arithmetic is decimal, so it is exact on every runtime.
+
## Training
Training is step 4 of the turn in the approved order (§2.3, D-A6): it runs before production. One military camp and one Hakhshara exist in Tel Aviv at the start, a labelled design assumption (D-D5); pioneers will build more.
diff --git a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs b/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
index 350b0ac85..445c52650 100644
--- a/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
+++ b/sim/Statecraft.Sim.Tests/CitiesContentTests.cs
@@ -1,7 +1,9 @@
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Statecraft.Sim;
+using YamlDotNet.RepresentationModel;
/// <summary>The GDD slice's city data (Phase 1 PR 3, Task 3.1): cities.yaml, unit_types.yaml and the mvp: rules block. The
/// loader reads and requires them only when systems.loop is gdd. The real values are labelled design values in content/
@@ -37,34 +39,155 @@ public class CitiesContentTests
}
[Fact]
- public void TheRealGameHasTelAviv()
+ public void TheRealGameStartsTheTrainingInTelAviv()
{
var c = ContentLoader.Load(RealContentTests.ContentRoot());
- Assert.Equal("tel_aviv", Assert.Single(c.Cities).Id);
Assert.Equal("tel_aviv", c.RulesAt(c.Eras[0].From).Mvp!.ArrivalsCity);
Assert.True(c.Rules.AttentionCost.ContainsKey("assign_workers"));
- Assert.Equal(new[] { "military_camp", "hakhshara" }, c.Cities[0].Facilities); // D-D5: one of each at the start
+ Assert.Equal(new[] { "tel_aviv" }, c.Cities.Where(x => x.Facilities.Count > 0).Select(x => x.Id));
+ Assert.Equal(new[] { "military_camp", "hakhshara" }, c.Cities.Single(x => x.Id == "tel_aviv").Facilities); // D-D5: one of each at the start
Assert.Equal(new[] { ("recruit", "military_camp"), ("halutz", "hakhshara") },
c.UnitTypes.Where(t => t.Facility != "").Select(t => (t.Id, t.Facility)));
Assert.True(c.Rules.AttentionCost.ContainsKey("train") && c.Rules.AttentionCost.ContainsKey("cancel_training"));
}
- const string City = " - { id: town_a, housing_capacity: 12, job_slots: 8, civilians: 10, employed: 6, facilities: [] }\n";
+ /// <summary>The MVP's cities are the Jewish `city` and `town` rows of the 1948 settlements (the Phase 3 plan, PR 1; the six
+ /// kibbutzim and moshavim are not cities, Q-START-4, owner, 15 October 2026).</summary>
+ // R-CITY-006
+ [Fact]
+ public void TheTwelveCitiesAreTheCityAndTownRows()
+ {
+ var root = RealContentTests.ContentRoot();
+ var yaml = new YamlStream();
+ using (var r = new StringReader(File.ReadAllText(Path.Combine(root, "map", "settlements_1948.yaml")))) yaml.Load(r);
+ var rows = (YamlSequenceNode)((YamlMappingNode)yaml.Documents[0].RootNode)[new YamlScalarNode("settlements")];
+ var towns = rows.Cast<YamlMappingNode>()
+ .Where(m => ((YamlScalarNode)m[new YamlScalarNode("type")]).Value is "city" or "town")
+ .Select(m => ((YamlScalarNode)m[new YamlScalarNode("id")]).Value!).ToList();
+ Assert.Equal(12, towns.Count);
+ Assert.Equal(towns, ContentLoader.Load(root).Cities.Select(x => x.Id)); // in the settlements file's order
+ }
+
+ /// <summary>Each city's census start (the Phase 3 plan, PR 1, from #569) and its units at people_per_unit 1,000: people
+ /// to the nearest unit with at least 1 for a city with people (Q-START-2: Rosh Pinna's 350 is 1), employed to the nearest
+ /// unit of people times the working share (Q-START-1: the city's CBS share, or the national 43.9% where none exists).</summary>
+ public static IEnumerable<object[]> TheCensus() => new List<object[]>
+ {
+ new object[] { "jerusalem", 83984, "sourced", 0.342, "sourced", 84, 29 },
+ new object[] { "tel_aviv", 248459, "sourced", 0.426, "sourced", 248, 106 },
+ new object[] { "haifa", 98618, "sourced", 0.429, "sourced", 99, 42 },
+ new object[] { "tiberias", 5555, "sourced", 0.334, "sourced", 6, 2 },
+ new object[] { "safed", 2317, "sourced", 0.345, "sourced", 2, 1 },
+ new object[] { "petah_tikva", 21879, "sourced", 0.439, "design", 22, 10 },
+ new object[] { "rishon_lezion", 10433, "sourced", 0.439, "design", 10, 5 },
+ new object[] { "zikhron_yaakov", 1935, "sourced", 0.439, "design", 2, 1 },
+ new object[] { "rosh_pinna", 350, "wikipedia-only", 0.439, "design", 1, 0 },
+ new object[] { "rehovot", 12522, "sourced", 0.439, "design", 13, 5 },
+ new object[] { "hadera", 11811, "sourced", 0.439, "design", 12, 5 },
+ new object[] { "netanya", 11589, "sourced", 0.439, "design", 12, 5 },
+ };
+
+ // R-CITY-007
+ [Theory]
+ [MemberData(nameof(TheCensus))]
+ public void TheCensusValuesConvertAsStated(string id, int people, string peopleStatus, double share, string shareStatus, int civilians, int employed)
+ {
+ var x = ContentLoader.Load(RealContentTests.ContentRoot()).Cities.Single(k => k.Id == id);
+ Assert.Equal((people, peopleStatus), ((int)x.People!.Value, x.People.Status));
+ Assert.Equal(((decimal)share, shareStatus), (x.EmployedShare!.Value, x.EmployedShare.Status));
+ Assert.Equal((civilians, employed), (x.Civilians, x.Employed));
+ // Q-START-1's gaps, labelled design values: housing for every resident and a job slot for every worker.
+ Assert.Equal((civilians, employed), (x.HousingCapacity, x.JobSlots));
+ Assert.Equal(("design", "design"), (x.Housing!.Status, x.Jobs!.Status));
+ if (peopleStatus != "design") Assert.Equal(id == "rosh_pinna" ? "1948-05" : "1948-11-08", x.People.Date);
+ }
+
+ // R-CITY-007
+ [Fact]
+ public void TheTwelveCitiesStartWith511Units() => // 510 to the nearest unit, and Rosh Pinna's 1 (Q-START-2)
+ Assert.Equal(511, ContentLoader.Load(RealContentTests.ContentRoot()).Cities.Sum(x => x.Civilians));
+
+ /// <summary>The conversion's edges on the fixture (people_per_unit 10): half a unit rounds up, and a city with any people
+ /// has at least 1 unit; one with none has 0.</summary>
+ // R-CITY-007
+ [Theory]
+ [InlineData(0, 0)]
+ [InlineData(1, 1)]
+ [InlineData(4, 1)]
+ [InlineData(14, 1)]
+ [InlineData(15, 2)]
+ [InlineData(100, 10)]
+ public void PeopleRoundToTheNearestUnitWithAtLeastOne(int people, int units)
+ {
+ var c = Load(new Dictionary<string, string> { ["cities.yaml"] = People(FormattableString.Invariant($"people: {{ value: {people}, status: design }}")).Replace("value: 0.6", "value: 0").Replace("job_slots: { value: 8", "job_slots: { value: 0") });
+ Assert.Equal(units, Assert.Single(c.Cities).Civilians);
+ }
+
+ /// <summary>A historical value names its status, its sources with their checked dates, and the date it describes; a design
+ /// value names its status (the Phase 3 plan, review focus 3). Each refusal names the file and the field.</summary>
+ // R-CITY-006
+ [Theory]
+ [InlineData("people: { value: 100 }", "cities[town_a].people.status", "required")]
+ [InlineData("people: { value: 100, status: guessed }", "cities[town_a].people.status", "unknown status 'guessed' (sourced, derived, wikipedia-only or design)")]
+ [InlineData("people: { value: 100, status: sourced, date: 1948-11-08 }", "cities[town_a].people.sources", "required: a sourced value needs a source")]
+ [InlineData("people: { value: 100, status: derived, date: 1948-11-08 }", "cities[town_a].people.sources", "required: a derived value needs a source")]
+ [InlineData("people: { value: 100, status: wikipedia-only, date: 1948-05 }", "cities[town_a].people.sources", "required: a wikipedia-only value needs a source")]
+ [InlineData("people: { value: 100, status: sourced, date: 1948-11-08, sources: [{ url: \"https://example.org/census\" }] }", "cities[town_a].people.sources[0]", "needs a url and checked date")]
+ [InlineData("people: { value: 100, status: sourced, date: 1948-11-08, sources: [{ checked: 2026-10-15 }] }", "cities[town_a].people.sources[0]", "needs a url and checked date")]
+ [InlineData("people: { value: 100, status: sourced, sources: [{ url: \"https://example.org/census\", checked: 2026-10-15 }] }", "cities[town_a].people.date", "required: the day or month the value describes")]
+ [InlineData("people: { value: 100, status: sourced, date: 8 November 1948, sources: [{ url: \"https://example.org/census\", checked: 2026-10-15 }] }", "cities[town_a].people.date", "must be YYYY-MM-DD or YYYY-MM")]
+ [InlineData("people: { value: 100, status: sourced, date: 1948-02-30, sources: [{ url: \"https://example.org/census\", checked: 2026-10-15 }] }", "cities[town_a].people.date", "must be YYYY-MM-DD or YYYY-MM")]
+ public void EveryFieldHasAStatus(string people, string field, string message)
+ {
+ var ex = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string> { ["cities.yaml"] = People(people) }));
+ Assert.Equal("cities.yaml", ex.File);
+ Assert.Equal(field, ex.Field);
+ Assert.Contains(message, ex.Message);
+ }
+
+ /// <summary>Every field of a row is required, so a missing one is never read as 0.</summary>
+ // R-CITY-006
+ [Theory]
+ [InlineData("people")]
+ [InlineData("employed_share")]
+ [InlineData("housing_capacity")]
+ [InlineData("job_slots")]
+ public void AMissingFieldIsALoadError(string key)
+ {
+ var row = string.Join("\n", City.Split('\n').Where(l => !l.TrimStart().StartsWith(key + ":", StringComparison.Ordinal)));
+ var ex = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string> { ["cities.yaml"] = Cities(row) }));
+ Assert.Equal(("cities.yaml", $"cities[town_a].{key}"), (ex.File, ex.Field));
+ Assert.Contains("required", ex.Message);
+ }
+
+ // R-CITY-006
+ [Theory]
+ [InlineData(Census)]
+ [InlineData("people: { value: 100, status: wikipedia-only, date: 1948-05, sources: [{ url: \"https://example.org/wiki\", checked: 2026-10-15 }] }")]
+ [InlineData("people: { value: 100, status: design, sources: [{ url: \"https://example.org/method\", checked: 2026-10-15 }] }")] // a design value may name what its method rests on
+ public void AValueWithItsStatusLoads(string people) =>
+ Assert.Equal(10, Assert.Single(Load(new Dictionary<string, string> { ["cities.yaml"] = People(people) }).Cities).Civilians);
+
+ const string City = " - id: town_a\n people: { value: 100, status: design }\n employed_share: { value: 0.6, status: design }\n"
+ + " housing_capacity: { value: 12, status: design }\n job_slots: { value: 8, status: design }\n facilities: []\n";
+ const string Design = "people: { value: 100, status: design }";
+ const string Census = "people: { value: 100, status: sourced, date: 1948-11-08, sources: [{ url: \"https://example.org/census\", checked: 2026-10-15 }] }";
static string Cities(string row) => "cities:\n" + row;
static string Rules(string mvp) => Fixture.Files["rules.yaml"].Replace("map_action: 1 }", Fixture.GddCosts) + mvp;
static string Types(string row) => "types:\n - { id: civilian, kind: population }\n" + row;
+ static string People(string value) => Cities(City.Replace(Design, value));
public static IEnumerable<object[]> BadRows() => new List<object[]>
{
new object[] { "cities.yaml", Cities(City + City), "cities[town_a].id", "duplicate id" },
new object[] { "cities.yaml", Cities(City.Replace("town_a", "nowhere")), "cities[nowhere].id", "is not in map/settlements_1948.yaml" },
- new object[] { "cities.yaml", Cities(City.Replace("civilians: 10", "civilians: -1")), "cities[town_a].civilians", "must be >= 0" },
- new object[] { "cities.yaml", Cities(City.Replace("housing_capacity: 12", "housing_capacity: -1")), "cities[town_a].housing_capacity", "must be >= 0" },
- new object[] { "cities.yaml", Cities(City.Replace("job_slots: 8", "job_slots: -1")), "cities[town_a].job_slots", "must be >= 0" },
- new object[] { "cities.yaml", Cities(City.Replace("employed: 6", "employed: -1")), "cities[town_a].employed", "must be >= 0" },
- new object[] { "cities.yaml", Cities(City.Replace("employed: 6", "employed: 11").Replace("job_slots: 8", "job_slots: 20")), "cities[town_a].employed", "cannot be more than civilians" },
- new object[] { "cities.yaml", Cities(City.Replace("employed: 6", "employed: 9")), "cities[town_a].employed", "cannot be more than job_slots" },
+ new object[] { "cities.yaml", People("people: { value: -1, status: design }"), "cities[town_a].people.value", "must be a whole number >= 0" },
+ new object[] { "cities.yaml", People("people: { value: 100.5, status: design }"), "cities[town_a].people.value", "must be a whole number >= 0" },
+ new object[] { "cities.yaml", Cities(City.Replace("housing_capacity: { value: 12", "housing_capacity: { value: -1")), "cities[town_a].housing_capacity.value", "must be a whole number >= 0" },
+ new object[] { "cities.yaml", Cities(City.Replace("job_slots: { value: 8", "job_slots: { value: -1")), "cities[town_a].job_slots.value", "must be a whole number >= 0" },
+ new object[] { "cities.yaml", Cities(City.Replace("employed_share: { value: 0.6", "employed_share: { value: 1.2")), "cities[town_a].employed_share.value", "must be a number from 0 to 1" },
+ new object[] { "cities.yaml", Cities(City.Replace("employed_share: { value: 0.6", "employed_share: { value: 0.9")), "cities[town_a].job_slots.value", "fewer than the 9 employed units" },
new object[] { "cities.yaml", Cities(City.Replace("facilities: []", "facilities: [winery]")), "cities[town_a].facilities", "unknown facility 'winery'" },
new object[] { "cities.yaml", "cities: []\n", "mvp.arrivals_city", "is not a city in cities.yaml" },
new object[] { "unit_types.yaml", "types:\n - { id: civilian, kind: population }\n - { id: civilian, kind: population }\n", "types[civilian].id", "duplicate id" },
diff --git a/sim/Statecraft.Sim.Tests/CitiesTests.cs b/sim/Statecraft.Sim.Tests/CitiesTests.cs
index 643717225..d00b35ede 100644
--- a/sim/Statecraft.Sim.Tests/CitiesTests.cs
+++ b/sim/Statecraft.Sim.Tests/CitiesTests.cs
@@ -10,8 +10,8 @@ public class CitiesTests
static readonly Content Mvp = ContentLoader.Load(RealContentTests.ContentRoot());
/// <summary>The GDD fixture with one city: 20 jobs, 10 civilians, 6 of them employed, housing for 12.</summary>
- static Content Town(string city = " - { id: town_a, housing_capacity: 12, job_slots: 20, civilians: 10, employed: 6, facilities: [] }\n") =>
- ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string> { ["cities.yaml"] = "cities:\n" + city })));
+ static Content Town(string? city = null) =>
+ ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string> { ["cities.yaml"] = "cities:\n" + (city ?? Fixture.City("town_a", 12, 20, 10, 6)) })));
static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);
@@ -19,8 +19,9 @@ public class CitiesTests
public void ANewGddGameStartsWithItsCities()
{
var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
- var city = Assert.Single(s.Cities.Values);
- Assert.Equal(("tel_aviv", 120, 90, 100, 80, 0), (city.Id, city.HousingCapacity, city.JobSlots, city.Civilians, city.Employed, city.Refugees));
+ Assert.Equal(Mvp.Cities.Select(x => x.Id).OrderBy(x => x, StringComparer.Ordinal), s.Cities.Keys);
+ var city = s.Cities["tel_aviv"]; // the census start of Tel Aviv-Yafo (R-CITY-007)
+ Assert.Equal(("tel_aviv", 248, 106, 248, 106, 0), (city.Id, city.HousingCapacity, city.JobSlots, city.Civilians, city.Employed, city.Refugees));
}
[Fact]
@@ -109,13 +110,14 @@ public class CitiesTests
[Fact]
public void ATurnsArrivalsAreHousedOnTheNextTurn()
{
- var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
+ // Tel Aviv starts full (Q-START-1: housing equals the start people), so 20 of its people are moved out to free room.
+ var s = With(Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical), "tel_aviv", 228, 106, 0);
var one = Step(Mvp, s).State;
var arrived = one.Cities["tel_aviv"].Refugees;
Assert.True(arrived > 0);
- Assert.Equal(100, one.Cities["tel_aviv"].Civilians); // housing for 20 more was free, but it ran before they came
+ Assert.Equal(228, one.Cities["tel_aviv"].Civilians); // housing for 20 more was free, but it ran before they came
var two = Step(Mvp, one).State.Cities["tel_aviv"];
- Assert.Equal(100 + Math.Min(arrived, 20), two.Civilians);
+ Assert.Equal(228 + Math.Min(arrived, 20), two.Civilians);
}
// R-CITY-003
@@ -169,7 +171,7 @@ public class CitiesTests
/// either share shows apart from the other.</summary>
static Content Unequal() => ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string>
{
- ["cities.yaml"] = "cities:\n - { id: town_a, housing_capacity: 12, job_slots: 20, civilians: 10, employed: 6, facilities: [] }\n",
+ ["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 20, 10, 6),
["rules.yaml"] = Fixture.Files["rules.yaml"].Replace("map_action: 1 }", Fixture.GddCosts)
+ Fixture.GddRules.Replace("cohesion_housing_weight: 0.5", "cohesion_housing_weight: 0.8").Replace("cohesion_jobs_weight: 0.5", "cohesion_jobs_weight: 0.2"),
})));
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index e7e752dfa..7d4cad9f0 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -33,10 +33,40 @@ public class DesignValuesTests
("rules.yaml", "mvp.objective_bonus_cap"),
("rules.yaml", "mvp.k_food"),
("rules.yaml", "mvp.cover_months"),
- ("cities.yaml", "cities[tel_aviv].housing_capacity"),
- ("cities.yaml", "cities[tel_aviv].job_slots"),
- ("cities.yaml", "cities[tel_aviv].civilians"),
- ("cities.yaml", "cities[tel_aviv].employed"),
+ // Q-START-1 (owner, 15 October 2026, #375): no city has a sourced housing stock or job count, so every city's
+ // housing is its start people and its job slots its start employed; seven towns with no CBS working share take
+ // the national one. The census people and the five CBS shares are sourced, not design values (R-CITY-006).
+ ("cities.yaml", "cities[jerusalem].housing_capacity.value"),
+ ("cities.yaml", "cities[jerusalem].job_slots.value"),
+ ("cities.yaml", "cities[tel_aviv].housing_capacity.value"),
+ ("cities.yaml", "cities[tel_aviv].job_slots.value"),
+ ("cities.yaml", "cities[haifa].housing_capacity.value"),
+ ("cities.yaml", "cities[haifa].job_slots.value"),
+ ("cities.yaml", "cities[tiberias].housing_capacity.value"),
+ ("cities.yaml", "cities[tiberias].job_slots.value"),
+ ("cities.yaml", "cities[safed].housing_capacity.value"),
+ ("cities.yaml", "cities[safed].job_slots.value"),
+ ("cities.yaml", "cities[petah_tikva].employed_share.value"),
+ ("cities.yaml", "cities[petah_tikva].housing_capacity.value"),
+ ("cities.yaml", "cities[petah_tikva].job_slots.value"),
+ ("cities.yaml", "cities[rishon_lezion].employed_share.value"),
+ ("cities.yaml", "cities[rishon_lezion].housing_capacity.value"),
+ ("cities.yaml", "cities[rishon_lezion].job_slots.value"),
+ ("cities.yaml", "cities[zikhron_yaakov].employed_share.value"),
+ ("cities.yaml", "cities[zikhron_yaakov].housing_capacity.value"),
+ ("cities.yaml", "cities[zikhron_yaakov].job_slots.value"),
+ ("cities.yaml", "cities[rosh_pinna].employed_share.value"),
+ ("cities.yaml", "cities[rosh_pinna].housing_capacity.value"),
+ ("cities.yaml", "cities[rosh_pinna].job_slots.value"),
+ ("cities.yaml", "cities[rehovot].employed_share.value"),
+ ("cities.yaml", "cities[rehovot].housing_capacity.value"),
+ ("cities.yaml", "cities[rehovot].job_slots.value"),
+ ("cities.yaml", "cities[hadera].employed_share.value"),
+ ("cities.yaml", "cities[hadera].housing_capacity.value"),
+ ("cities.yaml", "cities[hadera].job_slots.value"),
+ ("cities.yaml", "cities[netanya].employed_share.value"),
+ ("cities.yaml", "cities[netanya].housing_capacity.value"),
+ ("cities.yaml", "cities[netanya].job_slots.value"),
("unit_types.yaml", "types[recruit].training_turns"),
("unit_types.yaml", "types[recruit].training_cost"),
("unit_types.yaml", "types[halutz].training_turns"),
@@ -45,7 +75,9 @@ public class DesignValuesTests
/// <summary>Every number in the GDD files and blocks, as (file, key path, the line it is on). Scope: all of cities.yaml and
- /// unit_types.yaml, rules.yaml mvp:, and the GDD kinds under rules.yaml attention_cost.</summary>
+ /// unit_types.yaml, rules.yaml mvp:, and the GDD kinds under rules.yaml attention_cost. A value whose own mapping says
+ /// `status: sourced`, `derived` or `wikipedia-only` is a historical figure, not balance: the loader holds it to its
+ /// sources and date instead (cities.yaml, R-CITY-006), so it is left out.</summary>
public static List<(string File, string Key, string Line)> Numbers(string root)
{
var found = new List<(string, string, string)>();
@@ -62,6 +94,8 @@ public class DesignValuesTests
switch (node)
{
case YamlMappingNode m:
+ if (m.Children.TryGetValue(new YamlScalarNode("status"), out var st) && st is YamlScalarNode ss
+ && (ss.Value == "sourced" || ss.Value == "derived" || ss.Value == "wikipedia-only")) break;
foreach (var kv in m.Children)
{
var k = ((YamlScalarNode)kv.Key).Value!;
@@ -117,8 +151,9 @@ public class DesignValuesTests
Assert.Equal((0.0, 0.0), (c.Rules.AttentionCost["pioneer_work"], c.Rules.AttentionCost["stop_work"])); // D-A6: unit orders are free
Assert.Equal((6, 2.0), (m.BuildYishuvTurns, m.BuildYishuvCost));
Assert.Equal((100, 5, 60), (m.ObjectivePoints, m.ObjectiveBonusPerMonth, m.ObjectiveBonusCap)); // D-B6, D-B2
- var city = Assert.Single(c.Cities);
- Assert.Equal(("tel_aviv", 120, 90, 100, 80), (city.Id, city.HousingCapacity, city.JobSlots, city.Civilians, city.Employed));
+ 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));
Assert.Equal(new[] { ("recruit", 3, 0.5), ("halutz", 4, 0.5) },
c.UnitTypes.Where(t => t.Facility != "").Select(t => (t.Id, t.TrainingTurns, t.TrainingCost)));
}
@@ -129,10 +164,12 @@ public class DesignValuesTests
{
var dir = Fixture.Write(Fixture.Gdd(new Dictionary<string, string>
{
- ["cities.yaml"] = "cities:\n - id: town_a\n housing_capacity: 12 " + Tag + " (D-A4)\n job_slots: 8\n",
+ ["cities.yaml"] = "cities:\n - id: town_a\n people: { value: 100, status: sourced, date: 1948-11-08, sources: [{ url: \"https://example.org/census\", checked: 2026-10-15 }] }\n"
+ + " housing_capacity: { value: 12, status: design } " + Tag + " (D-A4)\n job_slots: { value: 8, status: design }\n",
}));
var numbers = Numbers(dir).Where(n => n.File == "cities.yaml").ToList();
- Assert.Equal(new[] { "cities[town_a].housing_capacity", "cities[town_a].job_slots" }, numbers.Select(n => n.Key));
+ // the sourced census value is not a balance number; the two design values are, tagged or not
+ Assert.Equal(new[] { "cities[town_a].housing_capacity.value", "cities[town_a].job_slots.value" }, numbers.Select(n => n.Key));
Assert.Contains(Tag, numbers[0].Line);
Assert.DoesNotContain(Tag, numbers[1].Line);
// rules.yaml: the mvp block and the GDD kinds are in scope, the legacy numbers are not.
diff --git a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
index b45804353..8a473b040 100644
--- a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
+++ b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
@@ -9,7 +9,11 @@ using Statecraft.Sim;
///
/// ANCHOR INDEPENDENCE (as in CalibrationTests): rules.yaml derives or tunes a parameter from each of the first four
/// anchors, so they are CONSISTENCY checks that the derivation holds in play:
-/// - internal debt rose IL 98.4m over 1950-51 (Michaely 1975, Table 5-2: 65.4 + 33.0): spending_per_capita is derived from it;
+/// - internal debt rose IL 98.4m over 1950-51 (Michaely 1975, Table 5-2: 65.4 + 33.0): spending_per_capita is derived from it,
+/// with the cities' job income included (owner, 16 October 2026, #821, option (a)): the gap over taxes is
+/// (98.4m - 6m reserve call-up + 211 employed units x 0.06 x 2 years = 25.32m) / ~2.40m person-years = 0.00004905, so
+/// spending = 0.0000545 + 0.00004905 = 0.0001036 (rounded); the run gives 98.7m. Before GDD Phase 3 PR 1 it was 0.000093
+/// and the run gave 88.7m, the 9.6m of Tel Aviv's job income below the anchor;
/// - the FY 1950/51 ordinary budget was IL 60m (en.wiki "1950 in Israel"): tax_per_capita is derived from it;
/// - exports covered under a third of imports (spec section 3): exports and imports were chosen to satisfy it;
/// - foreign currency ran out in autumn 1951 (FRUS 1951 v.V doc 513): capital_inflow_per_year is tuned to it.
diff --git a/sim/Statecraft.Sim.Tests/EventRetimingTests.cs b/sim/Statecraft.Sim.Tests/EventRetimingTests.cs
index c202a8c46..cd3871823 100644
--- a/sim/Statecraft.Sim.Tests/EventRetimingTests.cs
+++ b/sim/Statecraft.Sim.Tests/EventRetimingTests.cs
@@ -62,7 +62,7 @@ public class EventRetimingTests
[InlineData("armistice_lebanon", "1949-04-15")]
[InlineData("armistice_jordan", "1949-04-15")]
[InlineData("austerity_1949", "1949-05-15")]
- [InlineData("first_new_yishuv", "1949-06-15")] // R-OBJ-003: the turn the reference player builds Mefalsim
+ [InlineData("first_new_yishuv", "1949-03-15")] // R-OBJ-003: the turn the reference player builds Mefalsim (1949-06-15 before GDD Phase 3 PR 1)
[InlineData("armistice_syria", "1949-08-15")]
[InlineData("frumkin_commission", "1950-01-15")]
[InlineData("maabarot_policy", "1950-04-15")]
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index 4a4e0de1d..458dbe3e4 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -231,10 +231,12 @@ mvp:
cover_months: 3
";
- public const string GddCities = @"
-cities:
- - { id: town_a, housing_capacity: 12, job_slots: 8, civilians: 10, employed: 6, facilities: [military_camp, hakhshara] }
-";
+ public static readonly string GddCities = "\ncities:\n" + City("town_a", 12, 8, 10, 6, "[military_camp, hakhshara]");
+
+ /// <summary>One cities.yaml row in the fixture's units (people_per_unit 10): every field a design value (fixture values,
+ /// not history), with the people and the employed share chosen so they convert to the given units (R-CITY-007).</summary>
+ public static string City(string id, int housing, int jobs, int civilians, int employed, string facilities = "[]") =>
+ FormattableString.Invariant($" - {{ id: {id}, people: {{ value: {civilians * 10}, status: design }}, employed_share: {{ value: {(civilians == 0 ? 0m : (decimal)employed / civilians)}, status: design }}, housing_capacity: {{ value: {housing}, status: design }}, job_slots: {{ value: {jobs}, status: design }}, facilities: {facilities} }}\n");
public const string GddUnitTypes = @"
types:
diff --git a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs b/sim/Statecraft.Sim.Tests/ObjectivesTests.cs
index 7529efce7..3d7ecf449 100644
--- a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs
+++ b/sim/Statecraft.Sim.Tests/ObjectivesTests.cs
@@ -257,16 +257,18 @@ eras:
Assert.Empty(card.Tags);
}
- // R-OBJ-001 to R-OBJ-003 in the golden run: the reference player builds Mefalsim on 15 June 1949 (#566), the month of its
- // 12 June 1949 founding, so the first new yishuv is on time and scores 100, and its card fires and is answered.
+ // R-OBJ-001 to R-OBJ-003 in the golden run: the reference player builds Mefalsim on 15 March 1949, three months before its
+ // 12 June 1949 founding, so the first new yishuv scores 100 and the early bonus (D-B2), and its card fires and is answered.
+ // Since GDD Phase 3 PR 1 the cities start with every job filled (Q-START-1), so the player trains its halutz group on the
+ // first turn instead of on 15 August 1948 (ReferencePlayerTests); before, it built on 15 June 1949 and scored 100.
[Fact]
public void TheGoldenRunCompletesTheFirstNewYishuvOnTheBuildDate()
{
var s = GoldenRun.Play(Real, GoldenRun.Until1950);
var built = s.Sites["mefalsim"].BuiltOn!.Value;
- Assert.Equal(new DateTime(1949, 6, 15), built);
+ Assert.Equal(new DateTime(1949, 3, 15), built);
Assert.Equal(built, s.Objectives["first_new_yishuv"]);
- Assert.Equal(100, s.Score);
+ Assert.Equal(100 + 3 * 5, s.Score); // D-B6 and D-B2: +5 a month for three months early
Assert.Equal("continue", s.ChosenOptions["first_new_yishuv"]);
}
diff --git a/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs b/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
index be6049bbe..931beebfc 100644
--- a/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
+++ b/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
@@ -26,20 +26,22 @@ public class ReferencePlayerTests
public void ItSendsHistoricalAIsOrdersThenFillsTheJobsThenTrainsOneHalutzGroup()
{
var s = Start();
+ s.Cities["tel_aviv"] = s.Cities["tel_aviv"].WithCounts(248, 96, 0); // the start fills every job (Q-START-1): free 10
var orders = ReferencePlayer.Commands(Mvp, s);
var history = HistoricalAI.Commands(Mvp, s);
Assert.Equal(history.Select(x => x.Kind), orders.Take(history.Count).Select(x => x.Kind));
Assert.Equal(history.Count + 2, orders.Count);
var assign = Assert.IsType<AssignWorkers>(orders[history.Count]);
- Assert.Equal(("tel_aviv", "job", 90), (assign.City, assign.Role, assign.Count)); // min(90 jobs, 100 civilians)
+ Assert.Equal(("tel_aviv", "job", 106), (assign.City, assign.Role, assign.Count)); // min(106 jobs, 248 civilians)
var train = Assert.IsType<Train>(orders.Last());
- Assert.Equal(("tel_aviv", "halutz", 1), (train.City, train.Track, train.Count)); // 10 civilians left without work
+ Assert.Equal(("tel_aviv", "halutz", 1), (train.City, train.Track, train.Count)); // 142 civilians left without work
Assert.Empty(Simulation.Step(Mvp, s, orders).Rejected);
}
- /// <summary>The real start: the 15 May card (idf_founding) is answered first, at full war's price, and the jobs are
- /// filled; the halutz group no longer fits that turn's 4 Attention (Q-CUT-5 keeps 4), so the player trains on the first
- /// later turn that has the Attention (the turn from 15 August 1948 in the golden run), and every order it sends is taken.</summary>
+ /// <summary>The real start: the 15 May card (idf_founding) is answered first, at full war's price. The cities start with
+ /// every job filled (Q-START-1: job slots equal the start employed), so no AssignWorkers takes Attention, and the halutz
+ /// group fits the rest of that turn's 4 Attention (Q-CUT-5): the player trains on the first turn, 15 May 1948 (before
+ /// GDD Phase 3 PR 1 it filled Tel Aviv's jobs first and trained from 15 August 1948). Every order it sends is taken.</summary>
[Fact]
public void OnTheRealStartItAnswersTheCardFirstAndTrainsWhenAttentionAllows()
{
@@ -47,8 +49,8 @@ public class ReferencePlayerTests
Assert.Contains("idf_founding", s.PendingEvents);
var first = ReferencePlayer.Commands(Mvp, s);
Assert.IsType<ChooseEventOption>(first[0]);
- Assert.Contains(first, x => x is AssignWorkers);
- Assert.DoesNotContain(first, x => x is Train);
+ Assert.DoesNotContain(first, x => x is AssignWorkers);
+ Assert.Contains(first, x => x is Train);
DateTime? trained = null;
while (trained == null && s.GameOver == null && s.Turn < 1000)
{
@@ -58,7 +60,7 @@ public class ReferencePlayerTests
if (orders.Any(x => x is Train)) trained = s.Date;
s = r.State;
}
- Assert.Equal(new DateTime(1948, 8, 15), trained);
+ Assert.Equal(new DateTime(1948, 5, 15), trained);
}
// R-TRAIN-001: the stated policy trains a halutz group only when there is none, none in training, a civilian without
@@ -79,7 +81,7 @@ public class ReferencePlayerTests
trained.Units.Add(1, new Unit(1, "halutz", -3, 19));
Assert.DoesNotContain(ReferencePlayer.Commands(Mvp, trained), x => x is Train);
var busy = s.Clone();
- busy.Cities["tel_aviv"] = busy.Cities["tel_aviv"].WithCounts(90, 80, 0); // 90 jobs: all of them filled
+ busy.Cities["tel_aviv"] = busy.Cities["tel_aviv"].WithCounts(106, 106, 0); // 106 jobs: all filled, nobody free
Assert.DoesNotContain(ReferencePlayer.Commands(Mvp, busy), x => x is Train);
var poor = s.Clone();
poor.Treasury = 0; // training borrows (owner decision, 2026-10-15): an empty Treasury does not hold it back
@@ -160,7 +162,7 @@ public class ReferencePlayerTests
{
var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
var full = s.Clone();
- full.Cities["tel_aviv"] = full.Cities["tel_aviv"].WithCounts(100, 90, 0);
+ full.Cities["tel_aviv"] = full.Cities["tel_aviv"].WithCounts(120, 106, 0); // all 106 jobs filled
Assert.DoesNotContain(ReferencePlayer.Commands(Mvp, full), x => x is AssignWorkers);
var tired = s.Clone();
tired.Attention = 0;
@@ -171,7 +173,7 @@ public class ReferencePlayerTests
public void ItFillsNoMoreJobsThanThereAreCivilians()
{
var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
- s.Cities["tel_aviv"] = s.Cities["tel_aviv"].WithCounts(50, 40, 0); // 90 jobs, 50 civilians
+ s.Cities["tel_aviv"] = s.Cities["tel_aviv"].WithCounts(50, 40, 0); // 106 jobs, 50 civilians
var assign = Assert.IsType<AssignWorkers>(ReferencePlayer.Commands(Mvp, s).Last());
Assert.Equal(50, assign.Count);
}
diff --git a/sim/Statecraft.Sim.Tests/TrainingTests.cs b/sim/Statecraft.Sim.Tests/TrainingTests.cs
index e672287bc..30fa20afd 100644
--- a/sim/Statecraft.Sim.Tests/TrainingTests.cs
+++ b/sim/Statecraft.Sim.Tests/TrainingTests.cs
@@ -13,7 +13,7 @@ public class TrainingTests
static Content Town(string facilities = "[military_camp, hakhshara]") =>
ContentLoader.Load(Fixture.Write(Fixture.Gdd(new Dictionary<string, string>
{
- ["cities.yaml"] = "cities:\n - { id: town_a, housing_capacity: 12, job_slots: 20, civilians: 10, employed: 6, facilities: " + facilities + " }\n",
+ ["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 20, 10, 6, facilities),
})));
static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);
@@ -22,7 +22,8 @@ public class TrainingTests
[Fact]
public void TheSliceStartsWithOneCampAndOneHakhshara()
{
- Assert.Equal(new[] { "military_camp", "hakhshara" }, Assert.Single(Mvp.Cities).Facilities);
+ Assert.Equal(new[] { "military_camp", "hakhshara" }, Assert.Single(Mvp.Cities, x => x.Facilities.Count > 0 && x.Id == "tel_aviv").Facilities);
+ Assert.Single(Mvp.Cities, x => x.Facilities.Count > 0); // the twelve cities have one camp and one Hakhshara between them
var s = Simulation.NewGame(Mvp, GoldenRun.Seed, Mode.Historical);
Assert.Empty(s.Cohorts);
Assert.Equal(0, s.Cities["tel_aviv"].Recruits);
@@ -269,8 +270,8 @@ public class TrainingTests
["map/settlement_hexes.yaml"] = "settlements:\n - { id: town_a, q: 1, r: 0 }\n - { id: town_b, q: 2, r: 1 }\n",
["map/settlements_1948.yaml"] = Fixture.Files["map/settlements_1948.yaml"]
+ " - { id: town_b, name: Town B, lon: 34.42, lat: 33.28, type: town, founded: 1900, pre_modern: false }\n",
- ["cities.yaml"] = "cities:\n - { id: town_a, housing_capacity: 12, job_slots: 20, civilians: 10, employed: 6, facilities: [hakhshara] }\n"
- + " - { id: town_b, housing_capacity: 12, job_slots: 20, civilians: 10, employed: 6, facilities: [hakhshara] }\n",
+ ["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 20, 10, 6, "[hakhshara]")
+ + Fixture.City("town_b", 12, 20, 10, 6, "[hakhshara]"),
})));
var s = Simulation.NewGame(c, 1, Mode.Historical);
s.Attention = 10; // two orders on the fixture's first turn
diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
index 27da8b136..410632ec2 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1950.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1950.txt
@@ -41,7 +41,7 @@ pop{
veterans=667938.2378207468 [4124624479C3A414]
sit[
treasury=0 [0000000000000000]
-debt=68.95239590417494 [40513CF40DF351A5]
+debt=71.50032828298673 [4051E00560EB2C47]
fx=94.52989672613671 [4057A1E9D3F540F0]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
@@ -100,14 +100,25 @@ map[
mapturn=0001-01-01:0;
over=
city{
- tel_aviv=120,90,120,90,327
-coh=0.5148601398601399 [3FE079BBF8D6D33F]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,106,347
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.5106245923026744 [3FE05709628F2570]
units[
1:halutz@-3,19
site{
- mefalsim=done,1949-06-15
+ mefalsim=done,1949-03-15
next=2
obj{
- first_new_yishuv=1949-06-15
-score=100
+ first_new_yishuv=1949-03-15
+score=115
food=3003,1001,0
\ 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 f47373c10..9300679e2 100644
--- a/sim/Statecraft.Sim.Tests/golden/hash1952.txt
+++ b/sim/Statecraft.Sim.Tests/golden/hash1952.txt
@@ -42,7 +42,7 @@ pop{
sit[
fx_crisis
treasury=0 [0000000000000000]
-debt=157.01852642452684 [4063A097C4BA6E8C]
+debt=170.89012071283815 [40655C7BDE6EE43A]
fx=-12.990431328096559 [C029FB19D0A63796]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
@@ -121,14 +121,25 @@ map[
mapturn=0001-01-01:0;
over=mvp_ended
city{
- tel_aviv=120,90,120,90,666
-coh=0.45212082262210795 [3FDCEF8C2CC02A1E]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,106,686
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.42134438484542747 [3FDAF74E7050EB18]
units[
1:halutz@-3,19
site{
- mefalsim=done,1949-06-15
+ mefalsim=done,1949-03-15
next=2
obj{
- first_new_yishuv=1949-06-15
-score=100
+ first_new_yishuv=1949-03-15
+score=115
food=2732,1390,0
\ 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 0e67bdf8b..58b892460 100644
--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt
+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt
@@ -2,10 +2,10 @@
# Tests read this file. To accept a deliberate change: STATECRAFT_UPDATE_GOLDEN=1 dotnet test sim/Statecraft.sln
# rewrites this file, the snapshots and the GoldenRun.cs constants; then update docs/determinism.md and tools/web_check.py
# (GoldenManifestTests names any place that is out of date) and add a row to the rebaseline history.
-hash1950 ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4
-hash1952 b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915
-smoke5 848969ce7236d5fb4b8af33c2e6a8445d0a437a002b93cb076d54450c3d79e0a
-scenario-reckless 420413626ec62b65f878a3cd6926d2eeec6fb0d918f3ba9e488c4f909bdf7534
-scenario-cautious 5553c31a095f6b67c88f0885eca13141438d964bf07fb39af96e6bb4f3555ca8
-scenario-mvp-absorb-first e01bb37a1b933a1b883655cc184c5fece35e82ad3f5890ffedcfdef5e0ff3909
-mvp-end b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915
+hash1950 ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144
+hash1952 ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca
+smoke5 4104103f4e52fe4159f7b8d6acab9d2b651cd3c124952cfa74ebfd7333718ad5
+scenario-reckless a10877e2060d7a3f6df59c0ce3df7a9be96367b1054ccc4aa9e55a8eb0f88579
+scenario-cautious 5f162f0fba0a2fa2406fc5c73ea333b7d1ceb6c0398215a882fc29b9deae4dbf
+scenario-mvp-absorb-first 53852f2c7d72e2b5bbc5977ecb0876c6f64ba6480a2ea1211d677e3c25415dd2
+mvp-end ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca
diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
index f47373c10..9300679e2 100644
--- a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
+++ b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt
@@ -42,7 +42,7 @@ pop{
sit[
fx_crisis
treasury=0 [0000000000000000]
-debt=157.01852642452684 [4063A097C4BA6E8C]
+debt=170.89012071283815 [40655C7BDE6EE43A]
fx=-12.990431328096559 [C029FB19D0A63796]
rung=2;cf=0;
mob=0.05 [3FA999999999999A]
@@ -121,14 +121,25 @@ map[
mapturn=0001-01-01:0;
over=mvp_ended
city{
- tel_aviv=120,90,120,90,666
-coh=0.45212082262210795 [3FDCEF8C2CC02A1E]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,106,686
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.42134438484542747 [3FDAF74E7050EB18]
units[
1:halutz@-3,19
site{
- mefalsim=done,1949-06-15
+ mefalsim=done,1949-03-15
next=2
obj{
- first_new_yishuv=1949-06-15
-score=100
+ first_new_yishuv=1949-03-15
+score=115
food=2732,1390,0
\ 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 892b85f0f..cf4aaf7d3 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-cautious.txt
@@ -41,7 +41,7 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=27.14873297663618 [403B26135D467D37]
+debt=26.960591926047705 [403AF5E95A3B2D32]
fx=80.85238326859616 [4054368D728D91CC]
rung=5;cf=40;
mob=0.8 [3FE999999999999A]
@@ -86,6 +86,17 @@ map[
mapturn=0001-01-01:0;
over=
city{
- tel_aviv=120,90,120,80,91
-coh=0.6426116838487972 [3FE4904660C50EF4]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,106,111
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.6287719752227847 [3FE41EE667C72450]
food=2253,751,0
\ 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 aedc68efb..7a2ff1ee9 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt
@@ -41,7 +41,7 @@ pop{
veterans=661390.4179891739 [41242F1CD602AD50]
sit[
treasury=0 [0000000000000000]
-debt=57.82904503222418 [404CEA1E25CA2835]
+debt=59.72606782031707 [404DDCEFCA53784C]
fx=94.29191537516759 [405792AEBDD362D7]
rung=2;cf=0;
mob=0.8 [3FE999999999999A]
@@ -94,6 +94,17 @@ map[
mapturn=0001-01-01:0;
over=
city{
- tel_aviv=120,90,120,90,190
-coh=0.5826124567474048 [3FE2A4C2E0FF1D3B]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,90,210
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.5558023483365949 [3FE1C92201A4A95F]
food=2556,852,0
\ 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 5765039f9..3526c4e57 100644
--- a/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
+++ b/sim/Statecraft.Sim.Tests/golden/scenario-reckless.txt
@@ -41,7 +41,7 @@ pop{
veterans=656752.739703733 [41240AE17ABA729C]
sit[
treasury=0 [0000000000000000]
-debt=35.14873297663618 [40419309AEA33E9C]
+debt=34.960591926047705 [40417AF4AD1D9699]
fx=80.85238326859616 [4054368D728D91CC]
rung=5;cf=40;
mob=1 [3FF0000000000000]
@@ -84,6 +84,17 @@ map[
mapturn=0001-01-01:0;
over=
city{
- tel_aviv=120,90,120,80,91
-coh=0.6426116838487972 [3FE4904660C50EF4]
+ hadera=12,5,12,5,0
+ haifa=99,42,99,42,0
+ jerusalem=84,29,84,29,0
+ netanya=12,5,12,5,0
+ petah_tikva=22,10,22,10,0
+ rehovot=13,5,13,5,0
+ rishon_lezion=10,5,10,5,0
+ rosh_pinna=1,0,1,0,0
+ safed=2,1,2,1,0
+ tel_aviv=248,106,248,106,111
+ tiberias=6,2,6,2,0
+ zikhron_yaakov=2,1,2,1,0
+coh=0.6287719752227847 [3FE41EE667C72450]
food=2253,751,0
\ No newline at end of file
diff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.cs
index 8422d20ce..328105fc8 100644
--- a/sim/Statecraft.Sim/Cities.cs
+++ b/sim/Statecraft.Sim/Cities.cs
@@ -10,6 +10,14 @@ namespace Statecraft.Sim
{
public const string Kind = "assign_workers";
+ /// <summary>R-CITY-007: a city's start people in units: the nearest unit (a half rounds up), and at least 1 for a city
+ /// with people (Q-START-2, owner, 15 October 2026), so a small town is not left empty.</summary>
+ public static int StartUnits(decimal people, int peoplePerUnit) => people > 0 ? Math.Max(1, NearestUnit(people, peoplePerUnit)) : 0;
+
+ /// <summary>R-CITY-007: people in units to the nearest unit, a half rounding up. Decimal, so it is exact on every runtime.</summary>
+ public static int NearestUnit(decimal people, int peoplePerUnit) =>
+ (int)Math.Round(people / peoplePerUnit, MidpointRounding.AwayFromZero);
+
/// <summary>Fills the state's cities from cities.yaml, with no refugees yet. Does nothing in the legacy loop.</summary>
public static void Init(Content c, GameState s)
{
diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.cs
index b70a641d8..2f0ac58e2 100644
--- a/sim/Statecraft.Sim/Content.cs
+++ b/sim/Statecraft.Sim/Content.cs
@@ -517,18 +517,43 @@ namespace Statecraft.Sim
string? reviewedOn;
}
- /// <summary>A city's start values (cities.yaml, GDD "Cities and construction"). Counts are population units (D-A1).</summary>
+ /// <summary>One start value of a city (cities.yaml), with what it is (R-CITY-006): `sourced` (read from the source named),
+ /// `derived` (computed from sourced values), `wikipedia-only` (an owner-accepted Wikipedia figure) or `design` (a
+ /// labelled design value, not a historical figure; R-LOOP-005). The first three name their sources, with checked dates,
+ /// and the day (YYYY-MM-DD) or month (YYYY-MM) the value describes.</summary>
+ public sealed class CityValue
+ {
+ /// <summary>Read as a decimal, so a share converts to units exactly on every runtime (R-CITY-007).</summary>
+ public decimal Value { get; set; }
+ public string Status { get; set; } = "";
+ /// <summary>The day or month the value describes, as the file writes it ("" for a design value without one).</summary>
+ public string Date { get; set; } = "";
+ public List<Source> Sources { get; set; } = new List<Source>();
+ }
+
+ /// <summary>A city's start values (cities.yaml, GDD "Cities and construction"). The file gives people and shares, each
+ /// with its status (R-CITY-006); the loader turns them into the population units the sim counts (D-A1, R-CITY-007).</summary>
public sealed class CityStart
{
/// <summary>A settlement id of map/settlements_1948.yaml.</summary>
public string Id { get; set; } = "";
- public int HousingCapacity { get; set; }
- public int JobSlots { get; set; }
- public int Civilians { get; set; }
- /// <summary>The civilians in jobs at the start: part of <see cref="Civilians"/>.</summary>
- public int Employed { get; set; }
+ /// <summary>Residents, all groups (the census basis; the owner, 15 October 2026, on #569).</summary>
+ public CityValue? People { get; set; }
+ /// <summary>The share of <see cref="People"/> in work at the start, from 0 to 1.</summary>
+ public CityValue? EmployedShare { get; set; }
+ /// <summary>Housing, in population units.</summary>
+ [YamlMember(Alias = "housing_capacity")] public CityValue? Housing { get; set; }
+ /// <summary>Job slots, in population units.</summary>
+ [YamlMember(Alias = "job_slots")] public CityValue? Jobs { get; set; }
/// <summary>Training facilities in the city (military_camp, hakhshara). PR 4 uses them (D-D5).</summary>
public List<string> Facilities { get; set; } = new List<string>();
+
+ // The units the sim starts from, set by the loader (R-CITY-007).
+ [YamlIgnore] public int HousingCapacity { get; internal set; }
+ [YamlIgnore] public int JobSlots { get; internal set; }
+ [YamlIgnore] public int Civilians { get; internal set; }
+ /// <summary>The civilians in jobs at the start: part of <see cref="Civilians"/>.</summary>
+ [YamlIgnore] public int Employed { get; internal set; }
}
/// <summary>A population or unit type (unit_types.yaml, GDD "Population and units"). `population`: a count per city;
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index 648aaa385..34be5090c 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -959,9 +959,33 @@ namespace Statecraft.Sim
/// <summary>Facilities a city may have (cities.yaml facilities): the GDD's training places (D-D5).</summary>
static readonly string[] Facilities = { "military_camp", "hakhshara" };
- static void NotNegative(string file, string field, int v)
+ static readonly string[] CityStatuses = { "sourced", "derived", "wikipedia-only", "design" };
+ static readonly System.Text.RegularExpressions.Regex Month = new System.Text.RegularExpressions.Regex(@"^\d{4}-\d{2}\z");
+
+ /// <summary>R-CITY-006: a city value is present and has a known status; a sourced, derived or wikipedia-only value also
+ /// has sources, each with a url and a checked date, and the day (YYYY-MM-DD) or month (YYYY-MM) it describes.</summary>
+ static CityValue CityValueOf(string file, string at, CityValue? v)
+ {
+ if (v == null) throw new ContentException(file, at, "required");
+ if (v.Status == "") throw new ContentException(file, at + ".status", "required");
+ if (!CityStatuses.Contains(v.Status))
+ throw new ContentException(file, at + ".status", $"unknown status '{v.Status}' (sourced, derived, wikipedia-only or design)");
+ for (int i = 0; i < v.Sources.Count; i++)
+ if (v.Sources[i] == null || string.IsNullOrWhiteSpace(v.Sources[i].Url) || v.Sources[i].Checked == default)
+ throw new ContentException(file, FormattableString.Invariant($"{at}.sources[{i}]"), "needs a url and checked date");
+ if (v.Date != "" && !ReviewRecord.IsDay(v.Date)
+ && !(Month.IsMatch(v.Date) && DateTime.TryParseExact(v.Date, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out _)))
+ throw new ContentException(file, at + ".date", "must be YYYY-MM-DD or YYYY-MM");
+ if (v.Status == "design") return v; // a design value may name what its method rests on, and needs no date
+ if (v.Sources.Count == 0) throw new ContentException(file, at + ".sources", $"required: a {v.Status} value needs a source");
+ if (v.Date == "") throw new ContentException(file, at + ".date", "required: the day or month the value describes");
+ return v;
+ }
+
+ static void Whole(string file, string at, CityValue v)
{
- if (v < 0) throw new ContentException(file, field, "must be >= 0");
+ if (v.Value < 0 || v.Value != decimal.Truncate(v.Value) || v.Value > int.MaxValue)
+ throw new ContentException(file, at + ".value", "must be a whole number >= 0");
}
/// <summary>The GDD v0.1 city data and rules (Phase 1 PR 3), checked only when systems.loop is gdd.</summary>
@@ -974,12 +998,12 @@ namespace Statecraft.Sim
{
var at = $"cities[{x.Id}]";
if (!known.Contains(x.Id)) throw new ContentException(cf, at + ".id", $"is not in {SettlementsFileName}");
- NotNegative(cf, at + ".housing_capacity", x.HousingCapacity);
- NotNegative(cf, at + ".job_slots", x.JobSlots);
- NotNegative(cf, at + ".civilians", x.Civilians);
- NotNegative(cf, at + ".employed", x.Employed);
- if (x.Employed > x.Civilians) throw new ContentException(cf, at + ".employed", "cannot be more than civilians");
- if (x.Employed > x.JobSlots) throw new ContentException(cf, at + ".employed", "cannot be more than job_slots");
+ // R-CITY-006: every value is required (never read as 0) and says what it is.
+ Whole(cf, at + ".people", CityValueOf(cf, at + ".people", x.People));
+ var share = CityValueOf(cf, at + ".employed_share", x.EmployedShare);
+ if (share.Value < 0 || share.Value > 1) throw new ContentException(cf, at + ".employed_share.value", "must be a number from 0 to 1");
+ Whole(cf, at + ".housing_capacity", CityValueOf(cf, at + ".housing_capacity", x.Housing));
+ Whole(cf, at + ".job_slots", CityValueOf(cf, at + ".job_slots", x.Jobs));
foreach (var f in x.Facilities)
if (!Facilities.Contains(f)) throw new ContentException(cf, at + ".facilities", $"unknown facility '{f}' (military_camp or hakhshara)");
}
@@ -1035,6 +1059,17 @@ namespace Statecraft.Sim
if (v < 0) throw new ContentException(file, "mvp." + key, "must be >= 0");
}
}
+ // R-CITY-007: the units the sim starts from, in the one unit size of every era (checked above).
+ foreach (var x in c.Cities)
+ {
+ var ppu = c.Rules.Mvp!.PeoplePerUnit;
+ x.Civilians = Cities.StartUnits(x.People!.Value, ppu);
+ x.Employed = Cities.NearestUnit(x.People.Value * x.EmployedShare!.Value, ppu);
+ x.HousingCapacity = (int)x.Housing!.Value;
+ x.JobSlots = (int)x.Jobs!.Value;
+ if (x.Employed > x.JobSlots)
+ throw new ContentException(cf, $"cities[{x.Id}].job_slots.value", FormattableString.Invariant($"is fewer than the {x.Employed} employed units of people times employed_share"));
+ }
// Strictly before the last era's end: an end on it is the era's own end, and the game would be over as era_ended.
if (c.Rules.Mvp!.End is DateTime end && (end <= c.Rules.Start || end >= c.Eras[c.Eras.Count - 1].To))
throw new ContentException("rules.yaml", "mvp.end", FormattableString.Invariant($"must be after start ({c.Rules.Start:yyyy-MM-dd}) and before the last era's end ({c.Eras[c.Eras.Count - 1].To:yyyy-MM-dd})"));
diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.cs
index e3c15e992..fbd9577ce 100644
--- a/sim/Statecraft.Sim/GoldenRun.cs
+++ b/sim/Statecraft.Sim/GoldenRun.cs
@@ -15,13 +15,13 @@ namespace Statecraft.Sim
/// <summary>Final hash of Play(content, Until1950). Changing it is a deliberate rules or content change: the value
/// is pinned in sim/Statecraft.Sim.Tests/golden/manifest.txt, and STATECRAFT_UPDATE_GOLDEN=1 dotnet test rewrites
/// both (docs/determinism.md). Say why in the commit message.</summary>
- public const string Hash1950 = "ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4";
+ public const string Hash1950 = "ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144";
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 = "b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915";
+ public const string Hash1952 = "ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca";
public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);
diff --git a/tools/web_check.py b/tools/web_check.py
index 03178dd72..543ce4c95 100644
--- a/tools/web_check.py
+++ b/tools/web_check.py
@@ -8,7 +8,7 @@ fail on a failure line or a timeout. Uses Chrome for Testing from the Playwright
--enable-logging=stderr --v=1 as INFO:CONSOLE... "text", source: ...
Usage (from the repo root):
- uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 ca953c983faa2a85216efdf264bf1da9167c9787a06d21a73c76717dfab0f8b4" --expect "GOLDEN OK 1952 b42380ab7935e4daabd0577fa3df231c474f3ad92f6006af0a05918a46743915"
+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 ea730229392c12e007cdf30aa8b19e4668bcd1dfdbda0735dd8d7612301d5144" --expect "GOLDEN OK 1952 ca887e45cd413a41d4368c604caa37c3c0e19022195ac614001f7bfc507489ca"
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/Tests/EditMode/SimBridgeGddTests.cs b/unity/Assets/Tests/EditMode/SimBridgeGddTests.cs
index eae372f94..e5022d688 100644
--- a/unity/Assets/Tests/EditMode/SimBridgeGddTests.cs
+++ b/unity/Assets/Tests/EditMode/SimBridgeGddTests.cs
@@ -61,8 +61,9 @@ public class SimBridgeGddTests
{
var t = Text;
var b = Bridge(Slice);
- Assert.AreEqual(t.Format("order.unknown", "city"), b.Queue(new AssignWorkers("haifa", "job", 1)));
- Assert.AreEqual(t.Format("order.unknown", "city"), b.Queue(new Train("haifa", "halutz", 1)));
+ // jaffa is a 1948 settlement but not a GDD city (its own map row; Tel Aviv-Yafo is one city, GDD Phase 3 PR 1).
+ Assert.AreEqual(t.Format("order.unknown", "city"), b.Queue(new AssignWorkers("jaffa", "job", 1)));
+ Assert.AreEqual(t.Format("order.unknown", "city"), b.Queue(new Train("jaffa", "halutz", 1)));
Assert.AreEqual(t.Format("order.unknown", "training"), b.Queue(new Train("tel_aviv", "pilot", 1)));
// civilian is a unit type, but nobody trains to it: it has no facility.
Assert.AreEqual(t.Format("order.unknown", "training"), b.Queue(new Train("tel_aviv", "civilian", 1)));