A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Sim: gate and order early armistice offers by quiet turns, stacked on #2318 (Fixes #2478) (#2508)
Berib167502c708a
diff --git a/changelog.d/1709-armistice-offers.md b/changelog.d/1709-armistice-offers.mdnew file mode 100644index 000000000..736b77d21--- /dev/null+++ b/changelog.d/1709-armistice-offers.md@@ -0,0 +1,7 @@+### Added++- Under the gdd-0.3 ruleset only, an armistice can now come early (Fixes #2478, Refs #1709). From the 15 December 1948+ turn, once a front has had two quiet turns, its armistice card can come before its historical date. After a refusal,+ the card comes back once two full quiet turns have followed. Early cards come first among the turn's three+ soft-event places, ahead of follow-up cards and other events. The historical dates still bring the card if the front+ never goes quiet. The current game (gdd-0.1) is unchanged.diff --git a/content/events/armistice_egypt.yaml b/content/events/armistice_egypt.yamlindex 40649239e..4e0b364b9 100644--- a/content/events/armistice_egypt.yaml+++ b/content/events/armistice_egypt.yaml@@ -7,6 +7,7 @@ text: 'Talks in Rhodes have produced an armistice agreement with Egypt. {prime_mtitle_he: שביתת הנשק עם מצריםtext_he: 'השיחות ברודוס הניבו הסכם שביתת נשק עם מצרים. על {prime_minister} להחליט אם ישראל תחתום עליו.'anchor: hard+front_quiet: egyptoffice: prime_ministerfrom: 1949-02-24# Hard anchor: fires on the first turn on or after `from`. `to` (exclusive, end of 1949) only makes the window finite,diff --git a/content/events/armistice_jordan.yaml b/content/events/armistice_jordan.yamlindex 3bac15510..8acbbbdf1 100644--- a/content/events/armistice_jordan.yaml+++ b/content/events/armistice_jordan.yaml@@ -7,6 +7,7 @@ text: 'Negotiators have reached an armistice agreement with Jordan. {prime_ministitle_he: שביתת הנשק עם ירדןtext_he: 'המשא ומתן הניב הסכם שביתת נשק עם ירדן. על {prime_minister} להחליט אם ישראל תחתום עליו.'anchor: hard+front_quiet: jordanoffice: prime_ministerfrom: 1949-04-03# Hard anchor: fires on the first turn on or after `from`. `to` (exclusive, end of 1949) only makes the window finite,diff --git a/content/events/armistice_lebanon.yaml b/content/events/armistice_lebanon.yamlindex b1460222f..19a23fe72 100644--- a/content/events/armistice_lebanon.yaml+++ b/content/events/armistice_lebanon.yaml@@ -7,6 +7,7 @@ text: 'Negotiators have reached an armistice agreement with Lebanon. {prime_minititle_he: שביתת הנשק עם לבנוןtext_he: 'המשא ומתן הניב הסכם שביתת נשק עם לבנון. על {prime_minister} להחליט אם ישראל תחתום עליו.'anchor: hard+front_quiet: lebanonoffice: prime_ministerfrom: 1949-03-23# Hard anchor: fires on the first turn on or after `from`. `to` (exclusive, end of 1949) only makes the window finite,diff --git a/content/events/armistice_syria.yaml b/content/events/armistice_syria.yamlindex ae058f70a..aa2ddb1f8 100644--- a/content/events/armistice_syria.yaml+++ b/content/events/armistice_syria.yaml@@ -7,6 +7,7 @@ text: 'Negotiators have reached an armistice agreement with Syria. {prime_ministtitle_he: שביתת הנשק עם סוריהtext_he: 'המשא ומתן הניב הסכם שביתת נשק עם סוריה. על {prime_minister} להחליט אם ישראל תחתום עליו.'anchor: hard+front_quiet: syriaoffice: prime_ministerfrom: 1949-07-20# Hard anchor: fires on the first turn on or after `from`. `to` (exclusive, end of 1949) only makes the window finite,diff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex 3242183fc..07b4e74aa 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -82,6 +82,7 @@"site": { "$ref": "#/definitions/id", "description": "A swamp site (sites.yaml) whose works this event is about. In the GDD loop it fires only while that site is being worked; the legacy loop ignores it." },"prisoners": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "The front whose prisoners this exchange card returns (R-POW-004). It fires only while that front holds prisoners or the player's soldiers, and has exactly one option. Jordan's card also returns the Iraqi prisoners." },"deported": { "$ref": "#/definitions/id", "description": "A settlement target (settlement_targets.yaml) whose residents stayed. This Deport follow-up card fires only once the player's Deport has depopulated that place, carries the displacement tag and has exactly one option (R-EVT-007)." },+ "front_quiet": { "enum": ["egypt", "jordan", "lebanon", "syria"], "description": "The front of this armistice_<front> card, on that card only. Under gdd-0.3 the card may also come before its from, and again after a refusal, once that front is quiet (Armistice.MayOfferEarly), and then it takes the first soft slot (R-WAR-008, R-EVT-002)." },"order": { "type": "integer", "description": "Default 0. Among the cards that fire on the same turn with the same from, a lower order comes first, then the id (R-EVT-006). Set it only to put one card after another on purpose." },"from": { "$ref": "#/definitions/date", "description": "First day of the window." },"to": { "$ref": "#/definitions/date", "description": "End of the window (exclusive). Leave out for an open window." },diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex 435bc11b6..79a6de92a 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -47,6 +47,7 @@ schema too, or that test fails. Keep the comment when you copy a file.| `site` | no | A swamp site in `sites.yaml` whose works the event is about. In the GDD loop it fires only while that site is being worked (R-SWAMP-002); the legacy loop ignores it. See `docs/gdd/fields-and-swamps.md`. || `prisoners` | no | Makes the event a front's prisoner-exchange card: `egypt`, `jordan` (which also returns the Iraqi prisoners), `lebanon` or `syria`. It fires only while that front holds prisoners or the player's soldiers (GDD loop only), has exactly one option, and returns them and scores when it resolves (R-POW-004). || `deported` | no | Makes the event Deport's follow-up card for a settlement target whose residents stayed: it fires only once the player's Deport has depopulated that place, carries the `displacement` tag and has exactly one option (R-EVT-007). See "deported". |+| `front_quiet` | no | On a front's armistice card only (`armistice_<front>`, one of `egypt`, `jordan`, `lebanon`, `syria`). Under `gdd-0.3` the card may also come before its `from`, and again after a refusal, once that front has been quiet long enough; it then takes the first soft slot (R-WAR-008, R-EVT-002). || `options` | yes | One or more options. See below. || `sources` | no by the loader, yes by the rules | A list of `{ url, checked }`. See below. || `status` | no (default `draft`) | The review status. See below. |diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 5c6b95583..987a5ee32 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -378,12 +378,14 @@ R-WAR-003 (first slice): the GDD loop retires the 52-week UN ceasefire clock (Q-R-WAR-004: Military actions move no parameter in the GDD loop (Q-CIV-3, "No effect in Phase 5", owner, 15 October 2026, #375): attacks, attacks refused in a truce and moves (the sim has no frontier, Q-MOVE-4, so crossing one is a move), with their losses, leave International Support (`intl_standing`) and Social cohesion (`morale`) exactly where a turn without them does. R-POW-002's prisoner Food-shortfall cohesion cost is the stated exemption.-R-WAR-005: Under exact `gdd-0.3` (`gdd-0.1` in #752), each of the four fronts, Egypt, Jordan (with the Iraqi sector), Lebanon and Syria, keeps a count of consecutive quiet turns from the scenario start, so turns before 16 November 1948 count (Q48, owner, 1 November 2026). A quiet turn has no engagement with a unit of that front, whoever attacked: the player's instant attack and step 2's attacks alike (`Combat.Engage`). A mixed-front engagement breaks the count of every front in it; a refused order engages nothing and breaks nothing; the ALA and local forces belong to no front. At the turn's end, after the war loss, each front not engaged gains 1 and each engaged front goes to 0. An early armistice offer is eligible for a front not yet signed from the 15 December 1948 turn (owner, 27 October 2026, #1709: "The first offer can come on the 15 December 1948 turn, not earlier") once the count reaches `military.armistice_quiet_turns` (2, `content/gdd03-balance.yaml`). The offer card itself is #1709 slice B. The counts and the fronts engaged in the open turn are written into the state hash only when present, so no other ruleset's hash changes. Draws nothing.+R-WAR-005: Under exact `gdd-0.3` (`gdd-0.1` in #752), each of the four fronts, Egypt, Jordan (with the Iraqi sector), Lebanon and Syria, keeps a count of consecutive quiet turns from the scenario start, so turns before 16 November 1948 count (Q48, owner, 1 November 2026). A quiet turn has no engagement with a unit of that front, whoever attacked: the player's instant attack and step 2's attacks alike (`Combat.Engage`). A mixed-front engagement breaks the count of every front in it; a refused order engages nothing and breaks nothing; the ALA and local forces belong to no front. At the turn's end, after the war loss, each front not engaged gains 1 and each engaged front goes to 0. An early armistice offer is eligible for a front not yet signed from the 15 December 1948 turn (owner, 27 October 2026, #1709: "The first offer can come on the 15 December 1948 turn, not earlier") once the count reaches `military.armistice_quiet_turns` (2, `content/gdd03-balance.yaml`). The offer itself is R-WAR-008. The counts and the fronts engaged in the open turn are written into the state hash only when present, so no other ruleset's hash changes. Draws nothing.R-WAR-006: Under exact `gdd-0.3` (`gdd-0.1` in #752), refusing a front's armistice (`hold_out` on `armistice_<front>`) sets that front's count to 0, so two full quiet turns must follow before an early offer is eligible again (Q49, owner, 1 November 2026; Q-OBJ-2). The refusal's own turn does not count (Q49: "Does the refusal turn count toward the next quiet period? No."): the card is answered before its turn resolves, so the refusal also marks its front as engaged for that turn, which ends at 0; a refusal on turn T with T+1 and T+2 quiet makes the front eligible on T+3. Which refusal resets the count is #1709's open question 4.R-WAR-007: Under exact `gdd-0.3` (`gdd-0.1` in #752), signing a front's armistice (`sign` on `armistice_<front>`) removes every unit of that front from the board, Iraqi units with Jordan's, and no other (Q-OBJ-4, owner, 15 October 2026). Prisoners and the player's soldiers held stay as they are until the exchange card (R-POW-004), and Send home follows R-UNIT-005 unchanged: a unit whose nearest front-bearing enemy is on a signed front may go home. Because the signed front's units leave, a unit that also borders another front's unit now counts as on that other front and waits for its armistice. The armistice lines stay display-only.+R-WAR-008: Under exact `gdd-0.3` (`gdd-0.1` in #752), each front's armistice card (`armistice_<front>`, `front_quiet: <front>`) also comes while that front may have an early offer (R-WAR-005, R-WAR-006): before its `from`, and again after a refusal (#2478). It reads only its own front's count, so another front's quiet turns never bring it. On that path it is a soft event that takes the first soft slot (R-EVT-002). The sourced `from` stays the card's ordinary path, a hard anchor as before, so a front that never turns quiet gets its card on its date. A refused card, early or on its date, comes back only once two full quiet turns have followed the refusal, and its `from` does not bring it back again; a signed front gets no card again. Left unanswered, the card is still a hard anchor for R-EVT-003, so in Historical mode it takes its historical option (`sign`) on either path, as early as the 15 December 1948 turn (owner, 4 November 2026, #2508, option A: "keep early signing", https://github.com/eyalgolan/statecraft-israel/pull/2508#issuecomment-6630316010). The card's text, dates, options and effects are the same on both paths. Draws nothing.+## PrisonersPhase 5 PR 12 (#751). The impact plan's §4.3 as written (Q-POW-1), points per unit returned (Q-POW-2), a sourced event card per front (Q-POW-3), the player's soldiers counted with a cost (Q-POW-4) and a Food cost whose shortfall costs cohesion (Q-POW-5): the owner's picks of 15 October 2026 (#375). The four amounts (`rules.yaml` `mvp.food_per_prisoner_unit`, `mvp.prisoner_shortfall_cohesion`, `mvp.points_per_prisoner_unit_returned`, `mvp.held_soldier_cost_per_turn`) are agent defaults posted on #751 (https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6318787961), accepted by the owner as design values (owner, 21 October 2026, #751: https://github.com/eyalgolan/statecraft-israel/issues/751#issuecomment-6321366548). The same ruling says ALA and local-force prisoners belong to no front, so they stay held, and fed, to the game's end. It does not name the front of each side or the captor of the player's soldiers; those stay agent defaults. The four sourced exchange cards are not in `content/` yet: they wait for a person's source check (CONTENT_POLICY §2) and the owner's sensitivity review.@@ -546,7 +548,7 @@ D-H1 in the GDD loop (GDD Phase 7 PR 1, #805). The owner took the plan's recommeR-EVT-001: An event fires on the first turn whose span overlaps its window `[from, to)` (or at the new game, when the start date is in it), once its `requires` is met and its conditions hold; an objective's card also waits for its objective (R-OBJ-003). Every eligible hard anchor fires. At most 3 soft events fire a turn (`EventSystem.MaxSoftEventsPerTurn`); they take the slots the hard anchors leave, `max(0, 3 - hard anchors)`, and the rest wait for a later turn (Q-CUT-6).-R-EVT-002: The soft events take the free slots in order: consequence cards first (R-ALT-008), then the rest by `from`, then id (ordinal). The decided place of an early armistice ahead of the other soft events (Q-EVT-1, through `front_quiet`, Q-OBJ-1) lands with that key in Phase 5 PR 13 (#752), and this rule is reworded then.+R-EVT-002: The soft events take the free slots in order: an early armistice first (`front_quiet`, R-WAR-008; Q-EVT-1, Q-OBJ-1), then consequence cards (R-ALT-008), then the rest; within each group by `from`, then `order` (R-EVT-006), then id (ordinal). So two fronts that turn quiet on the same turn come in a stable order, and the cap of 3 still holds. With no early armistice eligible the order is unchanged.R-EVT-003: An event the player leaves unanswered at End Turn is delegated to its office's holder (Q-EVT-2): with probability competence/10 the holder picks the recommended option (else the first), otherwise a random option. In Historical mode a hard anchor takes its historical option, and an objective's card its one option, with no RNG draw. A holder whose loyalty is below `delegation_loyalty_floor` (5) applies only `disloyal_effect_share` (0.5) of each numeric effect of the option drawn; the grants, city effects, policies and security level apply whole, and so do a hard anchor's historical option and an objective's card. Why: competence decides which option a minister picks, loyalty how hard he works to carry out a decision the player left to him (#107, owner, 18 October 2026: "minister loyalty changes a delegated event's outcome"). Both are design values (R-LOOP-005), required by the loader: the floor 0 to 10, the share 0 to 1. Every minister in `people.yaml` is rated 5 or more today (5 is the deputies' neutral rating), so the rule changes no shipped game until a rating goes below the floor.@@ -576,7 +578,7 @@ R-ALT-006: A consequence card may follow only an option whose `alternative.basisR-ALT-007: A consequence card carries every sensitive tag (case aside) of each event it requires, so the no-gain rule (R-EFX-002, R-EFX-005) covers it.-R-ALT-008: Consequence cards take a turn's soft slots before the other soft events, then by `from` and id (Q-ALT-14). A `front_quiet` armistice (Q-EVT-1, Phase 5 PR 13) will come before them. With no consequence card eligible the order is unchanged.+R-ALT-008: Consequence cards take a turn's soft slots before the other soft events, then by `from` and id (Q-ALT-14). An early `front_quiet` armistice (R-WAR-008, R-EVT-002) comes before them. With no consequence card eligible the order is unchanged.R-ALT-009: An option of a consequence card may `rejoin` an event whose road the card follows (and which has a historical option). Once it is chosen, a requirement on that event's historical option holds, so the record's later cards fire again if their windows are still open. The event's own chosen option is not rewritten, and `diverged: true` on it still holds.diff --git a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.csnew file mode 100644index 000000000..23f73c6d5--- /dev/null+++ b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeOfferTests.cs@@ -0,0 +1,254 @@+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++/// <summary>#2478 (#1709 slice B), R-WAR-008, R-EVT-002 and R-ALT-008 under exact gdd-0.3: an armistice card with+/// `front_quiet` may come before its hard-anchor date, and again after a refusal, once its own front may have an early offer+/// (#2318's Armistice.MayOfferEarly: from the 15 December 1948 turn, military.armistice_quiet_turns quiet turns, two full+/// quiet turns after a refusal). On that path it is a soft event that takes the first soft slot, ahead of consequence cards+/// and the other soft events, within the cap of 3. Gdd03MovementFortTests' board and the real catalogue (2 quiet turns).</summary>+public class Gdd03ArmisticeOfferTests+{+ // The real cards' shape (content/events/armistice_*.yaml) with their own front. The dates are the fixture's: Egypt's+ // hard anchor is a year after the turns these tests play, Jordan's comes later still.+ static string Card(string front, string from) => $@"+id: armistice_{front}+title: Armistice with {front}+text: 'Israel decides whether to sign.'+office: prime_minister+anchor: hard+front_quiet: {front}+from: {from}+options:+ - id: sign+ text: Sign the armistice+ historical: true+ - id: hold_out+ text: Refuse and keep fighting+ alternative: {{ basis: design }}+";++ const string Parent = @"+id: parent+title: Parent+text: 'A real decision.'+from: 1948-12-01+to: 1948-12-11+options:+ - id: record+ text: What happened+ historical: true+ - id: road+ text: The road not taken+ alternative:+ basis: proposed+ by: the opposition benches+ date: 1948-12-05+ sources: [{ url: ""https://example.org/minutes"", checked: 2026-10-17 }]+";++ const string Consequence = @"+id: after_road+kind: consequence+title: After the road+text: 'What the record says was feared.'+from: 1948-12-11+to: 1949-02-01+requires: [{ event: parent, option: road }]+options:+ - id: hold+ text: Hold the course+ alternative:+ basis: debated+ by: the cabinet+ date: 1948-12-12+ sources: [{ url: ""https://example.org/cabinet"", checked: 2026-10-17 }]+";++ // An ordinary soft event whose `from` is earlier than every armistice's, so ordering by `from` alone would put it first.+ static string Soft(string id) => $"id: {id}\ntitle: {id}\ntext: 'Ordinary.'\nfrom: 1948-12-01\nto: 1949-02-01\noptions:\n - id: ok\n text: Ok\n";++ static Content Load(string ruleset = SaveGame.Gdd03Ruleset, string jordanFrom = "1950-01-01", bool others = true)+ {+ var f = Gdd03MovementFortTests.Files(ruleset);+ f["events/armistice_egypt.yaml"] = Card("egypt", "1949-12-01");+ f["events/armistice_jordan.yaml"] = Card("jordan", jordanFrom);+ if (others)+ {+ f["events/parent.yaml"] = Parent;+ f["events/after_road.yaml"] = Consequence;+ foreach (var id in new[] { "a1", "a2", "a3" }) f[$"events/{id}.yaml"] = Soft(id);+ }+ return ContentLoader.Load(Fixture.Write(f));+ }++ static GameState At(Content c, DateTime date, int egypt, int jordan)+ {+ var s = CombatTests.With(c);+ s.Date = date;+ s.QuietTurns["egypt"] = egypt; s.QuietTurns["jordan"] = jordan;+ s.FiredEvents.Add("parent"); // decided earlier; only after_road's requirement reads it+ s.ChosenOptions["parent"] = "record";+ return s;+ }++ static readonly DateTime December15 = new DateTime(1948, 12, 15);++ static List<string> Fire(Content c, GameState s)+ {+ EventSystem.Trigger(c, s, new List<Cause>(), s.Date.AddDays(-1));+ return s.PendingEvents.ToList();+ }++ // R-WAR-008, R-EVT-002 (owner, 27 October 2026, #1709: "The first offer can come on the 15 December 1948 turn, not+ // earlier"): quiet fronts get no early offer on the turn before; on the 15 December turn the card comes, ahead of the+ // ordinary soft events.+ [Fact]+ public void R_EVT_002_NoEarlyOfferBeforeTheFifteenthOfDecemberTurn()+ {+ var c = Load(others: false);+ Assert.Empty(Fire(c, At(c, new DateTime(1948, 12, 14), 5, 5)));+ Assert.Equal(new[] { "armistice_egypt", "armistice_jordan" }, Fire(c, At(c, December15, 5, 5)));+ }++ // R-WAR-008, R-WAR-005: the card reads its own front's count, so another front's quiet turns never open it.+ [Fact]+ public void R_EVT_002_AnotherFrontsQuietTurnsDoNotOpenTheCard()+ {+ var c = Load(others: false);+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, At(c, December15, 2, 1)));+ Assert.Equal(new[] { "armistice_jordan" }, Fire(c, At(c, December15, 0, 7)));+ }++ // R-EVT-002, R-ALT-008 (Q-EVT-1, Q-OBJ-1): an early armistice takes the first soft slot, then the consequence card, then+ // the ordinary soft events by `from` and id, three in all.+ [Fact]+ public void R_EVT_002_R_ALT_008_AnEarlyArmisticeComesAheadOfConsequenceAndOrdinarySoftEvents()+ {+ var c = Load();+ var s = At(c, December15, 2, 0);+ s.ChosenOptions["parent"] = "road";+ Assert.Equal(new[] { "armistice_egypt", "after_road", "a1" }, Fire(c, s));+ }++ // R-EVT-002, R-ALT-008: two fronts eligible together take the first two slots in a stable order (the cards' `from`, then+ // the id, ordinal) and the cap of 3 still holds; with the same `from` the id decides.+ [Theory]+ [InlineData("1950-01-01", new[] { "armistice_egypt", "armistice_jordan", "after_road" })]+ [InlineData("1949-12-01", new[] { "armistice_egypt", "armistice_jordan", "after_road" })]+ [InlineData("1949-11-01", new[] { "armistice_jordan", "armistice_egypt", "after_road" })]+ public void R_EVT_002_R_ALT_008_TwoEligibleFrontsKeepAStableOrderAndTheCap(string jordanFrom, string[] expected)+ {+ var c = Load(jordanFrom: jordanFrom);+ var s = At(c, December15, 3, 3);+ s.ChosenOptions["parent"] = "road";+ var pending = Fire(c, s);+ Assert.Equal(expected, pending);+ Assert.Equal(EventSystem.MaxSoftEventsPerTurn, pending.Count);+ var again = At(c, December15, 3, 3);+ again.ChosenOptions["parent"] = "road";+ Assert.Equal(pending, Fire(c, again));+ }++ // R-EVT-001, R-WAR-008: the sourced hard-anchor date stays the card's ordinary path: on or after it, a front that is not+ // quiet still gets its card, as a hard anchor that takes no soft slot.+ [Fact]+ public void R_EVT_001_TheHardAnchorDateStaysTheOrdinaryPath()+ {+ var c = Load();+ var s = At(c, new DateTime(1949, 12, 15), 0, 0);+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, s));++ var early = At(c, new DateTime(1949, 1, 15), 2, 0);+ Assert.Equal(new[] { "armistice_egypt", "a1", "a2" }, Fire(c, early)); // early, it is soft: a3 waits+ }++ // R-WAR-006, R-WAR-008 (Q49: "Two full quiet turns must follow the refusal"): a card refused on turn T does not come at+ // the end of T or T+1, and comes again at the end of T+2, once T+1 and T+2 were quiet; then signing ends it.+ [Fact]+ public void R_EVT_002_ARefusedOfferReturnsOnlyAfterTwoFullQuietTurns()+ {+ var c = Load(others: false);+ var s = CombatTests.With(c, new Unit(1, "recruit", 0, 1, side: "israel", strength: 6));+ s.Date = December15;+ s.QuietTurns["jordan"] = 5;+ s.FiredEvents.Add("armistice_egypt");+ s.ChosenOptions["armistice_egypt"] = "sign"; // Egypt is out of the way: a signed front gets no card+ Assert.Equal(new[] { "armistice_jordan" }, Fire(c, s));++ s = Turn(c, s, new ChooseEventOption("armistice_jordan", "hold_out"));+ Assert.Empty(s.PendingEvents);+ s = Turn(c, s);+ Assert.Empty(s.PendingEvents);+ s = Turn(c, s);+ Assert.Equal(new[] { "armistice_jordan" }, s.PendingEvents);+ s = Turn(c, s, new ChooseEventOption("armistice_jordan", "sign"));+ s = Turn(c, s);+ s = Turn(c, s);+ Assert.Empty(s.PendingEvents);+ }++ // R-WAR-006, R-WAR-008: a card refused on or after its date is not brought back by its date while its front is not+ // quiet, so it does not come every turn; it comes back once the front has had two quiet turns again.+ [Fact]+ public void R_EVT_002_ACardRefusedOnItsDateReturnsOnlyThroughTheQuietPath()+ {+ var c = Load(others: false);+ 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]+ public void R_EVT_003_HistoricalModeSignsAnUnansweredEarlyCard()+ {+ var c = Load(others: false);+ var s = CombatTests.With(c, new Unit(1, "recruit", 0, 1, side: "israel", strength: 6));+ s.Mode = Mode.Historical;+ s.Date = December15;+ s.QuietTurns["egypt"] = 2;+ Assert.Equal(new[] { "armistice_egypt" }, Fire(c, s));++ var rng = s.RngState;+ s = Turn(c, s);+ Assert.Equal("sign", s.ChosenOptions["armistice_egypt"]);+ Assert.Equal(rng, s.RngState); // the hard-anchor path: ordinary delegation would draw+ }++ static GameState Turn(Content c, GameState s, params Command[] orders)+ {+ var r = Simulation.Step(c, s, orders);+ Assert.Empty(r.Rejected);+ return r.State;+ }++ // R-WAR-008 is gdd-0.3 only: under gdd-0.1 the same quiet counts open nothing before the hard-anchor date.+ [Fact]+ public void Gdd01HasNoEarlyOffer()+ {+ var c = Load(SaveGame.GddRuleset);+ var s = At(c, December15, 5, 5);+ s.ChosenOptions["parent"] = "road";+ Assert.Equal(new[] { "after_road", "a1", "a2" }, Fire(c, s));+ }++ // The loader: `front_quiet` names one of Prisoners.Fronts, and only on that front's own card (armistice_<front>), whose+ // refusal resets that front's count (R-WAR-006).+ [Theory]+ [InlineData("iraq", "unknown front 'iraq'")]+ [InlineData("egypt", "armistice_egypt")]+ public void TheLoaderRefusesAFrontQuietThatIsNotTheCardsOwnFront(string front, string message)+ {+ var f = Gdd03MovementFortTests.Files();+ f["events/armistice_jordan.yaml"] = Card("jordan", "1950-01-01").Replace("front_quiet: jordan", "front_quiet: " + front);+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(f)));+ Assert.Equal("events[armistice_jordan].front_quiet", ex.Field);+ Assert.Contains(message, ex.Message);+ }+}diff --git a/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs b/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.csindex 73cf2b507..21fbfba11 100644--- a/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs@@ -464,10 +464,10 @@ public class Gdd03EventRulesTests{"absorb_immigrants:95682d1835e8de59e3e69f56a9beb13ddf91447270a672d23eaff2523898fea1", // re-pinned for #1065 (reviewer comment matches the text), then for the stale reviewer comment (comment-only)"altalena:83f547759e5a991e78c32240c2ee3551b9b8ad9acdad8c135621b56805895f8d", // re-pinned for #1065 (owner's native read; flag removed in 8fbcb2aff), then for the stale reviewer comment (comment-only)- "armistice_egypt:d361db22977057e24e0cb515afbfee37439cbdce38e465960b4978d082f5704f", // re-pinned for #1065 (Beri's native Hebrew read)- "armistice_jordan:484bedf4869f6b01aec1a2d400c577183654a6d36930da065a77ddf203cf4450", // re-pinned for #1065 (Beri's native Hebrew read)- "armistice_lebanon:81141de094d4d536c6c0e22b93a0d3704a3f1d999b3813a51c2d08f2ae8ecf11", // re-pinned for #1065 (Beri's native Hebrew read)- "armistice_syria:2b83f89ff2effe21e01d511a7ea1e0a41f937ee96e39a16977ab6f7e8999257e", // re-pinned for #1065 (Beri's native Hebrew read)+ "armistice_egypt:2782d099ed22372454d85a83e661ecb6d527826d57b23f4f329116c2017b8b0f", // re-pinned for #1065 (Beri's native Hebrew read), then for #2478's front_quiet key (no text, date, option or effect changed)+ "armistice_jordan:98168d2a194a9cb66af5c6e36f701c1a38a09217a30d2782089ebc2d0e069571", // re-pinned for #1065 (Beri's native Hebrew read), then for #2478's front_quiet key (no text, date, option or effect changed)+ "armistice_lebanon:6d55a7bc6d9e9d339ebb6ebb1a72eb09cbc7c13df88fdd16207963f6ca309b56", // re-pinned for #1065 (Beri's native Hebrew read), then for #2478's front_quiet key (no text, date, option or effect changed)+ "armistice_syria:18bc8bf1fd1e15749d56278232578258267f0b6d6e605431ba098368bf510397", // re-pinned for #1065 (Beri's native Hebrew read), then for #2478's front_quiet key (no text, date, option or effect changed)"austerity_1949:7b4534f4982116745eef2ab2f959ad52faf6efa8efb7f0f5bda3844bac590cc4", // re-pinned for #1065 (Beri's native Hebrew read)"bernadotte_assassination:3b7bce0f1707180fffdd254a6848efbb095cdf38dd70c7b31e83475c34623ec2", // re-pinned for #1065 (Beri's native Hebrew read), then for the stale reviewer comment (comment-only)"burma_road_complete:6c49179b3844761c6f580c1436596cbace6932cbb6b620a9ea2872b6e0342ba2", // re-pinned for #1065 (owner's native read; flag removed in 8fbcb2aff), then for the stale reviewer comment (comment-only)diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 42e3bb842..17c71040f 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -1207,6 +1207,11 @@ namespace Statecraft.Sim/// Phase 6 PR 9, #801): it fires only once the player's Deport has depopulated that place, has exactly one option,/// resolves without a draw and carries the <c>displacement</c> tag. Empty for every other event.</summary>public string Deported { get; set; } = "";+ /// <summary>The front (one of Prisoners.Fronts) whose armistice this card is, on that front's own card only+ /// (armistice_<front>; R-WAR-008, #2478): under exact gdd-0.3 it also comes while Armistice.MayOfferEarly holds for+ /// that front, before its hard-anchor date and again after a refusal, and then takes the first soft slot (R-EVT-002).+ /// Empty for every other event.</summary>+ public string FrontQuiet { get; set; } = "";/// <summary>The place among the same turn's cards of the same `from` (R-EVT-006): a lower order comes first, before/// the id decides. Default 0; degania_defence has 1, so One Army opens the game (owner, 24 October 2026, #1568).</summary>public int Order { get; set; }diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex f55b1255d..5a03bbcbc 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -427,6 +427,8 @@ namespace Statecraft.Sim// deported a settlement target whose Deport the card follows: it fires only once the// player's Deport has depopulated that place, carries the displacement tag and// has exactly one option (R-EVT-007)+ // front_quiet the front (Prisoners.Fronts) of an armistice_<front> card: under gdd-0.3 it may also+ // come early, and again after a refusal, once that front is quiet (R-WAR-008)foreach (var rel in eventFiles.OrderBy(p => p, StringComparer.Ordinal)){var e = Read<GameEvent>(readFile, rel);@@ -1554,6 +1556,7 @@ namespace Statecraft.SimValidateObjectiveConditions(c);ValidateEventSites(c);ValidateEventPrisoners(c);+ ValidateEventFrontQuiet(c);ValidateEventDeported(c);ValidateProjects(c);ValidateCorridors(c);@@ -1571,6 +1574,19 @@ namespace Statecraft.Sim}}+ /// <summary>An armistice card's front (R-WAR-008): a known front, on that front's own card, since Armistice.Resolved+ /// reads the refused front from the id (R-WAR-006).</summary>+ static void ValidateEventFrontQuiet(Content c)+ {+ foreach (var e in c.Events.Where(e => e.FrontQuiet != ""))+ {+ if (!Prisoners.Fronts.Contains(e.FrontQuiet))+ throw new ContentException(e.File, $"events[{e.Id}].front_quiet", $"unknown front '{e.FrontQuiet}' (one of {string.Join(", ", Prisoners.Fronts)})");+ if (e.Id != "armistice_" + e.FrontQuiet)+ throw new ContentException(e.File, $"events[{e.Id}].front_quiet", $"'{e.FrontQuiet}' goes only on its own card, armistice_{e.FrontQuiet}");+ }+ }+/// <summary>A Deport follow-up card (R-EVT-007; GDD Phase 6 PR 9, #801): a settlement target whose residents stayed,/// since Deport is refused where they fled (R-CTRL-018) and the card could never fire; the displacement tag, so the/// release gate holds it until the owner's review (R-GATE-001); one option, which Delegate resolves without a draw; no `to`,diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex 685b76285..f35bdd22f 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -15,7 +15,7 @@ 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,- /// which fill the slots that remain (max(0, cap - hard count)) in the usual order (consequence cards first, R-ALT-008, then From, objective cards last in objectives.yaml's order, R-OBJ-007, then id). The fired+ /// 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). The fired/// events keep the usual order./// Late fire: an event whose window overlapped the turn just played can fire after its window has ended; its/// conditions are evaluated at the end of the turn, and its text is filled at the last in-window day@@ -24,8 +24,12 @@ namespace Statecraft.Sim{PopulationLedger.RefuseAggregate(s);var start = turnStart ?? s.Date;+ // R-WAR-008 (#2478): under gdd-0.3 an armistice card also comes while its own front may have an early offer+ // (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));var eligible = c.Events- .Where(e => !s.FiredEvents.Contains(e.Id) && e.From <= s.Date && (e.To == null || start < e.To.Value))+ .Where(e => (quiet.Contains(e.Id) || !s.FiredEvents.Contains(e.Id) && e.From <= s.Date) && (e.To == null || start < e.To.Value)).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..Where(e => e.Objective == "" || s.Objectives.ContainsKey(e.Objective))@@ -45,14 +49,16 @@ namespace Statecraft.Sim// key is the same for every event, and (From, id) is a total order (ids are unique), so the order is as before.// R-OBJ-007 (Q-CARD-2): objective cards of the same From come after that From's other events, in objectives.yaml's order.// R-EVT-006: then an event's `order` (default 0), then the id, so with every order 0 the order is as before.- .OrderBy(e => e.Kind == EventKinds.Consequence ? 0 : 1).ThenBy(e => e.From)+ // R-EVT-002 (Q-EVT-1, Q-OBJ-1): an early armistice comes before even the consequence cards; with none, as before.+ .OrderBy(e => quiet.Contains(e.Id) ? 0 : e.Kind == EventKinds.Consequence ? 1 : 2).ThenBy(e => e.From).ThenBy(e => e.Objective == "" ? -1 : c.Objectives.FindIndex(o => o.Id == e.Objective)).ThenBy(e => e.Order).ThenBy(e => e.Id, StringComparer.Ordinal).ToList();// R-EVT-007: a Deport card takes no soft slot, so it fires on its Deport's turn however full that turn is.- var hardCount = eligible.Count(e => e.Anchor == "hard");- var chosen = new HashSet<string>(eligible.Where(e => e.Anchor == "hard" || e.Deported != "")- .Concat(eligible.Where(e => e.Anchor != "hard" && e.Deported == "").Take(Math.Max(0, MaxSoftEventsPerTurn - hardCount))).Select(e => e.Id));+ bool Hard(GameEvent e) => e.Anchor == "hard" && !quiet.Contains(e.Id);+ var hardCount = eligible.Count(Hard);+ var chosen = new HashSet<string>(eligible.Where(e => Hard(e) || e.Deported != "")+ .Concat(eligible.Where(e => !Hard(e) && e.Deported == "").Take(Math.Max(0, MaxSoftEventsPerTurn - hardCount))).Select(e => e.Id));foreach (var e in eligible.Where(e => chosen.Contains(e.Id))){s.FiredEvents.Add(e.Id);