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.

fix(sim): model the $45m Q4 1951 credit maturity; widen the fx anchor; re-fit capital inflow to 200

eyalgolan3a9c154befaf
diff --git a/content/events/forex_crisis_1951.yaml b/content/events/forex_crisis_1951.yaml
index 77b59da24..798e8663c 100644
--- a/content/events/forex_crisis_1951.yaml
+++ b/content/events/forex_crisis_1951.yaml
@@ -12,12 +12,16 @@ options:
historical: true
recommended: true
effects:
- # The notes record the request, not its outcome; the fx effect is a game assumption, not a historical claim.
+ # About $45m of short-term credit matured Oct-Dec 1951 (FRUS d513); that it was paid, not rolled over, is a game
+ # assumption (foreign banks and oil companies refused to expand credit at the end of 1951, en.wiki Austerity).
+ - { target: fx_reserves, delta: -45 }
+ # The notes record the request, not its outcome; the +15 is a game assumption, not a historical claim.
- { target: fx_reserves, delta: 15 }
- { target: intl_standing, delta: -0.01 }
- id: cut_imports
text: Cut imports further
effects:
+ - { target: fx_reserves, delta: -45 }
- { target: food_supply, delta: -0.05 }
- { target: morale, delta: -0.04 }
sources:
diff --git a/content/rules.yaml b/content/rules.yaml
index efee37a98..e5cb037fe 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -24,11 +24,15 @@ exports_per_year: 40
imports_per_capita_per_year: 0.00025
# Donations, loans and transfers, set so reserves run out in the last quarter of 1951: the October 1951 crisis
# (FRUS 1951 v.V doc 513, https://history.state.gov/historicaldocuments/frus1951v05/d513, checked 2026-10-10).
-# Re-fitted from 192 to 193.8 after Task 4 moved the Israel Bonds inflow to its 10 May 1951 launch; consistency anchor: first
-# fx crisis in H2 1951 (FRUS d513, 19 Oct 1951). Only about 193.76 to 193.88 satisfies it (reserves non-negative through
-# May 1951, first negative at the turn ending 1951-11-26), because the events' lump sums and the quarterly turns make the
-# fit knife-edged; 193.8 is the smallest value on a 0.05 grid inside that range.
-capital_inflow_per_year: 193.8
+# History of this value: 192 (first fit, brief) -> 193.8 (re-fitted after Task 4 moved the Israel Bonds inflow to its
+# 10 May 1951 launch; consistency anchor: first fx crisis in H2 1951, FRUS d513, 19 Oct 1951) -> 200. The 193.8 fit was
+# knife-edged (valid range about 0.12 wide) because the model left out the documented drain of Q4 1951: about $45m of
+# short-term credit matured Oct-Dec 1951 (FRUS d513), now applied by both options of forex_crisis_1951. With that drain the
+# anchor (reserves not exhausted before the turn covering 19 Oct 1951; at its end below $45m; exhausted by the turn that
+# covers the end of 1951) holds for 193.78 to 206.62 (measured by bisection); 200 is the centre. Margins at 200: reserves
+# $18.9m at the turn after May 1951 and $21.6m at the turn covering 19 Oct (against $45m falling due); first crisis in the
+# turn ending 1952-02-26 (the one covering 31 Dec 1951); reserves -36.1 at the end of the run.
+capital_inflow_per_year: 200
# While reserves are exhausted, food imports are cut: food_supply falls by this much per year.
fx_crisis_food_per_year: -0.2
mobilization_cost_per_year: 60
diff --git a/docs/determinism.md b/docs/determinism.md
index 5609d884b..ae9cfdd9b 100644
--- a/docs/determinism.md
+++ b/docs/determinism.md
@@ -20,8 +20,8 @@ with `GoldenRun.Seed = 1948` on the real `content/`, then steps with `Historical
| Run | Ends | Hash |
|---|---|---|
-| to 1950-01-01 (`Hash1950`) | 1950-02-26, turn 45 | `bf6baf3ff8880b06b82ebf66a01157b29754eed117a7c2bdca528b05fa7959a4` |
-| to 1952-01-01 (`Hash1952`) | 1952-02-26, turn 53 | `1753fb88dfeef95d8260b8ffe6250e52b04b71ba10babe8a96d07914047257d0` |
+| to 1950-01-01 (`Hash1950`) | 1950-02-26, turn 45 | `43cc7773f890d8b79a7fc6a733d90b1314f452a91d766b0e7cf56aa8b9d43210` |
+| to 1952-01-01 (`Hash1952`) | 1952-02-26, turn 53 | `0359fa91b04d300084897a0d25b13dc92715d332363cfa2c285e6db740b83001` |
Each constant is written in three places that must agree:
- `sim/Statecraft.Sim/GoldenRun.cs`, which Unity code and players compare against;
@@ -47,3 +47,5 @@ rules or content, treat it as a determinism bug.
| M3 Task 4 | 1950 | `e2fa3896` | frumkin_commission (window from 1950-01-01) fires inside the run |
| M3 Task 5 | 1950 | `bf6baf3f` | economy calibrated (rules.yaml) and HistoricalAI sends reserves home after the armistices; capital_inflow_per_year 193.8 acts from 1948, so it moves this hash too |
| M3 Task 5 | 1952 | `1753fb88` | new run covering the M3 content range. Task 4 fix round 1 changed 1951 event windows/effects (hula, forex, bonds, clothing rationing, education, reparations), so capital_inflow_per_year was re-fitted from 192 to 193.8 (first fx crisis in H2 1951) |
+| M3 Task 5 fix 1 | 1950 | `43cc7773` | capital_inflow_per_year re-fitted 193.8 -> 200 (it acts from 1948) after the missing $45m credit maturity was added |
+| M3 Task 5 fix 1 | 1952 | `0359fa91` | forex_crisis_1951 now applies the documented -45 fx (FRUS d513) in both options, and capital_inflow_per_year is 200 |
diff --git a/sim/Statecraft.Sim.Tests/DeterminismTests.cs b/sim/Statecraft.Sim.Tests/DeterminismTests.cs
index 809477d40..d1377041e 100644
--- a/sim/Statecraft.Sim.Tests/DeterminismTests.cs
+++ b/sim/Statecraft.Sim.Tests/DeterminismTests.cs
@@ -19,7 +19,7 @@ public class DeterminismTests
/// <summary>Any change to this value is a deliberate rules or content change: update it here, in
/// GoldenRun.Hash1950 and in docs/determinism.md in the same commit.</summary>
- public const string GoldenHash = "bf6baf3ff8880b06b82ebf66a01157b29754eed117a7c2bdca528b05fa7959a4";
+ public const string GoldenHash = "43cc7773f890d8b79a7fc6a733d90b1314f452a91d766b0e7cf56aa8b9d43210";
/// <summary>Real content, seed 1948, Historical mode, HistoricalAI until the date reaches 1950-01-01.</summary>
public static GameState GoldenPlaythrough(Content c) => GoldenRun.Play(c, GoldenRun.Until1950);
@@ -34,7 +34,7 @@ public class DeterminismTests
}
/// <summary>Same rule for the second golden run, which covers the M3 content range (to 1952-01-01).</summary>
- public const string GoldenHash1952 = "1753fb88dfeef95d8260b8ffe6250e52b04b71ba10babe8a96d07914047257d0";
+ public const string GoldenHash1952 = "0359fa91b04d300084897a0d25b13dc92715d332363cfa2c285e6db740b83001";
[Fact]
public void GoldenPlaythroughTo1952HashIsFixed()
diff --git a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
index 6eb776598..23f164a1f 100644
--- a/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
+++ b/sim/Statecraft.Sim.Tests/EconomyCalibrationTests.cs
@@ -82,14 +82,23 @@ public class EconomyCalibrationTests
}
}
+ /// <summary>[consistency: capital_inflow_per_year is tuned to this anchor] FRUS 1951 v.V doc 513 (19 Oct 1951): the
+ /// crisis was acute in the last quarter of 1951, when about $45m of short-term credit fell due Oct-Dec and Israel
+ /// asked for $15m of immediate aid. So: (1) reserves are not exhausted before the turn that covers 19 October;
+ /// (2) at the end of that turn they cannot cover the $45m falling due; (3) they are exhausted no later than the turn
+ /// that covers the end of 1951.</summary>
[Fact]
- public void ForeignCurrencyRunsOutInTheLastHalfOf1951()
+ public void ForeignCurrencyRunsOutInTheLastQuarterOf1951()
{
- var first = History.FirstOrDefault(s => s.ActiveSituations.Contains(EconomySystem.FxCrisis));
- Assert.True(first != null, "[consistency: capital_inflow_per_year is tuned to this anchor] reserves never ran out");
- Assert.True(first!.Date > new DateTime(1951, 7, 1) && first.Date <= new DateTime(1952, 1, 1),
- $"[consistency: capital_inflow_per_year is tuned to this anchor] reserves ran out on {first.Date:yyyy-MM-dd}; historically in October 1951");
- Assert.All(History.Where(s => s.Date < first.Date), s => Assert.True(s.FxReserves >= 0, $"{s.Date:yyyy-MM-dd}: fx {F(s.FxReserves)}"));
+ const string kind = "[consistency: capital_inflow_per_year is tuned to this anchor]";
+ var frus = new DateTime(1951, 10, 19);
+ var i = History.FindIndex(s => s.ActiveSituations.Contains(EconomySystem.FxCrisis));
+ Assert.True(i > 0, kind + " reserves never ran out");
+ Assert.All(History.Take(i), s => Assert.True(s.FxReserves >= 0, $"{kind} {s.Date:yyyy-MM-dd}: fx {F(s.FxReserves)}"));
+ Assert.True(History[i].Date > frus && History[i - 1].Date < new DateTime(1952, 1, 1),
+ $"{kind} reserves ran out in the turn ending {History[i].Date:yyyy-MM-dd}; historically in the last quarter of 1951");
+ var october = History.First(s => s.Date >= frus).FxReserves;
+ Assert.True(october < 45, $"{kind} reserves at the turn covering 19 Oct 1951 are {F(october)} $m: enough to meet the $45m falling due");
}
/// <summary>[independent, loose] External debt rose IL 22.6m + 43.1m = 65.7m over 1950-51 (Michaely Table 5-2), which
diff --git a/sim/Statecraft.Sim.Tests/EconomyM3Tests.cs b/sim/Statecraft.Sim.Tests/EconomyM3Tests.cs
index 154081df6..afe45ce9a 100644
--- a/sim/Statecraft.Sim.Tests/EconomyM3Tests.cs
+++ b/sim/Statecraft.Sim.Tests/EconomyM3Tests.cs
@@ -44,6 +44,23 @@ public class EconomyM3Tests
Assert.Contains(why, w => w.Target == "food_supply" && w.Message == "food_supply -0.100 (foreign currency crisis: food imports cut)");
}
+ [Fact]
+ public void TheFoodCutStopsWhenTheCrisisEases()
+ {
+ var c = Load("fx_crisis_food_per_year: -0.4\n");
+ var s = Fresh(c);
+ s.FxReserves = -20;
+ EconomySystem.Apply(c, s, 0.25, new List<Cause>());
+ Assert.Contains(EconomySystem.FxCrisis, s.ActiveSituations);
+ var afterCut = s.Indicators["food_supply"];
+ s.FxReserves = 10 * c.Rules.FxStart; // well above the exit threshold, 0.25 * fx_start
+ EconomySystem.Apply(c, s, 0.25, new List<Cause>()); // the crisis eases in this step
+ Assert.DoesNotContain(EconomySystem.FxCrisis, s.ActiveSituations);
+ Assert.Equal(afterCut, s.Indicators["food_supply"], 9);
+ EconomySystem.Apply(c, s, 0.25, new List<Cause>());
+ Assert.Equal(afterCut, s.Indicators["food_supply"], 9);
+ }
+
[Fact]
public void NoCrisisNoFoodCut()
{
diff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.cs
index da8234f7e..23d070055 100644
--- a/sim/Statecraft.Sim/GoldenRun.cs
+++ b/sim/Statecraft.Sim/GoldenRun.cs
@@ -11,12 +11,12 @@ namespace Statecraft.Sim
/// <summary>Final hash of Play(content, Until1950). Changing it is a deliberate rules or content change:
/// update it, DeterminismTests and docs/determinism.md in the same commit and say why in the message.</summary>
- public const string Hash1950 = "bf6baf3ff8880b06b82ebf66a01157b29754eed117a7c2bdca528b05fa7959a4";
+ public const string Hash1950 = "43cc7773f890d8b79a7fc6a733d90b1314f452a91d766b0e7cf56aa8b9d43210";
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).</summary>
- public const string Hash1952 = "1753fb88dfeef95d8260b8ffe6250e52b04b71ba10babe8a96d07914047257d0";
+ public const string Hash1952 = "0359fa91b04d300084897a0d25b13dc92715d332363cfa2c285e6db740b83001";
public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);