A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: a refused armistice card comes back after its to date (R-WAR-008) (#2818)
Beribc51a1a9e30c
diff --git a/changelog.d/2813.md b/changelog.d/2813.mdnew file mode 100644index 000000000..22111b4d6--- /dev/null+++ b/changelog.d/2813.md@@ -0,0 +1,4 @@+### Fixed+- gdd-0.3: a refused armistice card now comes back after its `to` date once its front has had two full quiet turns+ (R-WAR-008). Before, a card refused late in 1949 was never offered again from 1 January 1950. Not live in shipped play,+ which runs gdd-0.1 (Fixes #2813).diff --git a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.csindex 6da1651f1..6f511810f 100644--- a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs@@ -238,6 +238,24 @@ options:Assert.Equal(new[] { "armistice_jordan" }, Fire(c, s));}+ // R-WAR-008 (#2813): the rule gives a refused card's return no end date, so a quiet front brings it back after its `to`+ // as well. The real cards all end `to: 1950-01-01`; here Jordan's card (from 1949-07-20), refused,+ // must still come on the 15 February 1950 turn once its front has been quiet for two turns.+ [Fact]+ public void R_EVT_002_ARefusedCardReturnsAfterItsTo()+ {+ var f = Gdd03MovementFortTests.Files(SaveGame.Gdd03Ruleset);+ f["events/armistice_egypt.yaml"] = Card("egypt", "1949-12-01");+ f["events/armistice_jordan.yaml"] = Card("jordan", "1949-07-20").Replace("from: 1949-07-20", "from: 1949-07-20\nto: 1950-01-01");+ var c = ContentLoader.Load(Fixture.Write(f));+ var s = At(c, new DateTime(1950, 2, 15), 2, 1);+ s.FiredEvents.Add("armistice_egypt"); s.ChosenOptions["armistice_egypt"] = "sign";+ s.FiredEvents.Add("armistice_jordan"); s.ChosenOptions["armistice_jordan"] = "hold_out";+ Assert.Empty(Fire(c, s));+ s.QuietTurns["jordan"] = 2;+ Assert.Equal(new[] { "armistice_jordan" }, Fire(c, s));+ }+// R-WAR-008, R-EVT-003 (owner, 4 November 2026, #2508, option A, "keep early signing"): in Historical mode an early card// left unanswered is still a hard anchor for delegation, so it signs on the 15 December 1948 turn, long before its date.[Fact]diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex f2e4e2d92..5efe1f310 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -14,7 +14,8 @@ namespace Statecraft.Sim/// <summary>Fires every unfired event whose `requires` (if any) is met, whose window [From, To) overlaps the turn just played,/// [<paramref name="turnStart"/>, s.Date), or contains s.Date; <paramref name="turnStart"/> defaults to s.Date- /// (game start). Every eligible hard anchor fires; MaxSoftEventsPerTurn caps only the non-hard events per turn,+ /// (game start). A quiet armistice card (R-WAR-008, gdd-0.3) is the exception: it can fire before its From and after its To.+ /// Every eligible hard anchor fires; MaxSoftEventsPerTurn caps only the non-hard events per turn,/// which fill the slots that remain (max(0, cap - hard count)) in the usual order (an early armistice first, R-WAR-008, then consequence cards, R-ALT-008, then From, objective cards last in objectives.yaml's order, R-OBJ-007, then id). Objective and Deport cards take no soft slot. The fired/// events keep the usual order. An eligible soft event left out by the cap waits past its window until it can fire./// Late fire: an event whose window overlapped the turn just played can fire after its window has ended; its@@ -31,9 +32,10 @@ namespace Statecraft.Sim// (Armistice.MayOfferEarly): before its hard-anchor date, and again after a refusal. On that path it is soft.var quiet = new HashSet<string>(c.Events.Where(e => e.FrontQuiet != "" && Armistice.MayOfferEarly(c, s, e.FrontQuiet)&& (s.FiredEvents.Contains(e.Id) || s.Date < e.From)).Select(e => e.Id));+ // R-WAR-008 (#2813): a quiet armistice card has no end date, so its `to` (1950-01-01 on the real cards) does not end it.var eligible = c.Events.Where(e => (quiet.Contains(e.Id) || !s.FiredEvents.Contains(e.Id) && e.From <= s.Date)- && (s.CappedEvents.Contains(e.Id) || e.To == null || start < e.To.Value))+ && (quiet.Contains(e.Id) || s.CappedEvents.Contains(e.Id) || e.To == null || start < e.To.Value)).Where(e => !endingTurn || EndingCard(s, e)).Where(e => Timeline.AllMet(c, s, e))// R-OBJ-003: an objective's card waits for the objective. Only the GDD loop records one, so in the legacy loop it never fires.