A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Sim: one city start a turn in the GDD 0.3 project fixture (Refs #1700) (#2257)
Beri0e7bbcdca78d
diff --git a/changelog.d/1700-start-allowance.md b/changelog.d/1700-start-allowance.mdnew file mode 100644index 000000000..f81b2f65b--- /dev/null+++ b/changelog.d/1700-start-allowance.md@@ -0,0 +1,3 @@+- GDD 0.3 groundwork, not yet in the game (#1700): one new city project a turn, nationwide, in the synthetic project+ rules. A second start in the same turn is refused before any Money is paid, and projects already being built carry+ on. The game keeps its current project limit.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 3201a5839..451af1638 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -156,7 +156,7 @@ R-PROJ-004: In the GDD loop a map action (`map_action`, the legacy transit campR-PROJ-005: A specialised project is allowed only in a city that has its resource (D-D8: "A winery requires areas for grapes"; Phase 3 PR 6, #737). A `projects.yaml` kind may name a `requires:` resource; a `cities.yaml` city lists its `resources:`, each with an id and sources (a url and a checked date each), and may say what the sources leave open (`to_verify`). `StartProject` of such a kind in a city without the resource is refused like the other R-PROJ-001 refusals, before the hex checks; a city founded in play has no resources. The loader refuses a resource without sources and a kind whose resource no city has. Otherwise the kind is an ordinary city project (R-PROJ-003). The one such kind is the winery, which needs vineyards, in Rishon LeZion with its vineyards flagged `to_verify` (owner, 20 October 2026, on #737, as GDD v0.2 says; this replaces the 18 October default of Zikhron Ya'akov, which has no winery).-For R-PROJ-001 and R-PROJ-003, the preceding rules and the IL 0m upkeep of R-MONEY-002 remain unchanged in the game. The inactive gdd-0.3 addition is `Gdd03ProjectBuildFixture`, synthetic builder rules over the #1963 project catalogue (#1700; no command, save, loader, resolver or UI caller). A start pays the kind's full catalogue cost up front; when Money is short the start goes ahead and the shortfall is borrowed as R-MONEY-003 says, Money stopping at 0 and the rest moving to the fixture's debt (owner, 1 November 2026, D1: "Approve all six (Recommended)"). The record holds work done, not turns left. Each turn only assigned builders add work, at the catalogue's ordinary-or-novice, apprentice or expert rate (1, 1.5, 3), at most `builder.slots_per_project` (3) on one project; a project with no builders makes no progress. Money is not an input to progress, so extra Money never changes the completion turn (Amir, 28 October 2026, recorded on #1668: "Extra Money cannot replace work or speed completion. Housing and improvements also require Money for upkeep."). Work past the kind's `work` is discarded and the project completes that turn; builders are then released, and an order to a completed project is refused. From the completion turn on, every turn, a completed project is charged R-MONEY-002's MVP rate, IL 0m, vacant or not, so Money does not change; the catalogue's non-zero `upkeep` is post-MVP and unused (owner's 30 October 2026 "Keep ruling" on UPKEEP, kept on #1700 on 1 November 2026). The national start allowance, cancel, housing repair, completion effects and the live integration are other #1700 slices.+For R-PROJ-001 and R-PROJ-003, the preceding rules and the IL 0m upkeep of R-MONEY-002 remain unchanged in the game. The inactive gdd-0.3 addition is `Gdd03ProjectBuildFixture`, synthetic builder rules over the #1963 project catalogue (#1700; no command, save, loader, resolver or UI caller). A start pays the kind's full catalogue cost up front; when Money is short the start goes ahead and the shortfall is borrowed as R-MONEY-003 says, Money stopping at 0 and the rest moving to the fixture's debt (owner, 1 November 2026, D1: "Approve all six (Recommended)"). The record holds work done, not turns left. Each turn only assigned builders add work, at the catalogue's ordinary-or-novice, apprentice or expert rate (1, 1.5, 3), at most `builder.slots_per_project` (3) on one project; a project with no builders makes no progress. Money is not an input to progress, so extra Money never changes the completion turn (Amir, 28 October 2026, recorded on #1668: "Extra Money cannot replace work or speed completion. Housing and improvements also require Money for upkeep."). Work past the kind's `work` is discarded and the project completes that turn; builders are then released, and an order to a completed project is refused. From the completion turn on, every turn, a completed project is charged R-MONEY-002's MVP rate, IL 0m, vacant or not, so Money does not change; the catalogue's non-zero `upkeep` is post-MVP and unused (owner's 30 October 2026 "Keep ruling" on UPKEEP, kept on #1700 on 1 November 2026). Only `construction.starts_per_turn` (1) city starts are allowed a turn, counted nationwide: a second start in the same turn is refused before anything is paid, with Money, debt and every project unchanged, and the count resets when the turn ends; projects already running keep progressing. The fixture has no pioneer start, so pioneer work (#1713) never uses the allowance. Cancel, housing repair, completion effects and the live integration are other #1700 slices.## Trainingdiff --git a/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.csindex 42a097d4e..95e82fab9 100644--- a/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs+++ b/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs@@ -70,6 +70,7 @@ public class Gdd03ProjectBuildFixtureTestsf.Start("permanent_housing"); // 15 Money: the 1 short is borrowed (D1, R-MONEY-003)Assert.Equal(0m, f.Money);Assert.Equal(1m, f.Debt);+ f.EndTurn(Nobody); // one city start a turn (construction.starts_per_turn)var id = f.Start("industry"); // 10 Money, all borrowedAssert.Equal(0m, f.Money);Assert.Equal(11m, f.Debt);@@ -80,9 +81,36 @@ public class Gdd03ProjectBuildFixtureTestsAssert.Equal(0m, f.Projects[1].WorkDone);Assert.Throws<System.InvalidOperationException>(() => f.EndTurn(On(id, (Gdd03BuilderTier)7))); // no such tierAssert.Equal(0m, f.Projects[1].WorkDone);- Assert.Equal(0, f.Turn);+ Assert.Equal(1, f.Turn);f.EndTurn(On(id, Gdd03BuilderTier.Apprentice)); // 1.5 of 3Assert.Equal(1.5m, f.Projects[1].WorkDone);Assert.Null(f.Projects[1].CompletedTurn);}++ [Fact]+ public void OneCityStartATurnNationwideAndRunningProjectsCarryOn()+ {+ // #1700 start allowance, inactive gdd-0.3 note under R-PROJ-001; the live game keeps its own limit.+ var f = new Gdd03ProjectBuildFixture(Catalogue(), 30m);+ var housing = f.Start("permanent_housing"); // the turn's one start (construction.starts_per_turn = 1)+ Assert.Equal(15m, f.Money);+ Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara")); // a second start this turn+ Assert.Equal(15m, f.Money); // refused with Money and state unchanged+ Assert.Equal(0m, f.Debt);+ Assert.Single(f.Projects);+ f.EndTurn(On(housing, Gdd03BuilderTier.OrdinaryOrNovice));+ var industry = f.Start("industry"); // a new turn, a new start+ Assert.Equal(5m, f.Money);+ Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara"));+ Assert.Equal(5m, f.Money);+ Assert.Equal(2, f.Projects.Count);+ // The refused start does not stop projects already running.+ f.EndTurn(new Dictionary<int, Gdd03BuilderTier[]>+ {+ [housing] = new[] { Gdd03BuilderTier.OrdinaryOrNovice },+ [industry] = new[] { Gdd03BuilderTier.Expert }+ });+ Assert.Equal(2m, f.Projects[0].WorkDone);+ Assert.Equal(2, f.Projects[1].CompletedTurn);+ }}diff --git a/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs b/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.csindex 6ca43098a..a8356012b 100644--- a/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs+++ b/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs@@ -25,6 +25,7 @@ namespace Statecraft.Simconst decimal MvpUpkeep = 0m;readonly Gdd03ProjectCatalogue catalogue;readonly List<Gdd03FixtureProject> projects = new List<Gdd03FixtureProject>();+ int startsThisTurn;internal decimal Money { get; private set; }internal decimal Debt { get; private set; }internal int Turn { get; private set; }@@ -36,15 +37,19 @@ namespace Statecraft.SimMoney = money;}- /// <summary>Pays the kind's full cost up front, borrowing any shortfall (D1, R-MONEY-003). The national- /// start allowance, cancel and housing repair are other #1700 slices.</summary>+ /// <summary>Pays the kind's full cost up front, borrowing any shortfall (D1, R-MONEY-003). Only the+ /// catalogue's `construction.starts_per_turn` city starts are allowed a turn, nationwide; a start past it is+ /// refused before anything is paid. Cancel and housing repair are other #1700 slices.</summary>internal int Start(string key){var kind = catalogue.Projects.SingleOrDefault(p => p.Key == key)?? throw new InvalidOperationException("Unknown project kind: " + key);+ if (startsThisTurn >= catalogue.CityStarts.Amount)+ throw new InvalidOperationException("Only " + catalogue.CityStarts.Amount + " city start is allowed a turn");Pay(kind.Cost.Amount);var project = new Gdd03FixtureProject(projects.Count + 1, kind);projects.Add(project);+ startsThisTurn++;return project.Id;}@@ -66,6 +71,7 @@ namespace Statecraft.Simif (!Enum.IsDefined(typeof(Gdd03BuilderTier), tier)) throw new InvalidOperationException("Unknown builder tier " + (int)tier);}Turn++;+ startsThisTurn = 0;foreach (var p in projects){if (p.CompletedTurn != null || !builders.TryGetValue(p.Id, out var tiers)) continue;