A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Content: no vacant 1948 seats for offices not yet established; truce-safe ceasefire wording (#224)
Eyal Golanc73c0789a646
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e6049a0d7..aa7c32b85 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -93,6 +93,12 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBIt decodes to the same bytes, so the terrain is unchanged (#44).### Fixed+- The 1948 Cabinet no longer shows four vacant seats for offices that did not exist yet. Offices can now carry a `from`+ date, and before it the office is not a Cabinet seat and cannot be filled. The dates are Education and Culture 10 March+ 1949, rationing 26 April 1949, President of Israel 16 February 1949 and Minister without Portfolio 8 October 1951. The+ Budget row for Education reads "no ministry until 10 March 1949" (#217).+- The Defence screen's UN ceasefire clock now reads "If full war goes on, the UN imposes a ceasefire in N weeks". The+ old "A UN ceasefire will be imposed in N weeks" contradicted the First Truce, which keeps the game at full war (#218).- The camera keys (WASD and the arrows) no longer move keyboard focus through the HUD. Before, panning could walk focusonto New Game or End Turn, so a stray Enter or Space could press it. Tab still moves focus.- The Cabinet's "Appoint to …" heading has its own column again and stays clear of the portrait grid's scroll bar.diff --git a/content/offices.yaml b/content/offices.yamlindex 73b9a7c9c..05b4259a7 100644--- a/content/offices.yaml+++ b/content/offices.yaml@@ -21,16 +21,27 @@ offices:- { id: trade_minister, title: Minister of Trade and Industry }- { id: transportation_minister, title: Minister of Transportation }- { id: welfare_minister, title: Minister of Welfare }- - { id: education_minister, title: Minister of Education and Culture }+ # The Provisional Government (14 May 1948 - 10 March 1949) had no education portfolio. The ministry dates from the First+ # Government; Zalman Shazar was its first minister, from 10 March 1949 (en.wiki "Provisional government of Israel" and+ # "Ministry of Education (Israel)", he.wiki "הממשלה הזמנית", checked 2026-10-11). The budget line stays from 1948.+ - { id: education_minister, title: Minister of Education and Culture, from: 1949-03-10 }# The minister responsible for rationing: the rationing policy's effects and events look this office up. Until# 1 November 1950 that was the Minister of Rationing and Supply (Dov Yosef). The ministry was then abolished and its# functions split: most went to Agriculture (Lavon), some supply departments to Trade and Industry (Geri) (research# notes, Addendum 2). From 8 October 1951 food-supply/rationing responsibility was with Trade and Industry (Yosef);# see people.yaml and research_notes/M3 content 1950-51/rationing-responsibility.md for evidence and caveats.- - { id: rationing_minister, title: Minister responsible for rationing }+ # No rationing ministry or minister in the Provisional Government: the Ministry of Rationing and Supply was created on+ # 26 April 1949 under Dov Yosef (en.wiki "Rationing and Supply Minister of Israel" and "Provisional government of+ # Israel", he.wiki "משרד האספקה והקיצוב" (April 1949), checked 2026-10-11).+ - { id: rationing_minister, title: Minister responsible for rationing, from: 1949-04-26 }- { id: chief_of_staff, title: IDF Chief of the General Staff }- - { id: minister_without_portfolio, title: Minister without Portfolio }- - { id: president, title: President of Israel }+ # The role first appeared in the Third Government (Peretz Naphtali, 8 October 1951): he.wiki "שר בלי תיק"; the+ # Provisional, First and Second Governments' tables on en.wiki list none (checked 2026-10-11).+ - { id: minister_without_portfolio, title: Minister without Portfolio, from: 1951-10-08 }+ # Established by the Transition Law of 16 February 1949 (he.wiki "נשיא מדינת ישראל", en.wiki "President of Israel",+ # checked 2026-10-11; he.wiki "חוק המעבר" gives 16 or 17 February). Weizmann's 1948 office, President of the+ # Provisional State Council, is a different office the game does not model.+ - { id: president, title: President of Israel, from: 1949-02-16 }# Historical deputy titles: dated lookup/text only, never playable Cabinet seats or gameplay owners.# Sources and the start-date conflict are in research_notes/M3 content 1950-51/deputy-titles.md.- { id: deputy_agriculture_minister, title: Deputy Minister of Agriculture, historical_only: true }diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex 58d4140f5..c46696322 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -256,3 +256,9 @@ event window has a holder throughout. It cannot own a policy, effect, budget lin`office:` delegation. Use the responsible senior minister for those gameplay fields. Existingoffices default to `historical_only: false`. A historical-only title ignores player appointments,including entries carried in an older save.++### Dated offices++`from` (the day an office was established) and `until` (the day it was abolished) limit when an office is a Cabinet seat+and can be filled. Terms in `people.yaml` must fall between them. A budget line may run before `from`: the Budget+screen then names the date the ministry begins instead of calling it vacant.diff --git a/sim/Statecraft.Sim.Tests/CabinetTests.cs b/sim/Statecraft.Sim.Tests/CabinetTests.csindex eb69bc30f..8e34291a8 100644--- a/sim/Statecraft.Sim.Tests/CabinetTests.cs+++ b/sim/Statecraft.Sim.Tests/CabinetTests.cs@@ -161,6 +161,26 @@ public class CabinetTestsAssert.Equal("Loy Alist is not an IDF career officer", Cabinet.Check(Rich, s, "chief_of_staff", "loyalist"));}+ [Fact]+ public void AnOfficeIsNotASeatOrAppointableBeforeItIsEstablished()+ {+ var c = ContentLoader.Load(Fixture.Write(new Dictionary<string, string>+ {+ ["offices.yaml"] = Fixture.Files["offices.yaml"] + "\n - { id: new_office, title: New Office, from: 1949-01-01 }\n",+ ["people.yaml"] = Fixture.Files["people.yaml"] + ExtraPeople,+ }));+ var before = new GameState { Date = new DateTime(1948, 12, 31) };+ Assert.DoesNotContain(Cabinet.Lineup(c, before), seat => seat.Office.Id == "new_office");+ Assert.Equal("The office of New Office is not established until 1 January 1949", Cabinet.Check(c, before, "new_office", "loyalist"));+ // An appointment from an older save does not make anyone hold an office that does not exist yet.+ before.Appointments["new_office"] = new Appointment("loyalist", before.Date);+ before.AppointedUnder = Offices.Government(c, before.Date)!.Id;+ Assert.Null(Cabinet.Holder(c, before, "new_office"));+ var on = new GameState { Date = new DateTime(1949, 1, 1) };+ Assert.Contains(Cabinet.Lineup(c, on), seat => seat.Office.Id == "new_office" && seat.Holder == null);+ Assert.NotEqual("The office of New Office is not established until 1 January 1949", Cabinet.Check(c, on, "new_office", "loyalist"));+ }+[Fact]public void AnAbolishedOfficeCannotBeFilled(){@@ -294,6 +314,17 @@ public class CabinetTestsAssert.Equal("The office of Minister of War Victims was abolished on 8 October 1951",Cabinet.Check(c, new GameState { Date = new DateTime(1951, 11, 1) }, "war_victims_minister", "maimon"));Assert.Equal("Aharon Zisling's party (Mapam) is not in the coalition", Cabinet.Check(c, s, "agriculture_minister", "zisling"));+ // The Provisional Government had no education portfolio: the ministry dates from 10 March 1949.+ var provisional = new GameState { Date = new DateTime(1948, 6, 12) };+ Assert.DoesNotContain(Cabinet.Lineup(c, provisional), seat => seat.Office.Id == "education_minister");+ Assert.Equal("The office of Minister of Education and Culture is not established until 10 March 1949",+ Cabinet.Check(c, provisional, "education_minister", "shazar"));+ Assert.Contains(Cabinet.Lineup(c, new GameState { Date = new DateTime(1949, 3, 10) }), seat => seat.Office.Id == "education_minister" && seat.Holder?.Id == "shazar");+ // #217: no office in the 1948 lineup is vacant; rationing, the presidency and the minister without portfolio begin later.+ Assert.All(Cabinet.Lineup(c, provisional), seat => Assert.NotNull(seat.Holder));+ Assert.Equal(new DateTime(1949, 4, 26), c.Offices.Single(o => o.Id == "rationing_minister").From);+ Assert.Equal(new DateTime(1949, 2, 16), c.Offices.Single(o => o.Id == "president").From);+ Assert.Equal(new DateTime(1951, 10, 8), c.Offices.Single(o => o.Id == "minister_without_portfolio").From);Assert.Equal("The President is elected by the Knesset, not appointed", Cabinet.Check(c, s, "president", "sharett"));Assert.Null(Cabinet.Check(c, s, "agriculture_minister", "eshkol"));Assert.Equal("Chaim Weizmann is the President", Cabinet.Check(c, s, "finance_minister", "weizmann"));diff --git a/sim/Statecraft.Sim.Tests/PeriodValidationTests.cs b/sim/Statecraft.Sim.Tests/PeriodValidationTests.csindex 2b4e536de..2cdfb4ad0 100644--- a/sim/Statecraft.Sim.Tests/PeriodValidationTests.cs+++ b/sim/Statecraft.Sim.Tests/PeriodValidationTests.cs@@ -60,6 +60,23 @@ public class PeriodValidationTestsAssert.Contains("must be on or before 1949-01-01, when the office was abolished", ex.Message);}+ [Fact]+ public void ATermStartingBeforeTheOfficeIsEstablishedIsALoadError()+ {+ var ex = ValidationTests.Bad("offices.yaml", "title: Minister of Finance", "title: Minister of Finance\n from: 1949-01-01");+ Assert.Equal("people.yaml", ex.File);+ Assert.Equal("people[def_two].offices.finance_minister.from", ex.Field);+ Assert.Contains("must be on or after 1949-01-01, when the office was established", ex.Message);+ }++ [Fact]+ public void AnOfficeAbolishedBeforeItIsEstablishedIsALoadError()+ {+ var ex = ValidationTests.Bad("offices.yaml", "title: Minister of Finance", "title: Minister of Finance\n from: 1949-01-01\n until: 1949-01-01");+ Assert.Equal("offices.yaml", ex.File);+ Assert.Equal("offices[finance_minister].until", ex.Field);+ }+[Fact]public void AnAbolishedOfficeWhoseTermsEndInTimeLoads(){diff --git a/sim/Statecraft.Sim/Cabinet.cs b/sim/Statecraft.Sim/Cabinet.csindex 888d3e5c3..75bfeeb6c 100644--- a/sim/Statecraft.Sim/Cabinet.cs+++ b/sim/Statecraft.Sim/Cabinet.cs@@ -33,7 +33,7 @@ namespace Statecraft.Sim/// appointee who dies leaves office on the date of death, and the historical holder applies again).</summary>static Appointment? Active(Content c, GameState s, string office, DateTime date){- if (c.Offices.Any(o => o.Id == office && o.HistoricalOnly)) return null;+ if (c.Offices.Any(o => o.Id == office && (o.HistoricalOnly || !o.ExistsOn(date)))) return null;if (!s.Appointments.TryGetValue(office, out var a) || date < a.From) return null;var died = c.People.First(p => p.Id == a.Person).Died;if (died.HasValue && date >= died.Value) return null;@@ -56,13 +56,13 @@ namespace Statecraft.Sim/// <summary>Every playable office that exists on the state's date, in offices.yaml order, with its holder (null = vacant).</summary>public static IReadOnlyList<Seat> Lineup(Content c, GameState s) =>- c.Offices.Where(o => !o.HistoricalOnly && (!o.Until.HasValue || s.Date < o.Until.Value))+ c.Offices.Where(o => !o.HistoricalOnly && o.ExistsOn(s.Date)).Select(o => new Seat(o, Holder(c, s, o.Id), Active(c, s, o.Id, s.Date) != null)).ToList();/// <summary>Null when <paramref name="personId"/> may be appointed to <paramref name="officeId"/> now, else the- /// reason shown to the player. Checks, in order: the office exists and has not been abolished; it is not the- /// Prime Minister's (the player) or the President's (elected by the Knesset); the person exists, is alive, is not+ /// reason shown to the player. Checks, in order: the office exists, has not been abolished and has been established; it+ /// is not the Prime Minister's (the player) or the President's (elected by the Knesset); the person exists, is alive, is not/// the sitting President, is not the serving Chief of Staff (for any other office) and does not already hold it; a/// government is in office; a Chief of Staff must be a career officer (has held the post in people.yaml); a/// minister's party, if any, must be in the coalition.</summary>@@ -74,6 +74,8 @@ namespace Statecraft.Simif (office.HistoricalOnly) return $"{office.Title} is a historical title, not an appointable office";if (office.Until.HasValue && s.Date >= office.Until.Value)return $"The office of {office.Title} was abolished on {PlayerText.Date(office.Until.Value)}";+ if (office.From.HasValue && s.Date < office.From.Value)+ return $"The office of {office.Title} is not established until {PlayerText.Date(office.From.Value)}";if (officeId == "prime_minister") return "You are the Prime Minister: that office is not yours to fill";if (officeId == "president") return "The President is elected by the Knesset, not appointed";var person = c.People.FirstOrDefault(p => p.Id == personId);diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 03b109d65..7f52455ab 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -14,8 +14,12 @@ namespace Statecraft.Simpublic string Title { get; set; } = "";/// <summary>Historical record only: no Cabinet seat, player appointment or gameplay responsibility. Defaults false for existing offices.</summary>public bool HistoricalOnly { get; set; }+ /// <summary>Day the office was established (inclusive, like a term's `from`); null when it exists from the start.</summary>+ public DateTime? From { get; set; }/// <summary>Day the office was abolished (exclusive end, like a term's `to`); null while it still exists.</summary>public DateTime? Until { get; set; }+ /// <summary>True when the office exists on <paramref name="date"/>: on or after From and before Until.</summary>+ public bool ExistsOn(DateTime date) => (!From.HasValue || date >= From.Value) && (!Until.HasValue || date < Until.Value);}public sealed class Party { public string Id { get; set; } = ""; public string Name { get; set; } = ""; }diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 6a67e1cbf..1579022ea 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -367,6 +367,14 @@ namespace Statecraft.Simif (t.To.HasValue && t.To.Value <= t.From) throw new ContentException("people.yaml", $"people[{p.Id}].offices.{t.Office}", FormattableString.Invariant($"term ends ({t.To:yyyy-MM-dd}) before it starts ({t.From:yyyy-MM-dd})"));}}+ foreach (var o in c.Offices.Where(o => o.From.HasValue))+ {+ if (o.Until.HasValue && o.Until.Value <= o.From!.Value)+ throw new ContentException("offices.yaml", $"offices[{o.Id}].until", FormattableString.Invariant($"must be after from ({o.From:yyyy-MM-dd})"));+ foreach (var p in c.People)+ foreach (var t in p.Offices.Where(t => t.Office == o.Id && t.From < o.From!.Value))+ throw new ContentException("people.yaml", $"people[{p.Id}].offices.{o.Id}.from", FormattableString.Invariant($"must be on or after {o.From:yyyy-MM-dd}, when the office was established"));+ }foreach (var o in c.Offices.Where(o => o.Until.HasValue))foreach (var p in c.People)foreach (var t in p.Offices.Where(t => t.Office == o.Id))diff --git a/unity/Assets/Scripts/UI/BudgetPresenter.cs b/unity/Assets/Scripts/UI/BudgetPresenter.csindex 737bb0c85..365d20a63 100644--- a/unity/Assets/Scripts/UI/BudgetPresenter.cs+++ b/unity/Assets/Scripts/UI/BudgetPresenter.cs@@ -111,7 +111,10 @@ namespace Statecraft.Game.UIvar share = draft.TryGetValue(office, out var v) ? v : 0;var row = new VisualElement { name = "budget-" + office };row.AddToClassList("row");- row.Add(new Label(text.Format("budget.office", o.Title, Cabinet.Holder(c, s, office)?.Name ?? text["budget.vacant"])) { name = "budget-" + office + "-name" });+ // A budget line can run before its ministry exists (Education from 10 March 1949): say so, not "vacant".+ var who = o.From.HasValue && s.Date < o.From.Value ? text.Format("budget.not_established", PlayerText.Date(o.From.Value))+ : Cabinet.Holder(c, s, office)?.Name ?? text["budget.vacant"];+ row.Add(new Label(text.Format("budget.office", o.Title, who)) { name = "budget-" + office + "-name" });row[0].AddToClassList("grow");row.Add(new Button(() => Change(office, -Step)) { name = "budget-" + office + "-down", text = "-" });row.Add(new Label(text.Format("budget.share", PlayerText.Percent(share))) { name = "budget-" + office + "-share" });diff --git a/unity/Assets/Tests/EditMode/BudgetScreenTests.cs b/unity/Assets/Tests/EditMode/BudgetScreenTests.csindex 045d92f0b..315dd0dfd 100644--- a/unity/Assets/Tests/EditMode/BudgetScreenTests.cs+++ b/unity/Assets/Tests/EditMode/BudgetScreenTests.cs@@ -205,6 +205,18 @@ public class BudgetScreenTests}}+ /// <summary>#217: Education has a budget line from 1948, but the ministry dates from 10 March 1949. Its row says so+ /// instead of "vacant", and the Cabinet does not list it.</summary>+ [Test]+ public void AMinistryNotYetEstablishedSaysWhenItBegins()+ {+ var g = GameSession.New(C, GoldenRun.Seed, Mode.Historical);+ using var ui = new UiTestKit();+ new BudgetPresenter(ui.Root, new SimBridge(g, Text), Text);+ Assert.AreEqual("Minister of Education and Culture (no ministry until 10 March 1949)", ui.Q<Label>("budget-education_minister-name").text);+ Assert.IsFalse(Cabinet.Lineup(C, g.State).Any(x => x.Office.Id == "education_minister"));+ }+/// <summary>Playtest 1, item 6: a vacant ministry reads "(vacant)", as on the Cabinet screen, never "(-)".</summary>[Test]public void AVacantMinistryReadsVacant()diff --git a/unity/Assets/Tests/EditMode/DefenceScreenTests.cs b/unity/Assets/Tests/EditMode/DefenceScreenTests.csindex 4aef5036f..8d137d928 100644--- a/unity/Assets/Tests/EditMode/DefenceScreenTests.cs+++ b/unity/Assets/Tests/EditMode/DefenceScreenTests.cs@@ -29,7 +29,7 @@ public class DefenceScreenTestsAssert.IsFalse(ui.Q<VisualElement>("rung-2").ClassListContains("rung-current"));Assert.AreEqual("turns of a week", ui.Q<Label>("rung-5-turn").text);Assert.AreEqual("turns of a quarter", ui.Q<Label>("rung-1-turn").text);- Assert.AreEqual("A UN ceasefire will be imposed in 52 weeks", ui.Q<Label>("ceasefire").text);+ Assert.AreEqual("If full war goes on, the UN imposes a ceasefire in 52 weeks", ui.Q<Label>("ceasefire").text);Assert.AreEqual("Minister of Defense David Ben-Gurion · Chief of Staff Yaakov Dori", ui.Q<Label>("defence-command").text);Assert.AreEqual("80% of reserves called up (level 5 needs at least 80%)", ui.Q<Label>("mob-level").text);Assert.AreEqual("Costs IL 48.0m a year in pay and lost work", ui.Q<Label>("mob-cost").text);@@ -141,7 +141,7 @@ public class DefenceScreenTestsusing (ui){bridge.EndTurn();- Assert.AreEqual("A UN ceasefire will be imposed in 51 weeks", ui.Q<Label>("ceasefire").text);+ Assert.AreEqual("If full war goes on, the UN imposes a ceasefire in 51 weeks", ui.Q<Label>("ceasefire").text);Assert.AreEqual(51, bridge.State.CeasefireWeeksLeft);}}@@ -156,7 +156,7 @@ public class DefenceScreenTestsAssert.AreEqual(DisplayStyle.Flex, ui.Q<Label>("ceasefire").style.display.value);Assert.AreEqual("The UN ceasefire clock stops if the level is lowered", ui.Q<Label>("ceasefire").text);ui.Press("escalate");- Assert.AreEqual("A UN ceasefire will be imposed in 52 weeks", ui.Q<Label>("ceasefire").text);+ Assert.AreEqual("If full war goes on, the UN imposes a ceasefire in 52 weeks", ui.Q<Label>("ceasefire").text);}}diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yamlindex c1d590c9b..b4b9f2e67 100644--- a/unity/Assets/UI/strings.en.yaml+++ b/unity/Assets/UI/strings.en.yaml@@ -26,7 +26,7 @@ defence.turn_quarter: "turns of a quarter"defence.turn_month: "turns of a month"defence.turn_week: "turns of a week"defence.command: "Minister of Defense {0} · Chief of Staff {1}"-defence.ceasefire: "A UN ceasefire will be imposed in {0} weeks"+defence.ceasefire: "If full war goes on, the UN imposes a ceasefire in {0} weeks"defence.order: "Ordered: level {0} to {1}"defence.mob: "{0} of reserves called up (level {1} needs at least {2})"defence.mob_cost: "Costs {0} a year in pay and lost work"@@ -35,6 +35,7 @@ defence.ceasefire_starts: "UN ceasefire: {0} weeks once level 5 is reached"budget.share: "{0}"budget.office: "{0} ({1})"budget.vacant: "vacant"+budget.not_established: "no ministry until {0}"budget.factor: "spending effect {0}"budget.vote_needed: "The {0} must approve it: the coalition holds {1} of {2} seats"budget.no_vote: "The {0} does not vote on the budget"diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yamlindex 3e9cd41a0..2cd89d805 100644--- a/unity/Assets/UI/strings.he.yaml+++ b/unity/Assets/UI/strings.he.yaml@@ -25,7 +25,7 @@ defence.turn_quarter: "תורים של רבעון"defence.turn_month: "תורים של חודש"defence.turn_week: "תורים של שבוע"defence.command: "שר הביטחון {0} · הרמטכ״ל {1}"-defence.ceasefire: "האו״ם יכפה הפסקת אש בעוד {0} שבועות"+defence.ceasefire: "אם המלחמה תימשך במלוא עוצמתה, האו״ם יכפה הפסקת אש בעוד {0} שבועות"defence.order: "ניתנה פקודה: מדרגה {0} לדרגה {1}"defence.mob: "{0} מכוחות המילואים גויסו (דרגה {1} דורשת לפחות {2})"defence.mob_cost: "עלות שנתית של {0} בשכר ובאובדן עבודה"@@ -34,6 +34,7 @@ defence.ceasefire_starts: "הפסקת אש של האו״ם: {0} שבועות מbudget.share: "{0}"budget.office: "{0} ({1})"budget.vacant: "פנוי"+budget.not_established: "אין משרד עד {0}"budget.factor: "השפעת ההוצאה {0}"budget.vote_needed: "נדרש אישור של {0}: לקואליציה יש {1} מתוך {2} מנדטים"budget.no_vote: "{0} אינו מצביע על התקציב"