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.

Sim: per-front armistice quiet turns and unit removal under GDD 0.3 (Refs #1709 slice A) (#2318)

Beri1c131281dca0
diff --git a/changelog.d/1709-armistice-quiet-turns.md b/changelog.d/1709-armistice-quiet-turns.md
new file mode 100644
index 000000000..9a4ada5d2
--- /dev/null
+++ b/changelog.d/1709-armistice-quiet-turns.md
@@ -0,0 +1,7 @@
+### Added
+
+- Under the gdd-0.3 ruleset only, the sim counts each front's quiet turns for the early armistices (Refs #1709): a turn
+ with no engagement involving Egypt's, Jordan's (with Iraq's), Lebanon's or Syria's units adds one to that front, an
+ engagement sets it back to zero, and refusing a front's armistice starts it again. From the 15 December 1948 turn, two
+ quiet turns make a front eligible for an early offer; the offer card itself comes later. Signing a front's armistice now
+ takes that front's units off the board. The current game (gdd-0.1) is unchanged.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 6445c1697..4dc54044a 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -376,6 +376,12 @@ 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-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.
+
## Prisoners
Phase 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.
diff --git a/sim/Statecraft.Sim.Tests/Gdd03ArmisticeQuietTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeQuietTests.cs
new file mode 100644
index 000000000..6355ffb3b
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/Gdd03ArmisticeQuietTests.cs
@@ -0,0 +1,258 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>#1709 slice A, R-WAR-005 to R-WAR-007 under exact gdd-0.3: each front's count of quiet turns, the early offer's
+/// eligibility and the removal of a front's units when its armistice is signed. The rulings: docs/gdd/military-combat.md:69
+/// ("A quiet turn has no engagement involving that front's units, whoever attacked; a mixed-front engagement breaks the count
+/// for every front in it, and a refused order does not break it. Two full quiet turns must follow a refusal", owner, 1 November
+/// 2026, Q48 and Q49), the owner's 27 October 2026 ruling on #1709 ("The first offer can come on the 15 December 1948 turn,
+/// not earlier") and Q-OBJ-4 ("On a front's armistice, that front's units leave the board"). Gdd03MovementFortTests' board
+/// and the real catalogue (military.armistice_quiet_turns 2); the fixture's combat table agrees on both faces.</summary>
+public class Gdd03ArmisticeQuietTests
+{
+ // A hard armistice card with the real cards' two options (content/events/armistice_jordan.yaml). It is dated long after
+ // the turns these tests play, so it is pending only where a test puts it there: left unanswered, it would resolve by itself.
+ const string JordanCard = @"
+id: armistice_jordan
+title: Armistice with Jordan
+text: '{prime_minister} must decide whether Israel signs.'
+office: prime_minister
+anchor: hard
+from: 1950-01-01
+options:
+ - id: sign
+ text: Sign the armistice
+ historical: true
+ - id: hold_out
+ text: Refuse and keep fighting
+ alternative: { basis: design }
+";
+
+ static Content Load(string ruleset = SaveGame.Gdd03Ruleset)
+ {
+ var f = Gdd03MovementFortTests.Files(ruleset);
+ f["events/armistice_jordan.yaml"] = JordanCard;
+ return ContentLoader.Load(Fixture.Write(f));
+ }
+
+ // The enemy is weaker than the player's 20 everywhere, so the enemy script holds and only the player's orders engage.
+ static Unit Ours(int id, int q, int r, int strength = 6) => new Unit(id, "recruit", q, r, side: "israel", strength: strength);
+ static Unit Theirs(int id, int q, int r, string side, int strength = 6) => new Unit(id, "enemy", q, r, side: side, strength: strength);
+
+ static GameState With(Content c, params Unit[] units) => CombatTests.With(c, units);
+
+ static GameState Turn(Content c, GameState s, params Command[] orders)
+ {
+ var r = Simulation.Step(c, s, orders);
+ Assert.Empty(r.Rejected);
+ return r.State;
+ }
+
+ static int[] Counts(GameState s) => Prisoners.Fronts.Select(f => Armistice.QuietTurns(s, f)).ToArray(); // egypt, jordan, lebanon, syria
+
+ // R-WAR-005, Q48: the count runs per front from the scenario start (turns long before 16 November 1948 included): a turn
+ // with no engagement adds 1 to each of the four fronts.
+ [Fact]
+ public void AQuietTurnCountsForEveryFrontWithNoEngagement()
+ {
+ var c = Load();
+ var s = With(c, Ours(1, 0, 1), Theirs(2, 5, 1, "egypt"));
+ Assert.Equal(new[] { 0, 0, 0, 0 }, Counts(s));
+ s = Turn(c, s);
+ Assert.Equal(new[] { 1, 1, 1, 1 }, Counts(s));
+ s = Turn(c, s);
+ Assert.Equal(new[] { 2, 2, 2, 2 }, Counts(s));
+ }
+
+ // R-WAR-005, Q48: an engagement with an Egyptian unit resets Egypt only; an Iraqi unit resets Jordan (the Jordan agreement
+ // took over the Iraqi sector); an ALA or local unit belongs to no front and resets none.
+ [Theory]
+ [InlineData("egypt", new[] { 0, 2, 2, 2 })]
+ [InlineData("iraq", new[] { 2, 0, 2, 2 })]
+ [InlineData("ala", new[] { 2, 2, 2, 2 })]
+ [InlineData("local", new[] { 2, 2, 2, 2 })]
+ public void AnEngagementResetsOnlyItsOwnFront(string side, int[] after)
+ {
+ var c = Load();
+ var s = Turn(c, With(c, Ours(1, 2, 1, 20), Theirs(2, 3, 1, side)));
+ Assert.Equal(new[] { 1, 1, 1, 1 }, Counts(s));
+ s = Turn(c, s, new UnitOrder(1, Combat.Attack, 3, 1));
+ Assert.Equal(after, Counts(s));
+ }
+
+ // R-WAR-005, Q48: an engagement with an Egyptian and a Jordanian defender breaks the count of both fronts.
+ [Fact]
+ public void AMixedFrontEngagementResetsEveryFrontInIt()
+ {
+ var c = Load();
+ var s = Turn(c, With(c, Ours(1, 2, 1, 20), Theirs(2, 3, 1, "egypt"), Theirs(3, 3, 1, "jordan")));
+ s = Turn(c, s, new UnitOrder(1, Combat.Attack, 3, 1));
+ Assert.Equal(new[] { 0, 0, 2, 2 }, Counts(s));
+ }
+
+ // R-WAR-005, Q48: a refused order breaks nothing (a truce's refusal, R-COMBAT-009, or an attack on an empty hex). An
+ // engagement counts whoever attacked: the player's instant attack in planning and the enemy's attack in step 2 alike.
+ [Fact]
+ public void ARefusedOrderDoesNotBreakTheCount()
+ {
+ var c = Load();
+ var s = Turn(c, With(c, Ours(1, 2, 1, 20), Theirs(2, 3, 1, "egypt")));
+ s.ChosenOptions["first_truce"] = "accept"; // the first truce in force until 8 July 1948
+ var refused = Simulation.Step(c, s, new Command[] { new UnitOrder(1, Combat.Attack, 3, 1), new UnitOrder(1, Combat.Attack, 1, 1) });
+ Assert.Equal(2, refused.Rejected.Count);
+ Assert.Equal(new[] { 2, 2, 2, 2 }, Counts(refused.State));
+
+ var t = With(c, Ours(1, 2, 1), Theirs(2, 3, 1, "syria"));
+ var why = new List<Cause>();
+ Assert.Null(Combat.Give(c, t, 2, 2, 1, why, enemy: true));
+ Combat.Resolve(c, t, why);
+ Assert.Contains(why, w => w.Key == WhyKeys.Engagement);
+ Assert.Equal(new[] { "syria" }, t.EngagedFronts.ToArray());
+ }
+
+ // R-WAR-005 (owner, 27 October 2026; Q48): no early offer before the 15 December 1948 turn; there, two quiet turns open
+ // one and one does not. A signed front gets no offer.
+ [Fact]
+ public void NoOfferBeforeTheFifteenthOfDecemberTurnAndTwoQuietTurnsOpenOne()
+ {
+ var c = Load();
+ var s = With(c);
+ s.QuietTurns["egypt"] = 2;
+ s.Date = new DateTime(1948, 11, 15);
+ Assert.False(Armistice.MayOfferEarly(c, s, "egypt"));
+ s.Date = new DateTime(1948, 12, 15);
+ Assert.True(Armistice.MayOfferEarly(c, s, "egypt"));
+ s.QuietTurns["egypt"] = 1;
+ Assert.False(Armistice.MayOfferEarly(c, s, "egypt"));
+ s.QuietTurns["egypt"] = 2;
+ s.ChosenOptions["armistice_egypt"] = "sign";
+ Assert.False(Armistice.MayOfferEarly(c, s, "egypt"));
+ }
+
+ // R-WAR-006, Q49 ("Does the refusal turn count toward the next quiet period? No. Two full quiet turns must follow the
+ // refusal.", owner, 1 November 2026; #1709 open question 4: the refusal is the hard card's hold_out): a refusal on turn T
+ // ends T at 0 for its front, T+1 and T+2 quiet make it eligible on T+3; other fronts keep counting.
+ [Fact]
+ public void HoldOutResetsTheCountAndTwoNewQuietTurnsAreNeeded()
+ {
+ var c = Load();
+ var s = With(c, Ours(1, 0, 1));
+ s.Date = new DateTime(1948, 12, 15);
+ s.QuietTurns["jordan"] = 5; s.QuietTurns["egypt"] = 5;
+ Assert.True(Armistice.MayOfferEarly(c, s, "jordan"));
+ s.PendingEvents.Add("armistice_jordan");
+ s = Turn(c, s, new ChooseEventOption("armistice_jordan", "hold_out"));
+ Assert.Equal((0, 6), (Armistice.QuietTurns(s, "jordan"), Armistice.QuietTurns(s, "egypt")));
+ Assert.False(Armistice.MayOfferEarly(c, s, "jordan"));
+ s = Turn(c, s);
+ Assert.Equal(1, Armistice.QuietTurns(s, "jordan"));
+ Assert.False(Armistice.MayOfferEarly(c, s, "jordan"));
+ s = Turn(c, s);
+ Assert.True(Armistice.MayOfferEarly(c, s, "jordan"));
+ }
+
+ // R-WAR-005, replay: saves are command logs, so the fronts engaged in the open turn are rebuilt by replaying its orders: an
+ // open turn after an instant attack replays to the same state and hash, and End turn from the same log counts the same.
+ [Fact]
+ public void AnOpenTurnAfterAnInstantAttackReplaysToTheSameCount()
+ {
+ var c = Load();
+ var s = Turn(c, With(c, Ours(1, 2, 1, 20), Theirs(2, 3, 1, "lebanon")));
+ var log = new Command[] { new UnitOrder(1, Combat.Attack, 3, 1) };
+ var open = Simulation.Preview(c, s, log).State;
+ Assert.Equal(new[] { "lebanon" }, open.EngagedFronts.ToArray());
+ Assert.Equal(open.Hash(), Simulation.Preview(c, s.Clone(), log).State.Hash());
+ Assert.Equal(open.Hash(), open.Clone().Hash());
+ var ended = Turn(c, s, log);
+ Assert.Equal(new[] { 2, 2, 0, 2 }, Counts(ended));
+ Assert.Empty(ended.EngagedFronts);
+ }
+
+ // R-WAR-005, R-SAVE-003, plan test 6: a save and reload between an instant attack and End turn, through a real schema-4
+ // save of the real content, rebuilds the fronts engaged in the open turn and gives the same hash, and End turn from both
+ // gives the same counts and hash (the pattern of NoShotArmsSessionTests).
+ [Fact]
+ public void ASaveAndLoadBetweenAnInstantAttackAndEndTurnGivesTheSameCountAndHash()
+ {
+ var root = RealContentTests.ContentRoot();
+ var c = ContentLoader.Load(rel =>
+ {
+ var path = Path.Combine(root, rel);
+ if (!File.Exists(path)) return null;
+ var text = File.ReadAllText(path);
+ return rel == "eras.yaml" ? text.Replace("loop: gdd", "loop: gdd, ruleset: gdd-0.3") : text;
+ }, Directory.GetFiles(Path.Combine(root, "events"), "*.yaml").Select(p => "events/" + Path.GetFileName(p)));
+
+ var game = GameSession.New(c, GoldenRun.Seed, Mode.Historical);
+ var attack = (from u in game.Now.State.Units.Values.Where(u => u.Side == Movement.PlayerSide)
+ from e in game.Now.State.Units.Values.Where(e => Prisoners.FrontOf.ContainsKey(e.Side))
+ where Combat.Check(c, game.Now.State, u.Id, e.Q, e.R) == null
+ select new UnitOrder(u.Id, Combat.Attack, e.Q, e.R)).First();
+ Assert.Null(game.Commit(attack));
+ var engaged = game.Now.State.EngagedFronts.ToArray();
+ Assert.NotEmpty(engaged);
+
+ var text = game.Save.Write();
+ Assert.StartsWith("statecraft-save 4", text);
+ var replay = GameSession.Load(c, text, out _);
+ Assert.Equal(game.Now.State.EngagedFronts.ToArray(), replay.Now.State.EngagedFronts.ToArray());
+ Assert.Equal(game.Now.State.Hash(), replay.Now.State.Hash());
+
+ var ended = game.EndTurn(Array.Empty<Command>());
+ var replayEnd = replay.EndTurn(Array.Empty<Command>());
+ Assert.Equal(Counts(ended.State), Counts(replayEnd.State));
+ Assert.All(engaged, f => Assert.Equal(0, Armistice.QuietTurns(ended.State, f)));
+ Assert.Equal(ended.State.Hash(), replayEnd.State.Hash());
+ }
+
+ // R-WAR-005 to R-WAR-007 are gdd-0.3 only: under gdd-0.1 no count is kept or hashed and signing removes nothing (#752
+ // owns R-WAR-007 there). The pinned goldens are the GoldenRun tests' job and stay as they are.
+ [Fact]
+ public void Gdd01IsUnchanged()
+ {
+ var c = Load(SaveGame.GddRuleset);
+ var s = With(c, Ours(1, 2, 1, 20), Theirs(2, 3, 1, "jordan"), Theirs(3, 5, 0, "jordan"));
+ s.PendingEvents.Add("armistice_jordan");
+ s = Turn(c, s, new UnitOrder(1, Combat.Attack, 3, 1), new ChooseEventOption("armistice_jordan", "sign"));
+ Assert.Empty(s.QuietTurns);
+ Assert.Empty(s.EngagedFronts);
+ Assert.True(s.Units.ContainsKey(3));
+ Assert.DoesNotContain("\nquiet{", s.Describe());
+ Assert.DoesNotContain("\nengaged[", s.Describe());
+ }
+
+ // R-WAR-007, Q-OBJ-4: signing armistice_jordan removes the Jordanian and the Iraqi units, leaves the Egyptian, ALA and
+ // local units and the prisoners held as they were. Send home after signing is covered by
+ // SendHomeAfterSigningLooksAtTheFrontsStillOnTheBoard.
+ [Fact]
+ public void SigningRemovesThatFrontsUnitsOnly()
+ {
+ var c = Load();
+ var s = With(c, Ours(1, 2, 1), Theirs(2, 3, 1, "jordan"), Theirs(3, 2, 2, "iraq"), Theirs(4, 5, 0, "egypt"),
+ Theirs(5, 5, 2, "ala"), Theirs(6, 0, 0, "local"));
+ s.PrisonersHeld["jordan"] = 3; s.SoldiersHeld["iraq"] = 1;
+ s.PendingEvents.Add("armistice_jordan");
+ var why = new List<Cause>();
+ Assert.Null(EventSystem.Choose(c, s, "armistice_jordan", "sign", why));
+ Assert.Equal(new[] { 1, 4, 5, 6 }, s.Units.Keys.ToArray());
+ Assert.Equal((3, 1), (s.PrisonersHeld["jordan"], s.SoldiersHeld["iraq"]));
+ }
+
+ // R-WAR-007 with R-UNIT-005 unchanged: unit 1 borders Jordan's unit 2 and Egypt's unit 3, so its front is the lower id's,
+ // Jordan. Once Jordan's units leave on signing, the unit's nearest front-bearing enemy is Egypt's, and Send home waits for
+ // that armistice. Without the removal the front would still be Jordan, signed, and Send home would be open.
+ [Fact]
+ public void SendHomeAfterSigningLooksAtTheFrontsStillOnTheBoard()
+ {
+ var c = Load();
+ var s = With(c, Ours(1, 2, 1), Theirs(2, 3, 1, "jordan"), Theirs(3, 1, 1, "egypt"));
+ Assert.Equal("The armistice with Jordan is not signed", Demobilization.Check(c, s, 1));
+ s.PendingEvents.Add("armistice_jordan");
+ Assert.Null(EventSystem.Choose(c, s, "armistice_jordan", "sign", new List<Cause>()));
+ Assert.Equal(new[] { 1, 3 }, s.Units.Keys.ToArray());
+ Assert.Equal("The armistice with Egypt is not signed", Demobilization.Check(c, s, 1));
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/NoAttentionTests.cs b/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
index 28787a121..65ac66b60 100644
--- a/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
+++ b/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
@@ -18,8 +18,9 @@ public class NoAttentionTests
{
foreach (var r in c.EraRules.Values.Append(c.Rules)) { r.AttentionCost.Clear(); r.AttentionPerTurn=double.NaN; r.RungAttentionStep=double.NaN; }
}
+ // R-WAR-005 (#1709): gdd-0.3's quiet-turn counts and the turn's engaged fronts are taken out with the ledger.
internal static string WithoutLegacyAccounting(string canonical) =>
- Regex.Replace(Regex.Replace(canonical, @"\npopulation-ledger\{(?:\n [^\n]*)*", "").Replace("ruleset=gdd-0.3;", ""), @"\natt=[^\n]*", "");
+ Regex.Replace(Regex.Replace(canonical, @"\n(?:population-ledger|quiet)\{(?:\n [^\n]*)*|\nengaged\[(?:\n [^\n]*)*", "").Replace("ruleset=gdd-0.3;", ""), @"\natt=[^\n]*", "");
static bool Unavailable(string kind) => kind is "map_action" or "set_mobilization" or "security_order";
static (Content c,GameState s,Command valid,Command invalid) Case(string kind,bool modern)
{
diff --git a/sim/Statecraft.Sim.Tests/NoShotArmsTests.cs b/sim/Statecraft.Sim.Tests/NoShotArmsTests.cs
index b15b37e64..2b8f13eee 100644
--- a/sim/Statecraft.Sim.Tests/NoShotArmsTests.cs
+++ b/sim/Statecraft.Sim.Tests/NoShotArmsTests.cs
@@ -204,7 +204,7 @@ public class NoShotArmsTests
var normalized = y.State.Clone();
normalized.Arms = x.State.Arms;
- static string Core(string text) => Regex.Replace(Regex.Replace(text, @"\npopulation-ledger\{(?:\n [^\n]*)*", "").Replace("ruleset=gdd-0.3;", ""), @"\natt=[^\n]*", "");
+ static string Core(string text) => NoAttentionTests.WithoutLegacyAccounting(text);
// R-UNIT-011 (#1707): gdd-0.3 also counts the survivors' combat experience; the losses, hexes and draw stay the same.
Assert.Contains("|xp=1", normalized.Describe());
Assert.Equal(Core(x.State.Describe()), Regex.Replace(Core(normalized.Describe()), @"\|xp=\d+", ""));
diff --git a/sim/Statecraft.Sim/Armistice.cs b/sim/Statecraft.Sim/Armistice.cs
new file mode 100644
index 000000000..dde9ba73f
--- /dev/null
+++ b/sim/Statecraft.Sim/Armistice.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Statecraft.Sim
+{
+ /// <summary>#1709 slice A, docs/rules/mvp.md R-WAR-005 to R-WAR-007, under exact gdd-0.3 only (gdd-0.1's removal is #752's):
+ /// each front's quiet-turn count, whether a front may get an early armistice offer, and what signing does to that front's
+ /// units. The fronts and the sides on them are Prisoners.FrontOf's (Iraq under Jordan; the ALA and local forces on none).
+ /// The early offer card itself is slice B. Draws nothing.</summary>
+ internal static class Armistice
+ {
+ /// <summary>The owner's ruling on #1709 (27 October 2026, "15 December turn (Recommended)"): "The first offer can come on
+ /// the 15 December 1948 turn, not earlier."</summary>
+ internal static readonly DateTime EarliestOffer = new DateTime(1948, 12, 15);
+
+ /// <summary>R-WAR-005: the front's consecutive quiet turns; 0 before the first turn end and under every other ruleset.</summary>
+ internal static int QuietTurns(GameState s, string front) => s.QuietTurns.TryGetValue(front, out var n) ? n : 0;
+
+ /// <summary>R-WAR-005, R-WAR-006: an early offer is eligible for an unsigned front from the 15 December 1948 turn once it
+ /// has been quiet for military.armistice_quiet_turns turns, counted again from 0 after a refusal.</summary>
+ internal static bool MayOfferEarly(Content c, GameState s, string front) =>
+ Gdd03Military.Applies(c) && s.Date >= EarliestOffer && !Demobilization.Signed(s, front)
+ && QuietTurns(s, front) >= Gdd03Military.Scalar(c, "military.armistice_quiet_turns");
+
+ /// <summary>R-WAR-005 (Q48): an engagement breaks the count of every front with a unit in it, whoever attacked. Called by
+ /// Combat.Engage, so a refused order, which never engages, breaks nothing.</summary>
+ internal static void Engaged(Content c, GameState s, IEnumerable<Unit> units)
+ {
+ if (!Gdd03Military.Applies(c)) return;
+ foreach (var u in units)
+ if (Prisoners.FrontOf.TryGetValue(u.Side, out var front)) s.EngagedFronts.Add(front);
+ }
+
+ /// <summary>R-WAR-005 (Q48), at the turn's end: each front not engaged this turn gains a quiet turn, each engaged front
+ /// goes back to 0, and the turn's engagements are forgotten.</summary>
+ internal static void CountQuietTurns(Content c, GameState s)
+ {
+ if (!Gdd03Military.Applies(c)) return;
+ foreach (var front in Prisoners.Fronts)
+ s.QuietTurns[front] = s.EngagedFronts.Contains(front) ? 0 : QuietTurns(s, front) + 1;
+ s.EngagedFronts.Clear();
+ }
+
+ /// <summary>R-WAR-006, R-WAR-007: the armistice card of a front (content/events/armistice_&lt;front&gt;.yaml) resolved.
+ /// hold_out is the refusal (Q49: its front counts again from 0 after the refusal's own turn, #1709 open question 4); sign removes the front's units.
+ /// Gated here on the ruleset, so #752 can open the removal to gdd-0.1 by calling <see cref="RemoveFront"/>.</summary>
+ internal static void Resolved(Content c, GameState s, string eventId, string optionId)
+ {
+ if (!Gdd03Military.Applies(c) || !eventId.StartsWith("armistice_", StringComparison.Ordinal)) return;
+ var front = eventId.Substring("armistice_".Length);
+ if (!Prisoners.Fronts.Contains(front)) return;
+ if (optionId == "hold_out")
+ {
+ // Q49 (owner, 1 November 2026): "Does the refusal turn count toward the next quiet period? No. Two full quiet
+ // turns must follow the refusal." The card is answered before its turn resolves, so the front is also marked
+ // as broken for this turn: CountQuietTurns ends the turn at 0 and T+1, T+2 quiet make it eligible on T+3.
+ s.QuietTurns[front] = 0;
+ s.EngagedFronts.Add(front);
+ }
+ else if (optionId == "sign") RemoveFront(s, front);
+ }
+
+ /// <summary>R-WAR-007 (Q-OBJ-4): on a front's armistice its units leave the board. Prisoners held and the player's
+ /// soldiers held stay as they are: the exchange cards return them (R-POW-004). Checks no ruleset.</summary>
+ internal static void RemoveFront(GameState s, string front)
+ {
+ foreach (var id in s.Units.Values.Where(u => Prisoners.FrontOf.TryGetValue(u.Side, out var f) && f == front).Select(u => u.Id).ToList())
+ s.Units.Remove(id);
+ }
+ }
+}
diff --git a/sim/Statecraft.Sim/Combat.cs b/sim/Statecraft.Sim/Combat.cs
index d8cf26d21..7e7d6f591 100644
--- a/sim/Statecraft.Sim/Combat.cs
+++ b/sim/Statecraft.Sim/Combat.cs
@@ -281,11 +281,13 @@ namespace Statecraft.Sim
}
/// <summary>One engagement (<see cref="Fight"/>), then, under exact gdd-0.3, its survivors' combat experience
- /// (R-UNIT-011). Every engagement, the player's instant attack and step 2's alike, runs through here.</summary>
+ /// (R-UNIT-011) and its fronts' quiet-turn counts broken (R-WAR-005). Every engagement, the player's instant attack and
+ /// step 2's alike, runs through here.</summary>
static void Engage(Content c, GameState s, MvpRules mvp, List<Unit> attackers, List<Unit> defenders, int q, int r, List<Cause> why)
{
Fight(c, s, mvp, attackers, defenders, q, r, why);
if (Gdd03Military.Applies(c)) Experience(c, s, attackers, defenders, why);
+ Armistice.Engaged(c, s, attackers.Concat(defenders)); // R-WAR-005: gdd-0.3 only
}
/// <summary>R-UNIT-011 (owner, 1 November 2026, #1668 Q14 to Q16): after the engagement's one draw, its losses, retreats
diff --git a/sim/Statecraft.Sim/Demobilization.cs b/sim/Statecraft.Sim/Demobilization.cs
index 72c660f80..f46a12355 100644
--- a/sim/Statecraft.Sim/Demobilization.cs
+++ b/sim/Statecraft.Sim/Demobilization.cs
@@ -15,7 +15,7 @@ namespace Statecraft.Sim
/// <summary>The armistice event that signs each front (content/events/armistice_<front>.yaml); the sign option is
/// `sign` in all four.</summary>
- static bool Signed(GameState s, string front) =>
+ internal static bool Signed(GameState s, string front) =>
s.ChosenOptions.TryGetValue("armistice_" + front, out var o) && o == "sign";
/// <summary>The front <paramref name="u"/> fights on (owner, 22 October 2026, #1309): of the enemy units it attacked
diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.cs
index 4b301a8fc..e15b6f06e 100644
--- a/sim/Statecraft.Sim/EventSystem.cs
+++ b/sim/Statecraft.Sim/EventSystem.cs
@@ -203,6 +203,7 @@ namespace Statecraft.Sim
if (o.SetRung.HasValue) SecuritySystem.SetRung(c, s, o.SetRung.Value, why);
// R-POW-004: an exchange card returns its front's prisoners, whichever way it was resolved (it has one option).
if (Get(c, eventId).Prisoners is var front && front != "") Prisoners.Return(c, s, front, why);
+ Armistice.Resolved(c, s, eventId, o.Id); // R-WAR-006, R-WAR-007: gdd-0.3 only
}
/// <summary>A late-fired event can be resolved after a dated record's window has ended (chapters design 3.2): an
diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.cs
index 90554946f..b98cef628 100644
--- a/sim/Statecraft.Sim/GameState.cs
+++ b/sim/Statecraft.Sim/GameState.cs
@@ -143,6 +143,11 @@ namespace Statecraft.Sim
public SortedDictionary<string, int> PrisonersReturned = new SortedDictionary<string, int>(StringComparer.Ordinal);
/// <summary>The player's soldiers held by the enemy, in population units, by the side that took them (R-POW-005; Q-POW-4).</summary>
public SortedDictionary<string, int> SoldiersHeld = new SortedDictionary<string, int>(StringComparer.Ordinal);
+ /// <summary>R-WAR-005, under exact gdd-0.3 only: each front's consecutive quiet turns (Q48), set at every turn end;
+ /// R-WAR-006 sets a front to 0 on a refused armistice. Empty under every other ruleset.</summary>
+ public SortedDictionary<string, int> QuietTurns = new SortedDictionary<string, int>(StringComparer.Ordinal);
+ /// <summary>R-WAR-005: the fronts with a unit in an engagement this turn, instant attacks included, and a front whose armistice was refused this turn (R-WAR-006, Q49); cleared at the turn end.</summary>
+ public SortedSet<string> EngagedFronts = new SortedSet<string>(StringComparer.Ordinal);
/// <summary>The places the player has deported, the permanent record of R-CTRL-018 and R-CTRL-019: a count of places,
/// not people (Q-CAP-2 (b)), with no destination on the board (Q-DEP-3 (a)).</summary>
public int DisplacedByPlayer;
@@ -183,6 +188,8 @@ namespace Statecraft.Sim
c.PrisonersHeld = new SortedDictionary<string, int>(PrisonersHeld, StringComparer.Ordinal);
c.PrisonersReturned = new SortedDictionary<string, int>(PrisonersReturned, StringComparer.Ordinal);
c.SoldiersHeld = new SortedDictionary<string, int>(SoldiersHeld, StringComparer.Ordinal);
+ c.QuietTurns = new SortedDictionary<string, int>(QuietTurns, StringComparer.Ordinal);
+ c.EngagedFronts = new SortedSet<string>(EngagedFronts, StringComparer.Ordinal);
return c;
}
@@ -304,6 +311,9 @@ namespace Statecraft.Sim
if (PrisonersHeld.Count > 0) Section("pow", '{', '}', Counts(PrisonersHeld));
if (PrisonersReturned.Count > 0) Section("powret", '{', '}', Counts(PrisonersReturned));
if (SoldiersHeld.Count > 0) Section("ownheld", '{', '}', Counts(SoldiersHeld));
+ // R-WAR-005: gdd-0.3 only, so every other ruleset hashes as before.
+ if (QuietTurns.Count > 0) Section("quiet", '{', '}', Counts(QuietTurns));
+ if (EngagedFronts.Count > 0) Section("engaged", '[', ']', EngagedFronts);
if (DisplacedByPlayer != 0) { Sep(); Nl(); sb.Append("displaced=").Append(DisplacedByPlayer.ToString(CultureInfo.InvariantCulture)); } // R-CTRL-019: only after a Deport
if (UsesPopulationLedger) Section("population-ledger", '{', '}', PopulationLedger.Canonical());
if (UsesPopulationLedger && playerRegions.Count > 0)
diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.cs
index 06f027e62..995c73dcf 100644
--- a/sim/Statecraft.Sim/TurnResolver.cs
+++ b/sim/Statecraft.Sim/TurnResolver.cs
@@ -41,6 +41,7 @@ namespace Statecraft.Sim
Objectives.Complete(c, s, r, next, why); // 11. objectives and score
Defeat(s, r, why); // then the economic defeat (D-B5, R-END-002)
WarLoss(c, s, why); // and the war loss (R-END-003)
+ Armistice.CountQuietTurns(c, s); // 12. each front's quiet turns, a refusal's turn not quiet, gdd-0.3 only (R-WAR-005, R-WAR-006)
}
/// <summary>R-END-001, R-END-002: counts the turn ends with Money (the debt at or above mvp.debt_ceiling) and Food (an