A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: Money upkeep R-MONEY-002 at IL 0m for civilian places, per-head tax kept (owner option 3, fixes #884) (#1044)
Eyal Golan25e5933ec30d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 00116be16..fd75c80b9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -82,6 +82,7 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBthe single building models (#700), with the same hysteresis band. Mosques, churches, walls and ports keep the kit.The 110 km view-distance switch and the "beside the town" spot are gone; a ma'abara or shikun still stands beside itscamp or housing project.+- Money keeps both the calibrated per-head tax and city job income. Resolution step 7 now supports civilian-place upkeep (R-MONEY-002), with the owner-approved MVP rate of IL 0m a year for cities, permanent housing, industry, transit camps, military camps and Hakhsharot; military-unit upkeep remains Phase 5 (refs #884).- The population-tier badge on the twelve city and town pills keeps the values it shipped with, now owner-approved: tiers 1to 9 doubling from 1,000 people, at every zoom, at the start of the name and mirrored in Hebrew (owner, 18 October 2026,"Accept as shipped"). Rosh Pinna keeps tier 1 from its May 1948 figure of 350, which the data marks `wikipedia-only`diff --git a/content/rules.yaml b/content/rules.yamlindex 9107ec80e..2fa378f16 100644--- a/content/rules.yaml+++ b/content/rules.yaml@@ -31,6 +31,14 @@ mvp:end: 1952-01-15people_per_unit: 1000 # DESIGN VALUE: owner-set balance, not a historical figure (D-A1: people in one population unit)income_per_job_per_year: 0.06 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per employed unit a year)+ # R-MONEY-002, option 3 (owner, 18 October 2026, #884): ordinary spending already represents aggregate public expense,+ # so no civilian place pays upkeep in the MVP. These are design values, not claims that historical upkeep was zero.+ city_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per city a year)+ housing_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per permanent-housing project a year)+ industry_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per industry project a year)+ transit_camp_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per transit camp a year)+ military_camp_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per military camp a year)+ hakhshara_upkeep_per_year: 0.0 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: IL millions per Hakhshara a year)# The day the cities start taking arrivals (R-CITY-003; Q-ARRV-3, owner, 15 October 2026, #375): the census day of their# start values, 8 November 1948 (CBS Statistical Abstract of Israel No. 14, Table 11, pp. 30-31). The census already# counts the people who arrived from 15 May, so the cities take none before it; the national head count takes them all.@@ -114,7 +122,7 @@ treasury_start: 20fx_start: 40# Taxes finance the ordinary budget: FY 1950/51 IL 60 million, approved 29 June 1950# (https://en.wikipedia.org/wiki/1950_in_Israel, checked 2026-10-10). 60m / ~1.10m Jews (CBS average 1950) = 0.0000545.-tax_per_capita_per_year: 0.0000545+tax_per_capita_per_year: 0.0000545 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: derived ordinary-revenue abstraction retained by #884)# 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. Job income (R-CITY-002) also reaches the Treasury, so the gap must cover it@@ -122,7 +130,7 @@ tax_per_capita_per_year: 0.0000545# 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+spending_per_capita_per_year: 0.0001036 # DESIGN VALUE: owner-set balance, not a historical figure (D-C6: derived debt-path calibration retained by #884)# Exports cover under a third of imports (spec section 3; EconomyCalibrationTests checks it every turn of 1950-51).exports_per_year: 40imports_per_capita_per_year: 0.00025diff --git a/docs/gdd/cities.md b/docs/gdd/cities.mdindex 4966177c8..556aff8d3 100644--- a/docs/gdd/cities.md+++ b/docs/gdd/cities.md@@ -39,7 +39,10 @@ As a player of the MVP, I want the twelve Jewish cities and towns to start at th- The yishuvim part of D-B4: Phase 4.- Kit density on the map by housing condition (Q-UI-1): left out of this phase (decided 15 October 2026 [S3]).- No text in this phase names abandoned Arab housing; the panel and the absorb card describe housing in general terms, and any later text goes through D-F1 review (Q-SENS-1, owner, 15 October 2026 [S3]).-- Upkeep (D-C6): Q-MONEY-2 adds no upkeep "until Phase 3 has cities to charge" (the Phase 2 plan's Q-MONEY-2 row [S12]), and `docs/gdd/cutover-resource-layer.md` says the values arrive in Phase 3, but no Phase 3 PR owns them yet; recorded for the owner to assign. Income is owned: Q-MONEY-2 keeps the legacy per-head tax and spending until Phase 3, with job income on top, and `income_per_job_per_year` stays a labelled design value [S12].+- Upkeep and income (D-C6): the owner chose option 3 on 18 October 2026 (#884). Cities, permanent housing, industry,+ transit camps, military camps and Hakhsharot each have IL 0m annual upkeep in the MVP; the values are labelled design+ values, not historical claims. Step 7 pays a kind only when its configured rate is non-zero (R-MONEY-002). The MVP+ keeps the per-head tax and spending alongside job income at the accepted calibrated values. Phase 5 owns unit upkeep.## Sourcesdiff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 1e24427cd..38cd8d397 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -136,7 +136,9 @@ R-OBJ-003: An event with `objective:` is that objective's card. It is eligible o## Money-R-MONEY-001: The GDD's Money is the Treasury (`model.yaml` money `treasury`, in IL millions): the player sees it as Money, כסף in Hebrew, on the top bar, the Budget screen and in the causes (spec §1.2, "Treasury becomes Money"; owner, 15 October 2026, Q-MONEY-4 and Q-HUD-3). Debt and foreign currency stay in the sim and the state hash, internal under Money, so the sourced 1951 currency crisis still happens (D-C3, Q-MONEY-1). Income is the per-head tax and spending until Phase 3, with job income (R-CITY-002) on top, and nothing pays upkeep until Phase 3 has cities to charge (Q-MONEY-2, decided 15 October 2026).+R-MONEY-001: The GDD's Money is the Treasury (`model.yaml` money `treasury`, in IL millions): the player sees it as Money, כסף in Hebrew, on the top bar, the Budget screen and in the causes (spec §1.2, "Treasury becomes Money"; owner, 15 October 2026, Q-MONEY-4 and Q-HUD-3). Debt and foreign currency stay in the sim and the state hash, internal under Money, so the sourced 1951 currency crisis still happens (D-C3, Q-MONEY-1). The MVP keeps both abstractions approved on #884: the per-head tax represents ordinary revenue, while jobs pay the player-sensitive income in R-CITY-002. The rates remain `tax_per_capita_per_year` 0.0000545 IL million per person-year, `income_per_job_per_year` 0.06 IL million per employed 1,000-person unit-year, and `spending_per_capita_per_year` 0.0001036 IL million per person-year, all labelled design values in `rules.yaml` (owner, 18 October 2026, option 3 and the per-head-tax draft).++R-MONEY-002: In step 7, after Food consumption and imports, the Treasury pays each existing civilian kind's annual upkeep for the turn's share of a year; an unfinished project pays none, and R-MONEY-003 covers a shortfall. In the MVP, cities, completed permanent-housing projects, completed industry projects, completed transit camps, military camps and Hakhsharot each have an explicit upkeep of **IL 0m per year** in `rules.yaml`. These are design values, not historical claims. Phase 5 decides military-unit upkeep separately (#742; owner, 18 October 2026, #884 option 3).R-MONEY-003: A GDD cost above the Treasury is paid, and the shortfall moves to debt, as map actions do: the Treasury stops at 0, and a cause names what the shortfall was borrowed for (Q-MONEY-3, owner decision "Allow borrowing", 15 October 2026, for training and pioneer work; the Phase 2 plan applies it to every GDD cost). It covers the deficit, map actions, training (R-TRAIN-001), pioneer work (R-SITE-001) and an event option's Treasury cost.diff --git a/docs/superpowers/plans/2026-10-15-gdd-phase-3.md b/docs/superpowers/plans/2026-10-15-gdd-phase-3.mdindex 8bfb789d0..8309f0f8b 100644--- a/docs/superpowers/plans/2026-10-15-gdd-phase-3.md+++ b/docs/superpowers/plans/2026-10-15-gdd-phase-3.md@@ -111,6 +111,10 @@ The city start values (#569, owner decision of 15 October 2026, "Census values +Critical path: Phase 2 cutover, then the scan check and the Q-START answers, then PR 1, PR 2, PR 3, PR 4, PR 6, PR 8. PRs 5 and 7 sit beside PRs 4 and 6.+| Follow-up PR | Decision | Scope | Test and calibration |+|---|---|---|---|+| #884: Money upkeep and the per-head tax | Owner, 18 October 2026: option 3 and the per-head-tax draft | Keep the per-head tax, job income and spending at their accepted design values. Add R-MONEY-002 in step 7; cities, permanent housing, industry, transit camps, military camps and Hakhsharot each have IL 0m annual upkeep. Military units remain Phase 5 (#742). | `MoneyTests.UpkeepIsPaidInStepSeven` exercises non-zero fixture rates; the real historical run must retain the 1950–51 internal-debt calibration and its 15% tolerance. |+## File map| File | Responsibility | PRs |diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.csindex 0dad2d34d..b04b22869 100644--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs@@ -24,6 +24,14 @@ public class DesignValuesTests("rules.yaml", "attention_cost.stop_work"),("rules.yaml", "mvp.people_per_unit"),("rules.yaml", "mvp.income_per_job_per_year"),+ ("rules.yaml", "mvp.city_upkeep_per_year"),+ ("rules.yaml", "mvp.housing_upkeep_per_year"),+ ("rules.yaml", "mvp.industry_upkeep_per_year"),+ ("rules.yaml", "mvp.transit_camp_upkeep_per_year"),+ ("rules.yaml", "mvp.military_camp_upkeep_per_year"),+ ("rules.yaml", "mvp.hakhshara_upkeep_per_year"),+ ("rules.yaml", "tax_per_capita_per_year"),+ ("rules.yaml", "spending_per_capita_per_year"),("rules.yaml", "mvp.build_yishuv_turns"),("rules.yaml", "mvp.build_yishuv_cost"),("rules.yaml", "mvp.build_camp_turns"),@@ -141,7 +149,9 @@ public class DesignValuesTests{var k = ((YamlScalarNode)kv.Key).Value!;var child = key == "" ? k : key + "." + k;- var scope = inScope || (file != "rules.yaml" && file != "model.yaml") || (file == "rules.yaml" && k == "mvp") || (key == "attention_cost" && AttentionSystem.IsGddKind(k));+ var scope = inScope || (file != "rules.yaml" && file != "model.yaml") || (file == "rules.yaml" && k == "mvp")+ || (file == "rules.yaml" && (k == "tax_per_capita_per_year" || k == "spending_per_capita_per_year"))+ || (key == "attention_cost" && AttentionSystem.IsGddKind(k));Walk(kv.Value, child, scope);}break;@@ -188,6 +198,9 @@ public class DesignValuesTestsvar c = ContentLoader.Load(RealContentTests.ContentRoot());var m = c.Rules.Mvp!;Assert.Equal((1000, 0.06), (m.PeoplePerUnit, m.IncomePerJobPerYear));+ Assert.Equal((0.0000545, 0.0001036), (c.Rules.TaxPerCapitaPerYear, c.Rules.SpendingPerCapitaPerYear));+ Assert.Equal((0.0, 0.0, 0.0, 0.0, 0.0, 0.0), (m.CityUpkeepPerYear!.Value, m.HousingUpkeepPerYear!.Value,+ m.IndustryUpkeepPerYear!.Value, m.TransitCampUpkeepPerYear!.Value, m.MilitaryCampUpkeepPerYear!.Value, m.HakhsharaUpkeepPerYear!.Value));Assert.Equal((0.5, 1.0, 0.5), (c.Rules.AttentionCost["assign_workers"], c.Rules.AttentionCost["train"], c.Rules.AttentionCost["cancel_training"]));Assert.Equal((0.0, 0.0), (c.Rules.AttentionCost["pioneer_work"], c.Rules.AttentionCost["stop_work"])); // D-A6: unit orders are freeAssert.Equal((6, 2.0), (m.BuildYishuvTurns, m.BuildYishuvCost));@@ -221,5 +234,7 @@ public class DesignValuesTestsAssert.Contains("attention_cost.train", rules);Assert.DoesNotContain("attention_cost.set_policy", rules);Assert.DoesNotContain("treasury_start", rules);+ Assert.Contains("tax_per_capita_per_year", rules);+ Assert.Contains("spending_per_capita_per_year", rules);}}diff --git a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.csindex 8a473b040..219a05e31 100644--- a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs+++ b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs@@ -14,7 +14,8 @@ using Statecraft.Sim;/// (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;+/// - the FY 1950/51 ordinary budget was IL 60m (en.wiki "1950 in Israel"): tax_per_capita is derived from it and remains+/// alongside job income (owner, 18 October 2026, #884, the accepted per-head-tax draft);/// - 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./// M3 has NO fully independent economy anchor. The one loose INDEPENDENT check: external debt rose IL 65.7m over 1950-51diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.csindex 680fc321b..54cb9a4dd 100644--- a/sim/Statecraft.Sim.Tests/Fixture.cs+++ b/sim/Statecraft.Sim.Tests/Fixture.cs@@ -224,6 +224,12 @@ series:mvp:people_per_unit: 10income_per_job_per_year: 1.2+ city_upkeep_per_year: 0+ housing_upkeep_per_year: 0+ industry_upkeep_per_year: 0+ transit_camp_upkeep_per_year: 0+ military_camp_upkeep_per_year: 0+ hakhshara_upkeep_per_year: 0city_arrivals_from: 1948-05-15build_yishuv_turns: 3build_yishuv_cost: 1.5diff --git a/sim/Statecraft.Sim.Tests/MoneyTests.cs b/sim/Statecraft.Sim.Tests/MoneyTests.csindex 806482487..bf365078a 100644--- a/sim/Statecraft.Sim.Tests/MoneyTests.cs+++ b/sim/Statecraft.Sim.Tests/MoneyTests.cs@@ -20,18 +20,86 @@ public class MoneyTestsAssert.Equal("Foreign currency", PlayerText.Target(C, "fx_reserves"));}- // R-MONEY-001: before Phase 3 upkeep, the normal economy flow contains only tax, spending and mobilization.+ // R-MONEY-002: step 7 pays the annual upkeep of each completed civilian place for the turn's share of a year.+ // The fixture uses non-zero rates to exercise the rule; every real MVP rate is 0 (owner option 3, 18 October 2026).[Fact]- public void TheTreasuryPaysNoUpkeep()+ public void UpkeepIsPaidInStepSeven(){- var s = Simulation.NewGame(C, GoldenRun.Seed, Mode.Historical);- s.Treasury = 10_000;- var before = s.Treasury;- var flows = EconomySystem.Flows(C, s, 0.25);+ var files = Fixture.Gdd();+ files["rules.yaml"] = files["rules.yaml"]+ .Replace("city_upkeep_per_year: 0", "city_upkeep_per_year: 1")+ .Replace("housing_upkeep_per_year: 0", "housing_upkeep_per_year: 2")+ .Replace("industry_upkeep_per_year: 0", "industry_upkeep_per_year: 3")+ .Replace("transit_camp_upkeep_per_year: 0", "transit_camp_upkeep_per_year: 4")+ .Replace("military_camp_upkeep_per_year: 0", "military_camp_upkeep_per_year: 5")+ .Replace("hakhshara_upkeep_per_year: 0", "hakhshara_upkeep_per_year: 6");+ // town_a has a military camp and a Hakhshara; site_b adds a built camp, site_c a Hakhshara still being built.+ files["sites.yaml"] = Fixture.GddSites+ + Camp("site_b", "Site B", "military_camp", 3) + Camp("site_c", "Site C", "hakhshara", 4);+ var c = ContentLoader.Load(Fixture.Write(files));+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ s.CityProjects.Add(1, new CityProject(1, "housing", "town_a", 1, 0, 0, s.Date));+ s.CityProjects.Add(2, new CityProject(2, "industry", "town_a", 2, 0, 0, s.Date));+ s.CityProjects.Add(3, new CityProject(3, "transit_camp", "town_a", 3, 0, 0, s.Date));+ s.CityProjects.Add(4, new CityProject(4, "housing", "town_a", 4, 0, 2)); // unfinished: no upkeep+ s.Sites["site_b"] = SiteWork.Built("site_b", s.Date);+ s.Units.Add(98, new Unit(98, "halutz", 4, 0)); // a site being built names its unit+ s.Sites["site_c"] = new SiteWork("site_c", 98, 2, null); // unfinished: no upkeep+ var shortTreasury = s.Clone();+ s.Treasury = 100;+ const double yearFraction = 0.25;+ var jobIncome = 6 * 1.2 * yearFraction;+ var upkeep = (1 + 2 + 3 + 4 + 2 * 5 + 6) * yearFraction; // one city, two military camps, one Hakhshara+ var why = new List<Cause>();++ TurnResolver.Resolve(c, s, s.Date.AddMonths(3), yearFraction, why);++ Assert.Equal(100 + jobIncome - upkeep, s.Treasury, 9);+ Assert.Equal(-upkeep, Assert.Single(why, x => x.Message.EndsWith("(civilian upkeep)")).Delta, 9);++ // R-MONEY-003: a Treasury that cannot pay borrows the shortfall and stops at 0.+ shortTreasury.Treasury = 0;+ var debt = shortTreasury.Debt;+ TurnResolver.Resolve(c, shortTreasury, shortTreasury.Date.AddMonths(3), yearFraction, new List<Cause>());+ Assert.Equal(0, shortTreasury.Treasury);+ Assert.Equal(debt + upkeep - jobIncome, shortTreasury.Debt, 9);+ }++ static string Camp(string id, string name, string kind, int q) => Fixture.GddSites.Replace("sites:\n", "")+ .Replace("site_a", id).Replace("Site A", name).Replace("q: 2", $"q: {q}").Replace("kinds: [yishuv]", $"kinds: [{kind}]")+ .Replace(" founded: 1949-06-12\n", " city: town_a\n");- EconomySystem.Apply(C, s, 0.25, new List<Cause>());+ // R-MONEY-002: every rate is required in the GDD loop, so an omitted kind never silently becomes free.+ [Theory]+ [InlineData(" hakhshara_upkeep_per_year: 0\n", "", "mvp.hakhshara_upkeep_per_year", "required")]+ [InlineData(" city_upkeep_per_year: 0\n", " city_upkeep_per_year: -1\n", "mvp.city_upkeep_per_year", ">= 0")]+ [InlineData(" housing_upkeep_per_year: 0\n", " housing_upkeep_per_year: .nan\n", "mvp.housing_upkeep_per_year", ">= 0")]+ public void TheUpkeepRatesAreRequiredAndInRange(string line, string replacement, string field, string reason)+ {+ var files = Fixture.Gdd();+ Assert.Contains(line, files["rules.yaml"]);+ files["rules.yaml"] = files["rules.yaml"].Replace(line, replacement);+ var e = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(files)));+ Assert.Contains(field, e.Message);+ Assert.Contains(reason, e.Message);+ }++ // R-MONEY-002, owner option 3 (18 October 2026, #884): in the real MVP no civilian place pays upkeep, so a turn with+ // every kind built charges nothing and names no upkeep cause.+ [Fact]+ public void TheMvpChargesNoCivilianUpkeep()+ {+ var s = Simulation.NewGame(C, GoldenRun.Seed, Mode.Historical);+ var city = C.Cities[0].Id;+ foreach (var (id, kind) in new[] { (1, "housing"), (2, "industry"), (3, "transit_camp") })+ s.CityProjects.Add(id, new CityProject(id, kind, city, id, 0, 0, s.Date));+ foreach (var site in C.Sites.Where(x => x.Kinds.Contains("military_camp") || x.Kinds.Contains("hakhshara")))+ s.Sites[site.Id] = SiteWork.Built(site.Id, s.Date);- Assert.Equal(before + flows.Tax - flows.Spending - flows.Mobilization, s.Treasury, 9);+ Assert.Equal(0, Cities.AnnualUpkeep(C, s, C.Rules.Mvp!));+ var why = new List<Cause>();+ TurnResolver.Resolve(C, s, s.Date.AddMonths(1), 1 / 12.0, why);+ Assert.DoesNotContain(why, x => x.Message.Contains("upkeep"));}// R-MONEY-001 (D-C3): a guard, not a change. The real game runs the GDD loop, its debt and foreign currency are in thediff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.csindex db26340b3..f43263e9e 100644--- a/sim/Statecraft.Sim/Cities.cs+++ b/sim/Statecraft.Sim/Cities.cs@@ -70,6 +70,30 @@ namespace Statecraft.Sim}}+ /// <summary>R-MONEY-002: annual Money upkeep for the civilian places that exist at the start of step 7. Only completed+ /// projects and camp sites count. The six rates are explicit content design values; all are 0 in the MVP.</summary>+ public static double AnnualUpkeep(Content c, GameState s, MvpRules r)+ {+ var total = s.Cities.Count * r.CityUpkeepPerYear!.Value;+ foreach (var p in s.CityProjects.Values)+ {+ if (p.BuiltOn == null) continue;+ if (p.Kind == "housing") total += r.HousingUpkeepPerYear!.Value;+ else if (p.Kind == "industry") total += r.IndustryUpkeepPerYear!.Value;+ else if (p.Kind == "transit_camp") total += r.TransitCampUpkeepPerYear!.Value;+ }+ var military = c.Cities.Sum(x => x.Facilities.Count(f => f == "military_camp"));+ var hakhsharot = c.Cities.Sum(x => x.Facilities.Count(f => f == "hakhshara"));+ foreach (var w in s.Sites.Values)+ {+ if (w.BuiltOn == null) continue;+ var site = c.Sites.First(x => x.Id == w.Site);+ if (site.Kinds.Contains("military_camp")) military++;+ if (site.Kinds.Contains("hakhshara")) hakhsharot++;+ }+ return total + military * r.MilitaryCampUpkeepPerYear!.Value + hakhsharot * r.HakhsharaUpkeepPerYear!.Value;+ }+/// <summary>R-CITY-004 (D-A5; D-D1, Q-HOUSE-1): no hard cap. Every refugee becomes a civilian, without a job, on the/// housing step; the people beyond the city's housing are its overflow (<see cref="Overflow"/>), still counted in it./// Residents are housed automatically (Q-HOUSE-4).</summary>diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 9aa19f2c3..0e895dacf 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -467,6 +467,13 @@ namespace Statecraft.Simpublic int PeoplePerUnit { get; set; }/// <summary>Money each employed unit earns a year, in IL millions (R-CITY-002).</summary>public double IncomePerJobPerYear { get; set; }+ /// <summary>Annual civilian-place upkeep in IL millions (R-MONEY-002). Required in the GDD loop; the MVP values are 0.</summary>+ public double? CityUpkeepPerYear { get; set; }+ public double? HousingUpkeepPerYear { get; set; }+ public double? IndustryUpkeepPerYear { get; set; }+ public double? TransitCampUpkeepPerYear { get; set; }+ public double? MilitaryCampUpkeepPerYear { get; set; }+ public double? HakhsharaUpkeepPerYear { get; set; }/// <summary>The day the cities start taking arrivals: the census day their start values count (R-CITY-003, Q-ARRV-3).</summary>public DateTime CityArrivalsFrom { get; set; }/// <summary>The day the GDD game ends (R-LOOP-004; D-E5, 15 January 1952 in the real content), or null for the lastdiff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 7991c31df..fb54b09ee 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -1081,6 +1081,15 @@ namespace Statecraft.Simif (m.PeoplePerUnit != c.Rules.Mvp!.PeoplePerUnit)throw new ContentException(file, "mvp.people_per_unit", "must be the same in every era (arrivals are counted in one unit size)");if (!(m.IncomePerJobPerYear >= 0 && IsFinite(m.IncomePerJobPerYear))) throw new ContentException(file, "mvp.income_per_job_per_year", "must be a finite number >= 0");+ // R-MONEY-002: explicit values keep an omitted kind from silently becoming free upkeep.+ foreach (var (key, v) in new[] {+ ("city_upkeep_per_year", m.CityUpkeepPerYear), ("housing_upkeep_per_year", m.HousingUpkeepPerYear),+ ("industry_upkeep_per_year", m.IndustryUpkeepPerYear), ("transit_camp_upkeep_per_year", m.TransitCampUpkeepPerYear),+ ("military_camp_upkeep_per_year", m.MilitaryCampUpkeepPerYear), ("hakhshara_upkeep_per_year", m.HakhsharaUpkeepPerYear) })+ {+ if (v == null) throw new ContentException(file, "mvp." + key, "required when eras.yaml systems.loop is gdd");+ if (!(v >= 0 && IsFinite(v.Value))) throw new ContentException(file, "mvp." + key, "must be a finite number >= 0");+ }// R-CITY-003: the cities count arrivals from one day; another day in a later era would lose or double-count units.if (m.CityArrivalsFrom == default) throw new ContentException(file, "mvp.city_arrivals_from", "required when eras.yaml systems.loop is gdd");if (m.CityArrivalsFrom != c.Rules.Mvp!.CityArrivalsFrom) throw new ContentException(file, "mvp.city_arrivals_from", "must be the same in every era (the cities count arrivals from one day)");diff --git a/sim/Statecraft.Sim/EconomySystem.cs b/sim/Statecraft.Sim/EconomySystem.csindex f32c37fa9..1216cee97 100644--- a/sim/Statecraft.Sim/EconomySystem.cs+++ b/sim/Statecraft.Sim/EconomySystem.cs@@ -46,6 +46,15 @@ namespace Statecraft.Sims.Treasury = 0;}+ /// <summary>R-MONEY-002: pays civilian-place upkeep in step 7, prorated by the turn's share of a year.</summary>+ public static void PayCivilianUpkeep(Content c, GameState s, MvpRules r, double yearFraction, List<Cause> why)+ {+ var cost = Cities.AnnualUpkeep(c, s, r) * yearFraction;+ if (cost == 0) return;+ why.Add(new Cause("economy", "treasury", -cost, $"{PlayerText.Change(c, "treasury", -cost)} (civilian upkeep)"));+ PayOrBorrow(c, s, cost, "for civilian upkeep", why);+ }+public static void Apply(Content c, GameState s, double yearFraction, List<Cause> why){var r = c.RulesAt(s.Date); var pop = s.TotalPopulation;diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.csindex ded496593..7d6aefdd6 100644--- a/sim/Statecraft.Sim/TurnResolver.cs+++ b/sim/Statecraft.Sim/TurnResolver.cs@@ -21,6 +21,7 @@ namespace Statecraft.SimCities.Produce(c, s, r, yearFraction, why); // 6. productionPools.Harvest(c, s, r, why); // and the plowed fields' Food (R-FIELD-002)Pools.Consume(c, s, r, why); // 7. consumption: the nation eats, then imports (R-FOOD-002)+ EconomySystem.PayCivilianUpkeep(c, s, r, yearFraction, why); // and pays Money upkeep (R-MONEY-002)Cities.House(c, s, why); // 8. housing, then the housing condition; Social cohesion is morale, which the effects web moves after the resolutionCities.UpdateCondition(c, s, r, why);Cities.Arrive(c, s, r, next, why); // 9. arrivals