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/UI: one city project start per city a turn under gdd-0.3, and a builder-freed Why line (Refs #1700 slice B) (#2348)

Eyal Golan5f021e1748a5
diff --git a/changelog.d/1700-city-start-cap.md b/changelog.d/1700-city-start-cap.md
new file mode 100644
index 000000000..65abba66d
--- /dev/null
+++ b/changelog.d/1700-city-start-cap.md
@@ -0,0 +1,5 @@
+- GDD 0.3 city project starts in the sim (Refs #1700): under the gdd-0.3 ruleset only, each city can start one city
+ project a turn, and the national limit of two starts a turn still applies. A second start in the same city is refused
+ with "Town A has started a city project this turn", with nothing paid. The current game (gdd-0.1) is unchanged. The
+ Hebrew refusal is an agent draft awaiting a native read. The turn report now also says when a builder is free again
+ (a project built or cancelled, or fewer builders ordered), in English and agent-drafted Hebrew.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 60e09ede5..ae44908dc 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -146,7 +146,7 @@ R-HOUSE-005: Under `gdd-0.3` only (#1703, the MVP's per-city housing condition),
A city project is built in a city (GDD "Cities and construction"; Phase 3 PR 4, #735). The kinds are in `content/projects.yaml`, every number a design value (Q-PROJ-1, Q-PROJ-5, owner, 15 October 2026, #375: "Take all recommendations", with agent-proposed values the owner may override): permanent housing (`housing`), the transit camp (`transit_camp`, D-D3, Q-HOUSE-3) and `industry`, and, under gdd-0.3 only, the arms workshop (`arms_workshop`, R-ARMS-004). They replace the legacy map actions, which the GDD loop refuses (R-PROJ-004).
-R-PROJ-001: `StartProject(kind, city, q, r)` starts a city project of a `projects.yaml` kind for a city on hex (q, r). The Treasury pays the kind's cost at once and borrows what it lacks (Q-PROJ-1, Q-MONEY-3, "Allow borrowing"); the project takes the next id and the kind's turns, the turn of the order the first (D-A3). It needs no workers (Q-PROJ-3); under gdd-0.3 the start takes a free person as its builder when there is one (R-CITY-011). It is refused, state and Attention unchanged, for an unknown kind or city; a locked kind that no event has unlocked (R-EFX-008); a transit camp without the `maabarot` policy at 0.5 or more (Q-HOUSE-3: the policy carries the camp's sourced date, and the map actions' 1 January 1950 window does not apply); a hex that is not land, is more than `map_action_max_distance` from the city's settlement hex, or holds a map-action placement or another city project, built or not (Q-PROJ-2); and once `map_actions_per_turn` projects were started this turn, counted nationally (Q-PROJ-4; the GDD loop builds no map action, R-PROJ-004). The legacy loop refuses it before charging Attention. Its Attention cost is `attention_cost.start_project` (1, Q-PROJ-5).
+R-PROJ-001: `StartProject(kind, city, q, r)` starts a city project of a `projects.yaml` kind for a city on hex (q, r). The Treasury pays the kind's cost at once and borrows what it lacks (Q-PROJ-1, Q-MONEY-3, "Allow borrowing"); the project takes the next id and the kind's turns, the turn of the order the first (D-A3). It needs no workers (Q-PROJ-3); under gdd-0.3 the start takes a free person as its builder when there is one (R-CITY-011). It is refused, state and Attention unchanged, for an unknown kind or city; a locked kind that no event has unlocked (R-EFX-008); a transit camp without the `maabarot` policy at 0.5 or more (Q-HOUSE-3: the policy carries the camp's sourced date, and the map actions' 1 January 1950 window does not apply); a hex that is not land, is more than `map_action_max_distance` from the city's settlement hex, or holds a map-action placement or another city project, built or not (Q-PROJ-2); and once `map_actions_per_turn` projects were started this turn, counted nationally (Q-PROJ-4; the GDD loop builds no map action, R-PROJ-004). The legacy loop refuses it before charging Attention. Its Attention cost is `attention_cost.start_project` (1, Q-PROJ-5). Under gdd-0.3 (owner, 3 November 2026: "One per city, plus 2 nationally") a city starts at most one city project a turn: a second `StartProject` for the same city that turn is refused with "Town A has started a city project this turn", with Money, debt, builders and every project unchanged. The national `map_actions_per_turn` count still applies. The city's refusal (`city_cap`) is checked just before the national one (`turn_cap`), so a start over both gives the city's reason. The count is kept per city for the turn of the national counter (`GameState.CityStartsThisTurn`), is hashed as `cstart{...}` only when it has a start, and is never kept under gdd-0.1, so no gdd-0.1 hash changes (#1700 slice B).
R-PROJ-002: `CancelProject(id)` removes a city project that is being built. The Money paid is not returned, and there are no people to return (D-A3, Q-PROJ-3); under gdd-0.3 its builder, if any, is free again at once (R-CITY-011). An unknown or built project is refused with the state unchanged. Its Attention cost is `attention_cost.cancel_project` (0.5, Q-PROJ-5).
@@ -156,9 +156,9 @@ R-PROJ-004: In the GDD loop a map action (`map_action`, the legacy transit camp
R-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).
-R-CITY-011: Under gdd-0.3 only (owner, 3 November 2026: "Builders in the MVP (Recommended)", "One builder, today's times (Recommended)", "Yes, if someone is free"; #1700 slice A), a city project being built has at most one builder. A builder is one of the city's civilians and craftsmen who hold no job and are not a staffed arms workshop's worker or another project's builder (a free person). The builder stays one of them, with no job, profession or qualification change, is not employed (R-CITY-001) and earns no job income (R-CITY-002). `Train`, `ReassignPioneers`, a `job` count, the job default (R-CITY-009) and a workshop's worker cannot take a builder. `StartProject` takes the city's free person as the new project's builder when it has one, at the moment the start runs, in queue order: a `Train` or `AssignWorkers` queued before the start has already changed the count, and one queued after it sees the builder as taken. Otherwise the project starts with no builder; it never takes anyone out of a job, the job default's included, and a project that waits does not pick up a person who becomes free later. On the aggregate cities the builder is one unit of the city's count, counted at the ordinary tier (no cost in the MVP). `AssignWorkers(city, "build", n)` sets the number of the city's projects being built that have a builder: a rise puts builders on the projects that have none, in ascending project id; a fall takes them off the projects that have one, in descending project id. It is refused, with the state unchanged, for an unknown city; a negative count; more than the city's projects being built ("Town A has 1 city project being built"); or more new builders than the city's free people ("... civilians and craftsmen without a job"), with R-ARMS-005's job-default rule (while the default is on, an order may take a builder from the default's jobs, and is refused only past the city's civilians and craftsmen less its staffed workshops and builders). Under every other ruleset the role is refused as "There is no such role". A project's builder is freed when it is built or cancelled. A freed builder does not move to another project by itself. The limits a panel reads with this turn's queue (`Training.Available`, `Workshops.Check`, `Cities.MaxWorkers`) also count the builder each queued `StartProject` in the city may take, so a count up to them is accepted whichever order runs first. On step 6 the staffed arms workshops share the city's people without a job with the builders, who took theirs at step 5 (R-ARMS-006). The Why screen says when a builder starts on a project ("Town: a builder started on a housing project").
+R-CITY-011: Under gdd-0.3 only (owner, 3 November 2026: "Builders in the MVP (Recommended)", "One builder, today's times (Recommended)", "Yes, if someone is free"; #1700 slice A), a city project being built has at most one builder. A builder is one of the city's civilians and craftsmen who hold no job and are not a staffed arms workshop's worker or another project's builder (a free person). The builder stays one of them, with no job, profession or qualification change, is not employed (R-CITY-001) and earns no job income (R-CITY-002). `Train`, `ReassignPioneers`, a `job` count, the job default (R-CITY-009) and a workshop's worker cannot take a builder. `StartProject` takes the city's free person as the new project's builder when it has one, at the moment the start runs, in queue order: a `Train` or `AssignWorkers` queued before the start has already changed the count, and one queued after it sees the builder as taken. Otherwise the project starts with no builder; it never takes anyone out of a job, the job default's included, and a project that waits does not pick up a person who becomes free later. On the aggregate cities the builder is one unit of the city's count, counted at the ordinary tier (no cost in the MVP). `AssignWorkers(city, "build", n)` sets the number of the city's projects being built that have a builder: a rise puts builders on the projects that have none, in ascending project id; a fall takes them off the projects that have one, in descending project id. It is refused, with the state unchanged, for an unknown city; a negative count; more than the city's projects being built ("Town A has 1 city project being built"); or more new builders than the city's free people ("... civilians and craftsmen without a job"), with R-ARMS-005's job-default rule (while the default is on, an order may take a builder from the default's jobs, and is refused only past the city's civilians and craftsmen less its staffed workshops and builders). Under every other ruleset the role is refused as "There is no such role". A project's builder is freed when it is built or cancelled. A freed builder does not move to another project by itself. The limits a panel reads with this turn's queue (`Training.Available`, `Workshops.Check`, `Cities.MaxWorkers`) also count the builder each queued `StartProject` in the city may take, so a count up to them is accepted whichever order runs first. On step 6 the staffed arms workshops share the city's people without a job with the builders, who took theirs at step 5 (R-ARMS-006). The Why screen says when a builder starts on a project ("Town: a builder started on a housing project") and when one is freed, as the project is built or cancelled or the `build` count falls ("Town: a builder left a housing project and is free again", #1700 slice B).
-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.
+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). A city starts at most one project a turn, and two starts are allowed a turn nationally, as R-PROJ-001 under gdd-0.3 (owner, 3 November 2026: "One per city, plus 2 nationally"): a second start in the same city, or a third in the country, is refused before anything is paid, the city's limit first, with Money, debt and every project unchanged, and both counts reset when the turn ends; projects already running keep progressing. The catalogue's `construction.starts_per_turn` (1, "nationwide per turn") is Amir's catalogue reading; the live rule is R-PROJ-001's. 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.
## Training
diff --git a/sim/Statecraft.Sim.Tests/CityBuildersTests.cs b/sim/Statecraft.Sim.Tests/CityBuildersTests.cs
index 864a7f587..a101fcb2c 100644
--- a/sim/Statecraft.Sim.Tests/CityBuildersTests.cs
+++ b/sim/Statecraft.Sim.Tests/CityBuildersTests.cs
@@ -194,6 +194,10 @@ public class CityBuildersTests
var down = Step(c, up.State, Build(1));
Assert.Empty(down.Rejected);
Assert.Equal((true, false, false), (down.State.CityProjects[one].Builder, down.State.CityProjects[two].Builder, down.State.CityProjects[three].Builder));
+ // The Why screen says which project the fall freed a builder from (slice B); the rise freed none.
+ Assert.DoesNotContain(up.Why, w => w.Key == CauseKeys.ProjectBuilderFreed);
+ var freed = Assert.Single(down.Why, w => w.Key == CauseKeys.ProjectBuilderFreed);
+ Assert.Equal(("town_a", "industry"), (freed.Target, freed.Args.Single()));
}
// R-CITY-011: the order's refusals leave the state as it was; under gdd-0.1 the role does not exist.
@@ -230,7 +234,12 @@ public class CityBuildersTests
var (c, s) = Game();
var done = Add(s, "housing", 1, 1, 1, true);
var waiting = Add(s, "industry", 2, 0, 2, false);
- var r = Step(c, s).State;
+ var built = Step(c, s);
+ var r = built.State;
+ // The Why screen says the builder is free again (slice B): once, for the built project, not the one with no builder.
+ var freed = Assert.Single(built.Why, w => w.Key == CauseKeys.ProjectBuilderFreed);
+ Assert.Equal(("town_a", "housing"), (freed.Target, freed.Args.Single()));
+ Assert.Equal("Town A: a builder left a housing project and is free again", freed.Message);
Assert.NotNull(r.CityProjects[done].BuiltOn);
Assert.False(r.CityProjects[done].Builder);
Assert.False(r.CityProjects[waiting].Builder);
@@ -241,6 +250,7 @@ public class CityBuildersTests
var id = Add(s2, "housing", 1, 1, 2, true);
var cancel = Step(c2, s2, new CancelProject(id));
Assert.Empty(cancel.Rejected);
+ Assert.Equal("housing", Assert.Single(cancel.Why, w => w.Key == CauseKeys.ProjectBuilderFreed).Args.Single());
Assert.Equal(0, Projects.Builders(cancel.State, "town_a"));
var none = Step(c2, s2).State;
Assert.Equal(Training.Idle(none, none.Cities["town_a"]) + 1, Training.Idle(cancel.State, cancel.State.Cities["town_a"]));
diff --git a/sim/Statecraft.Sim.Tests/CityStartCapTests.cs b/sim/Statecraft.Sim.Tests/CityStartCapTests.cs
new file mode 100644
index 000000000..3f9767bc1
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/CityStartCapTests.cs
@@ -0,0 +1,176 @@
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>#1700 slice B, R-PROJ-001 under gdd-0.3 (owner, 3 November 2026: "One per city, plus 2 nationally"): a city
+/// starts at most one city project a turn, and the national map_actions_per_turn (2) still applies. gdd-0.1 keeps its two
+/// starts a turn, counted nationally, with no city cap. Fixture values, not the game's: town_a on (1, 0), town_b on (1, 1),
+/// town_c on (3, 0), with map_action_max_distance 1 and map_actions_per_turn 2.</summary>
+public class CityStartCapTests
+{
+ static Content Load(bool gdd03)
+ {
+ var f = ArmsWorkshopTests.Files(gdd03);
+ f["map/settlement_hexes.yaml"] = "settlements:\n - { id: town_a, q: 1, r: 0 }\n - { id: town_b, q: 1, r: 1 }\n - { id: town_c, q: 3, r: 0 }\n";
+ f["map/settlements_1948.yaml"] = Fixture.Files["map/settlements_1948.yaml"]
+ + " - { id: town_b, name: Town B, lon: 34.42, lat: 33.28, type: town, founded: 1900, pre_modern: false }\n"
+ + " - { id: town_c, name: Town C, lon: 34.51, lat: 33.35, type: town, founded: 1900, pre_modern: false }\n";
+ f["cities.yaml"] = "cities:\n" + Fixture.City("town_a", 12, 8, 10, 6, "[military_camp, hakhshara]")
+ + Fixture.City("town_b", 5, 2, 4, 1) + Fixture.City("town_c", 5, 2, 4, 1);
+ return ContentLoader.Load(Fixture.Write(f));
+ }
+
+ static GameState New(Content c)
+ {
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ s.Treasury = 100; s.Debt = 0; s.Attention = 10;
+ return s;
+ }
+
+ static StartProject A1() => new StartProject("industry", "town_a", 1, 0);
+ static StartProject A2() => new StartProject("housing", "town_a", 0, 1);
+ static StartProject B() => new StartProject("industry", "town_b", 1, 1);
+ static StartProject C() => new StartProject("industry", "town_c", 3, 0);
+
+ const string CityCapText = "Town A has started a city project this turn";
+
+ // A second start for the same city in one step is refused with the city's reason, and everything (Money, debt, the
+ // projects, the cities' people, the counters) is as after the first start alone.
+ [Fact]
+ public void Gdd03SecondStartInOneCityIsRefused()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var one = Simulation.Step(c, s, new Command[] { A1() });
+ var two = Simulation.Step(c, s, new Command[] { A1(), A2() });
+ Assert.Empty(one.Rejected);
+ var refused = Assert.Single(two.Rejected);
+ Assert.Equal(CityCapText, refused.Reason);
+ Assert.Equal((one.State.Treasury, one.State.Debt, one.State.CityProjects.Count), (two.State.Treasury, two.State.Debt, two.State.CityProjects.Count));
+ Assert.Equal(one.State.Cities["town_a"].Canonical(false), two.State.Cities["town_a"].Canonical(false));
+ Assert.Equal(one.State.Hash(), two.State.Hash());
+
+ // The validator's stable kind and invariant values (#1122), as the order runs: after the city's first start.
+ var mid = s.Clone();
+ Assert.Null(Projects.StartCity(c, mid, "industry", "town_a", 1, 0, new List<Cause>()));
+ var reason = Projects.CheckCityReason(c, mid, "housing", "town_a", 0, 1);
+ Assert.NotNull(reason);
+ Assert.Equal("city_cap", reason!.Kind);
+ Assert.Equal(new[] { "town_a" }, reason.Values);
+ Assert.Equal(CityCapText, reason.Text);
+ Assert.Empty(s.CityStartsThisTurn); // Clone copies the record
+ Assert.Contains("cstart{", mid.Describe()); // hashed once it has a start
+ }
+
+ [Fact]
+ public void Gdd03TwoCitiesMayEachStart()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var r = Simulation.Step(c, s, new Command[] { A1(), B() });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(new[] { "town_a", "town_b" }, r.State.CityProjects.Values.Select(p => p.City).OrderBy(x => x, System.StringComparer.Ordinal));
+ }
+
+ // The national map_actions_per_turn (2) still applies: a third start, in a third city, is refused as turn_cap.
+ [Fact]
+ public void Gdd03NationalCapStillApplies()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var r = Simulation.Step(c, s, new Command[] { A1(), B(), C() });
+ var refused = Assert.Single(r.Rejected);
+ Assert.IsType<StartProject>(refused.Command);
+ Assert.Equal("town_c", ((StartProject)refused.Command).City);
+ Assert.Equal("No more than 2 city projects in one turn", refused.Reason);
+ Assert.Equal(2, r.State.CityProjects.Count);
+
+ var mid = s.Clone();
+ Assert.Null(Projects.StartCity(c, mid, "industry", "town_a", 1, 0, new List<Cause>()));
+ Assert.Null(Projects.StartCity(c, mid, "industry", "town_b", 1, 1, new List<Cause>()));
+ Assert.Equal("turn_cap", Projects.CheckCityReason(c, mid, "industry", "town_c", 3, 0)!.Kind);
+ // Over both limits, the city's own reason comes first.
+ Assert.Equal("city_cap", Projects.CheckCityReason(c, mid, "housing", "town_a", 0, 1)!.Kind);
+ }
+
+ [Fact]
+ public void Gdd03CityCapResetsNextTurn()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var one = Simulation.Step(c, s, new Command[] { A1() });
+ var two = Simulation.Step(c, one.State, new Command[] { A2() });
+ Assert.Empty(two.Rejected);
+ Assert.Equal(2, two.State.CityProjects.Count);
+ }
+
+ // A start that waits for a builder (nobody free in the city, R-CITY-011) is still a start: it uses the city's slot and
+ // a national one, so a second start in that city is city_cap and a third city's is turn_cap.
+ [Fact]
+ public void Gdd03StartWaitingForABuilderStillCounts()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var a = s.Cities["town_a"];
+ s.Cities["town_a"] = new City(a.Id, a.HousingCapacity, a.Civilians, a.Civilians, a.Civilians, 0, 0, a.Condition, jobsDefault: false);
+ var r = Simulation.Step(c, s, new Command[] { A1(), A2(), B(), C() });
+ var waiting = r.State.CityProjects.Values.Single(p => p.City == "town_a");
+ Assert.False(waiting.Builder); // nobody free: no builder, the project waits
+ Assert.Equal(new[] { CityCapText, "No more than 2 city projects in one turn" }, r.Rejected.Select(x => x.Reason));
+ Assert.Equal(new[] { "town_a", "town_c" }, r.Rejected.Select(x => ((StartProject)x.Command).City));
+ Assert.Equal(1, r.State.CityStartsThisTurn["town_a"]);
+ Assert.Equal(2, r.State.MapActionsThisTurn);
+ Assert.Equal(new[] { "town_a", "town_b" }, r.State.CityProjects.Values.Select(p => p.City).OrderBy(x => x, System.StringComparer.Ordinal));
+ }
+
+ // The cap limits starts, not building: in a turn where the city has used its start and city_cap refuses another, the
+ // city's project already running advances exactly as in a turn where the city starts nothing.
+ [Fact]
+ public void Gdd03RunningProjectsKeepProgressing()
+ {
+ var c = Load(true);
+ var s = New(c);
+ var one = Simulation.Step(c, s, new Command[] { A1() });
+ var running = one.State.CityProjects.Values.Single();
+ var idle = Simulation.Step(c, one.State, new Command[0]);
+ var two = Simulation.Step(c, one.State, new Command[] { A2(), new StartProject("industry", "town_a", 2, 0) });
+ Assert.Equal(CityCapText, Assert.Single(two.Rejected).Reason);
+ Assert.Equal(1, two.State.CityStartsThisTurn["town_a"]); // the slot is used; the refused start is not counted
+ var advanced = idle.State.CityProjects[running.Id];
+ Assert.True(advanced.TurnsLeft < running.TurnsLeft);
+ Assert.Equal(advanced.Canonical(), two.State.CityProjects[running.Id].Canonical());
+ }
+
+ // Under gdd-0.1 nothing changes: two starts in one city in one turn are both accepted, and nothing new is recorded or
+ // hashed (legacy byte identity is the golden manifest's job, not a literal here).
+ [Fact]
+ public void Gdd01KeepsTwoNationallyNoCityCap()
+ {
+ var c = Load(false);
+ Assert.Equal(SaveGame.GddRuleset, c.Ruleset);
+ var s = New(c);
+ var r = Simulation.Step(c, s, new Command[] { A1(), A2() });
+ Assert.Empty(r.Rejected);
+ Assert.Equal(2, r.State.CityProjects.Count);
+ Assert.Empty(r.State.CityStartsThisTurn);
+ Assert.DoesNotContain("cstart{", r.State.Describe());
+ Assert.Equal("No more than 2 city projects in one turn", Simulation.Step(c, s, new Command[] { A1(), B(), C() }).Rejected.Single().Reason);
+ }
+
+ // R-SAVE: two project lines for one city in one turn replay to the same refusal and the same state.
+ [Fact]
+ public void Gdd03CityCapRoundTripsThroughASave()
+ {
+ var c = Load(true);
+ var g = GameSession.New(c, 1, Mode.Historical);
+ var r = g.Step(new Command[] { A1(), A2() });
+ Assert.Equal(CityCapText, Assert.Single(r.Rejected).Reason);
+ var text = g.Save.Write();
+ Assert.Contains("\nproject industry town_a 1 0\n", text);
+ Assert.Contains("\nproject housing town_a 0 1\n", text);
+ var loaded = GameSession.Load(c, text, out var warnings);
+ Assert.Empty(warnings);
+ Assert.Equal(g.State.Hash(), loaded.State.Hash());
+ Assert.Equal(CityCapText, Assert.Single(loaded.Last!.Rejected).Reason);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs
index 95e82fab9..35b89c53b 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03ProjectBuildFixtureTests.cs
@@ -6,12 +6,14 @@ using Statecraft.Sim;
// require Money for upkeep."
public class Gdd03ProjectBuildFixtureTests
{
- static Gdd03ProjectCatalogue Catalogue()
+ // The national limit comes from the loaded rules (map_actions_per_turn); a test may override it to prove that.
+ static Gdd03ProjectBuildFixture New(decimal money, int? mapActionsPerTurn = null)
{
var content = ContentLoader.Load(RealContentTests.ContentRoot());
// Synthetic identity selection only; no scenario, region or facility binding.
content.Eras = new() { new Era { Systems = new EraSystems { Loop = EraSystems.Gdd, Ruleset = SaveGame.Gdd03Ruleset } } };
- return Gdd03ProjectCatalogue.Read(content);
+ if (mapActionsPerTurn != null) content.Rules.MapActionsPerTurn = mapActionsPerTurn.Value;
+ return new Gdd03ProjectBuildFixture(Gdd03ProjectCatalogue.Read(content), content.Rules, money);
}
static readonly IReadOnlyDictionary<int, Gdd03BuilderTier[]> Nobody = new Dictionary<int, Gdd03BuilderTier[]>();
@@ -21,8 +23,8 @@ public class Gdd03ProjectBuildFixtureTests
[Fact]
public void AFundedProjectWithNoBuildersMakesNoProgress()
{
- var f = new Gdd03ProjectBuildFixture(Catalogue(), 5m);
- var id = f.Start("maabara"); // 5 Money, 1 work
+ var f = New(5m);
+ var id = f.Start("maabara", "town_a"); // 5 Money, 1 work
Assert.Equal(0m, f.Money); // the full cost up front (R-PROJ-001)
for (var i = 0; i < 10; i++) f.EndTurn(Nobody);
var p = Assert.Single(f.Projects);
@@ -37,8 +39,8 @@ public class Gdd03ProjectBuildFixtureTests
{
int? Completion(decimal money)
{
- var f = new Gdd03ProjectBuildFixture(Catalogue(), money);
- var id = f.Start("permanent_housing"); // 15 Money, 3 work
+ var f = New(money);
+ var id = f.Start("permanent_housing", "town_a"); // 15 Money, 3 work
// Builders are released on completion, so they work only while the project is open.
for (var i = 0; i < 10 && f.Projects[0].CompletedTurn == null; i++) f.EndTurn(On(id, Gdd03BuilderTier.OrdinaryOrNovice));
return f.Projects[0].CompletedTurn;
@@ -50,8 +52,8 @@ public class Gdd03ProjectBuildFixtureTests
[Fact]
public void ACompletedImprovementChargesItsUpkeepEachTurnEvenVacant()
{
- var f = new Gdd03ProjectBuildFixture(Catalogue(), 20m);
- var id = f.Start("industry"); // 10 Money, 3 work; the catalogue's 0.25 upkeep is post-MVP
+ var f = New(20m);
+ var id = f.Start("industry", "town_a"); // 10 Money, 3 work; the catalogue's 0.25 upkeep is post-MVP
Assert.Equal(10m, f.Money);
f.EndTurn(On(id, Gdd03BuilderTier.Expert)); // 3 work: complete on turn 1
Assert.Equal(1, f.Projects[0].CompletedTurn);
@@ -66,12 +68,12 @@ public class Gdd03ProjectBuildFixtureTests
[Fact]
public void AShortStartBorrowsAndBuildersAreCappedAtTheSlots()
{
- var f = new Gdd03ProjectBuildFixture(Catalogue(), 14m);
- f.Start("permanent_housing"); // 15 Money: the 1 short is borrowed (D1, R-MONEY-003)
+ var f = New(14m);
+ f.Start("permanent_housing", "town_a"); // 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 borrowed
+ f.EndTurn(Nobody); // one start a city a turn (R-PROJ-001 under gdd-0.3)
+ var id = f.Start("industry", "town_a"); // 10 Money, all borrowed
Assert.Equal(0m, f.Money);
Assert.Equal(11m, f.Debt);
Assert.Equal(2, f.Projects.Count);
@@ -88,20 +90,20 @@ public class Gdd03ProjectBuildFixtureTests
}
[Fact]
- public void OneCityStartATurnNationwideAndRunningProjectsCarryOn()
+ public void OneStartACityATurnAndRunningProjectsCarryOn()
{
- // #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)
+ // #1700 slice B (owner, 3 November 2026: "One per city, plus 2 nationally"), the gdd-0.3 note under R-PROJ-001.
+ var f = New(30m);
+ var housing = f.Start("permanent_housing", "town_a"); // the city's one start this turn
Assert.Equal(15m, f.Money);
- Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara")); // a second start this turn
+ Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara", "town_a")); // a second start in the city
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
+ var industry = f.Start("industry", "town_a"); // a new turn, a new start
Assert.Equal(5m, f.Money);
- Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara"));
+ Assert.Throws<System.InvalidOperationException>(() => f.Start("maabara", "town_a"));
Assert.Equal(5m, f.Money);
Assert.Equal(2, f.Projects.Count);
// The refused start does not stop projects already running.
@@ -113,4 +115,61 @@ public class Gdd03ProjectBuildFixtureTests
Assert.Equal(2m, f.Projects[0].WorkDone);
Assert.Equal(2, f.Projects[1].CompletedTurn);
}
+
+ [Fact]
+ public void TwoStartsInOneCityTheSecondIsRefused()
+ {
+ var f = New(100m);
+ f.Start("industry", "town_a");
+ var e = Assert.Throws<System.InvalidOperationException>(() => f.Start("industry", "town_a"));
+ Assert.Equal("town_a has started a city project this turn", e.Message);
+ Assert.Equal((90m, 0m, 1), (f.Money, f.Debt, f.Projects.Count)); // refused before anything is paid
+ }
+
+ [Fact]
+ public void OneStartInEachOfTwoCitiesBothAreAccepted()
+ {
+ var f = New(100m);
+ f.Start("industry", "town_a");
+ f.Start("industry", "town_b");
+ Assert.Equal((80m, 0m, 2), (f.Money, f.Debt, f.Projects.Count));
+ }
+
+ [Fact]
+ public void StartsInThreeCitiesTheThirdIsRefusedByTheNationalTwo()
+ {
+ var f = New(100m);
+ f.Start("industry", "town_a");
+ f.Start("industry", "town_b");
+ var e = Assert.Throws<System.InvalidOperationException>(() => f.Start("industry", "town_c"));
+ Assert.Equal("No more than 2 city starts are allowed a turn", e.Message);
+ Assert.Equal((80m, 0m, 2), (f.Money, f.Debt, f.Projects.Count));
+ f.EndTurn(Nobody);
+ f.Start("industry", "town_c"); // both counts reset when the turn ends
+ f.Start("industry", "town_a");
+ Assert.Equal(4, f.Projects.Count);
+ }
+
+ // The fixture's national 2 is the live game's map_actions_per_turn (content/rules.yaml), which the ruling keeps.
+ [Fact]
+ public void TheNationalTwoIsTheGamesMapActionsPerTurn()
+ {
+ var content = ContentLoader.Load(RealContentTests.ContentRoot());
+ Assert.Equal(2, content.Rules.MapActionsPerTurn); // "plus 2 nationally"
+ Assert.Equal(content.Rules.MapActionsPerTurn, New(0m).NationalStarts);
+ }
+
+ // The limit is read from the rules, not a literal: with map_actions_per_turn 3 a third city may start.
+ [Fact]
+ public void TheNationalLimitFollowsTheRulesMapActionsPerTurn()
+ {
+ var f = New(100m, mapActionsPerTurn: 3);
+ Assert.Equal(3, f.NationalStarts);
+ f.Start("industry", "town_a");
+ f.Start("industry", "town_b");
+ f.Start("industry", "town_c");
+ var e = Assert.Throws<System.InvalidOperationException>(() => f.Start("industry", "town_d"));
+ Assert.Equal("No more than 3 city starts are allowed a turn", e.Message);
+ Assert.Equal((70m, 0m, 3), (f.Money, f.Debt, f.Projects.Count));
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/NoAttentionTests.cs b/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
index 8dd0718c3..28787a121 100644
--- a/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
+++ b/sim/Statecraft.Sim.Tests/NoAttentionTests.cs
@@ -82,8 +82,10 @@ public class NoAttentionTests
var oldGood=Simulation.Preview(oldContent,oldState,new[]{oldValid});
var oldBad=Simulation.Preview(oldContent,oldState,new[]{oldInvalid});
Assert.Equal(oldBad.Rejected.Single().Reason,bad.Rejected.Single().Reason);
- // R-CITY-011 (#1700): under gdd-0.3 a start takes a free person as its builder, its one difference from gdd-0.1.
- string Same(string modern) { if (kind != "start_project") return modern; Assert.Single(Regex.Matches(modern, ";builder")); return modern.Replace(";builder", ""); }
+ // R-CITY-011 and R-PROJ-001 (#1700 slices A and B): under gdd-0.3 a start takes a free person as its builder and is
+ // counted for its city, its two differences from gdd-0.1.
+ string Same(string modern) { if (kind != "start_project") return modern; Assert.Single(Regex.Matches(modern, ";builder")); Assert.Contains("\ncstart{", modern);
+ return Regex.Replace(modern.Replace(";builder", ""), @"\ncstart\{(?:\n [^\n]*)*", ""); }
Assert.Equal(WithoutLegacyAccounting(oldGood.State.Describe()),WithoutLegacyAccounting(Same(good.State.Describe())));
Assert.Equal(WithoutLegacyAccounting(oldBad.State.Describe()),WithoutLegacyAccounting(bad.State.Describe()));
Assert.Equal(WithoutLegacyAccounting(Simulation.Step(oldContent,oldState,new[]{oldValid}).State.Describe()),WithoutLegacyAccounting(Same(step.State.Describe())));
diff --git a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
index 8a292bb53..cac7e50eb 100644
--- a/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
+++ b/sim/Statecraft.Sim.Tests/RemainingCauseKeysTests.cs
@@ -115,7 +115,7 @@ public class RemainingCauseKeysTests
sites++;
}
}
- Assert.Equal(118, sites); // 118 with #1700's builders (R-CITY-011: two ProjectBuilder lines, ProjectWaiting, the build order's job-default line); 114 with #1703's gdd-0.3 housing surcharge and housing cohesion lines; 112 with the arms workshops' five (R-ARMS-005 with its job-default line, R-ARMS-006; #1701); 107 with R-MONEY-004's DollarsConverted (#813); 106 since #2212: EconomySystem.OtherMoney's line (105 since #2199: PayOrBorrow's Paid line)
+ Assert.Equal(119, sites); // 119 with #1700 slice B's ProjectBuilderFreed; 118 with #1700's builders (R-CITY-011: two ProjectBuilder lines, ProjectWaiting, the build order's job-default line); 114 with #1703's gdd-0.3 housing surcharge and housing cohesion lines; 112 with the arms workshops' five (R-ARMS-005 with its job-default line, R-ARMS-006; #1701); 107 with R-MONEY-004's DollarsConverted (#813); 106 since #2212: EconomySystem.OtherMoney's line (105 since #2199: PayOrBorrow's Paid line)
}
[Fact]
diff --git a/sim/Statecraft.Sim/Cause.cs b/sim/Statecraft.Sim/Cause.cs
index 1d4be771b..4cd885b15 100644
--- a/sim/Statecraft.Sim/Cause.cs
+++ b/sim/Statecraft.Sim/Cause.cs
@@ -136,6 +136,8 @@ namespace Statecraft.Sim
public const string ProjectCompleted = "project_completed";
/// <summary>R-CITY-011 (#1700): a builder started on a city project. Args: k.Id.</summary>
public const string ProjectBuilder = "project_builder";
+ /// <summary>R-CITY-011 (#1700 slice B): a city project's builder is free again (built, cancelled or the build count fell). Args: k.Id.</summary>
+ public const string ProjectBuilderFreed = "project_builder_freed";
/// <summary>R-PROJ-003 with R-CITY-011: a city project gained no progress this turn. Args: k.Id; Projects.NoBuilder or Projects.NoWorker.</summary>
public const string ProjectWaiting = "project_waiting";
/// <summary>Args: CauseKeys.Number(cost).</summary>
@@ -269,7 +271,7 @@ namespace Statecraft.Sim
EventNew, EventChosen, EventDelegated, EventDelegatedPartial, EventAmount, EventStock, EventGrant, EventCity,
EventUnlock, EventPolicy, EventSetRung, EventRejoin, MilitaryUpkeep, HousingSurcharge, HousingCohesion,
ObjectiveCompleted, PrisonersReturned, SoldiersReturned,
- WorkersAssigned, WagesPaid, ImmigrantsHoused, HousingShortage, ImmigrantsWaiting, RecruitsVeteran, CorridorStarted, CorridorCancelled, CorridorCompleted, PioneersVeteran, MapBorrowed, MapBuilt, LandWorkStarted, SiteStarted, SiteCancelled, SiteCompleted, ProjectStarted, ProjectCancelled, ProjectCompleted, ProjectBuilder, ProjectWaiting, ArmsBought, WorkshopWorkers, WorkshopArms, WorkshopPaused, DollarsConverted, FoodHarvest, FoodShortage, FoodWithoutImports, PrisonerFood, PrisonerFoodShortage, CraftsmenReturned, CraftsmenReassigned, PioneerReturned, PioneersReassigned, TrainingStarted, TrainingArms, TrainingCancelled, TrainingArmsReturned, ReplacementsStopped, ReplacementsJoined, MilitaryTrained, PioneersTrained, CraftsmenTrained, Appointed, Reshuffle, AppointmentsEnded, ApprovalStability, CoalitionCollapsed, LegislatureConvened, GovernmentTookOffice, CoalitionChanged, EraEnded, AdvisoryPolicyRejected, PolicyRejected, PolicySet, AdvisoryBudgetRejected, BudgetRejected, PlaceCaptured, EnemyRegained, PlaceAnnexed, PlaceWithdrawn, PlaceDeported, DeportEffect, DeportCost, OccupationStarted, PendingBecameRaid, OccupationLostUnit, OccupationCountdown, DepopulationSupport,
+ WorkersAssigned, WagesPaid, ImmigrantsHoused, HousingShortage, ImmigrantsWaiting, RecruitsVeteran, CorridorStarted, CorridorCancelled, CorridorCompleted, PioneersVeteran, MapBorrowed, MapBuilt, LandWorkStarted, SiteStarted, SiteCancelled, SiteCompleted, ProjectStarted, ProjectCancelled, ProjectCompleted, ProjectBuilder, ProjectBuilderFreed, ProjectWaiting, ArmsBought, WorkshopWorkers, WorkshopArms, WorkshopPaused, DollarsConverted, FoodHarvest, FoodShortage, FoodWithoutImports, PrisonerFood, PrisonerFoodShortage, CraftsmenReturned, CraftsmenReassigned, PioneerReturned, PioneersReassigned, TrainingStarted, TrainingArms, TrainingCancelled, TrainingArmsReturned, ReplacementsStopped, ReplacementsJoined, MilitaryTrained, PioneersTrained, CraftsmenTrained, Appointed, Reshuffle, AppointmentsEnded, ApprovalStability, CoalitionCollapsed, LegislatureConvened, GovernmentTookOffice, CoalitionChanged, EraEnded, AdvisoryPolicyRejected, PolicyRejected, PolicySet, AdvisoryBudgetRejected, BudgetRejected, PlaceCaptured, EnemyRegained, PlaceAnnexed, PlaceWithdrawn, PlaceDeported, DeportEffect, DeportCost, OccupationStarted, PendingBecameRaid, OccupationLostUnit, OccupationCountdown, DepopulationSupport,
};
/// <summary>A number as an Arg: invariant and round-trip, so the UI rounds exactly the value Message rounded.</summary>
diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.cs
index e24a4cd4d..03e23aa8f 100644
--- a/sim/Statecraft.Sim/GameState.cs
+++ b/sim/Statecraft.Sim/GameState.cs
@@ -81,6 +81,11 @@ namespace Statecraft.Sim
/// acceptance, so replacing a camp with housing cannot reopen the per-turn cap; a new date starts from zero.</summary>
public DateTime MapActionsTurnDate;
public int MapActionsThisTurn;
+ /// <summary>R-PROJ-001 under gdd-0.3 only (#1700 slice B): the city projects each city started in the turn of
+ /// <see cref="MapActionsTurnDate"/>, by city id (ordinal), counted on acceptance. Read only while that date is the
+ /// turn's, and cleared when a start or map action moves it on, as MapActionsThisTurn is reset. Empty under every
+ /// other ruleset, and then left out of the hash.</summary>
+ public SortedDictionary<string, int> CityStartsThisTurn = new SortedDictionary<string, int>(StringComparer.Ordinal);
/// <summary>Why the game ended, as one of the <see cref="GameOverCodes"/>; null while it is on. Never display it: use PlayerText.GameOver.</summary>
public string? GameOver;
// GDD v0.1 state (spec 2026-10-12 section 2.2). Empty in the legacy loop, and then left out of the hash (R-LOOP-002).
@@ -165,6 +170,7 @@ namespace Statecraft.Sim
c.Cohorts = new SortedList<int, Cohort>(Cohorts);
c.Sites = new SortedDictionary<string, SiteWork>(Sites, StringComparer.Ordinal);
c.CityProjects = new SortedList<int, CityProject>(CityProjects);
+ c.CityStartsThisTurn = new SortedDictionary<string, int>(CityStartsThisTurn, StringComparer.Ordinal);
c.Workshops = new SortedList<int, Workshop>(Workshops);
c.Corridors = new SortedDictionary<string, CorridorWork>(Corridors, StringComparer.Ordinal);
c.UnlockedProjects = new SortedSet<string>(UnlockedProjects, StringComparer.Ordinal);
@@ -261,6 +267,8 @@ namespace Statecraft.Sim
if (Cohorts.Count > 0) Section("train", '[', ']', Cohorts.Values.Select(x => x.Canonical()));
if (Sites.Count > 0) Section("site", '{', '}', Sites.Values.Select(x => x.Canonical()));
if (CityProjects.Count > 0) Section("cproj", '[', ']', CityProjects.Values.Select(x => x.Canonical()));
+ if (CityStartsThisTurn.Count > 0) // R-PROJ-001, gdd-0.3 only
+ Section("cstart", '{', '}', CityStartsThisTurn.Select(kv => kv.Key + "=" + kv.Value.ToString(CultureInfo.InvariantCulture)));
if (Workshops.Count > 0) Section("wshop", '[', ']', Workshops.Values.Select(x => x.Canonical())); // R-ARMS-005, gdd-0.3 only
if (Corridors.Count > 0) Section("corr", '{', '}', Corridors.Values.Select(x => x.Canonical()));
if (UnlockedProjects.Count > 0) Section("unlocked", '[', ']', UnlockedProjects);
diff --git a/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs b/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs
index a8356012b..46d5ae44d 100644
--- a/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs
+++ b/sim/Statecraft.Sim/Gdd03ProjectBuildFixture.cs
@@ -25,31 +25,41 @@ namespace Statecraft.Sim
const decimal MvpUpkeep = 0m;
readonly Gdd03ProjectCatalogue catalogue;
readonly List<Gdd03FixtureProject> projects = new List<Gdd03FixtureProject>();
- int startsThisTurn;
+ // #1700 slice B (owner, 3 November 2026: "One per city, plus 2 nationally"): each city's starts this turn.
+ readonly Dictionary<string, int> startsThisTurn = new Dictionary<string, int>(StringComparer.Ordinal);
internal decimal Money { get; private set; }
internal decimal Debt { get; private set; }
internal int Turn { get; private set; }
internal IReadOnlyList<Gdd03FixtureProject> Projects => projects;
- internal Gdd03ProjectBuildFixture(Gdd03ProjectCatalogue catalogue, decimal money)
+ /// <summary>The national limit on city starts a turn: the game's map_actions_per_turn (content/rules.yaml), read
+ /// from <paramref name="rules"/>, which the owner's 3 November 2026 ruling keeps ("One per city, plus 2 nationally").</summary>
+ internal int NationalStarts { get; }
+
+ internal Gdd03ProjectBuildFixture(Gdd03ProjectCatalogue catalogue, Rules rules, decimal money)
{
this.catalogue = catalogue ?? throw new ArgumentNullException(nameof(catalogue));
+ NationalStarts = (rules ?? throw new ArgumentNullException(nameof(rules))).MapActionsPerTurn;
Money = money;
}
- /// <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)
+ /// <summary>Pays the kind's full cost up front, borrowing any shortfall (D1, R-MONEY-003). A city starts at most
+ /// <see cref="Statecraft.Sim.Projects.Gdd03CityStartsPerTurn"/> (1) project a turn, and <see cref="NationalStarts"/> (map_actions_per_turn) starts a turn
+ /// nationally, as R-PROJ-001 under gdd-0.3; a start past either is refused before anything is paid, the city's
+ /// limit first. Cancel and housing repair are other #1700 slices.</summary>
+ internal int Start(string key, string city)
{
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");
+ var inCity = startsThisTurn.TryGetValue(city, out var n) ? n : 0;
+ if (inCity >= Statecraft.Sim.Projects.Gdd03CityStartsPerTurn)
+ throw new InvalidOperationException(city + " has started a city project this turn");
+ if (startsThisTurn.Values.Sum() >= NationalStarts)
+ throw new InvalidOperationException("No more than " + NationalStarts + " city starts are allowed a turn");
Pay(kind.Cost.Amount);
var project = new Gdd03FixtureProject(projects.Count + 1, kind);
projects.Add(project);
- startsThisTurn++;
+ startsThisTurn[city] = inCity + 1;
return project.Id;
}
@@ -71,7 +81,7 @@ namespace Statecraft.Sim
if (!Enum.IsDefined(typeof(Gdd03BuilderTier), tier)) throw new InvalidOperationException("Unknown builder tier " + (int)tier);
}
Turn++;
- startsThisTurn = 0;
+ startsThisTurn.Clear();
foreach (var p in projects)
{
if (p.CompletedTurn != null || !builders.TryGetValue(p.Id, out var tiers)) continue;
diff --git a/sim/Statecraft.Sim/MapActions.cs b/sim/Statecraft.Sim/MapActions.cs
index 5a9d79c8b..db66d2233 100644
--- a/sim/Statecraft.Sim/MapActions.cs
+++ b/sim/Statecraft.Sim/MapActions.cs
@@ -103,7 +103,7 @@ namespace Statecraft.Sim
var reason = Check(c, s, action, q, r);
if (reason != null) return reason;
var rule = c.RulesAt(s.Date).MapActions[action];
- if (s.MapActionsTurnDate != s.Date) { s.MapActionsTurnDate = s.Date; s.MapActionsThisTurn = 0; }
+ if (s.MapActionsTurnDate != s.Date) { s.MapActionsTurnDate = s.Date; s.MapActionsThisTurn = 0; s.CityStartsThisTurn.Clear(); }
s.MapActionsThisTurn++;
s.Placements.RemoveAll(p => p.Q == q && p.R == r);
s.Placements.Add(new Placement(action, q, r, s.Date));
diff --git a/sim/Statecraft.Sim/Projects.cs b/sim/Statecraft.Sim/Projects.cs
index d8cd9d45f..71a7211eb 100644
--- a/sim/Statecraft.Sim/Projects.cs
+++ b/sim/Statecraft.Sim/Projects.cs
@@ -268,6 +268,16 @@ namespace Statecraft.Sim
static string Refused(string format, params object[] values) => string.Format(System.Globalization.CultureInfo.InvariantCulture, format, values);
+ /// <summary>R-PROJ-001 under gdd-0.3 only (#1700 slice B; owner, 3 November 2026: "One per city, plus 2 nationally"):
+ /// the city projects one city may start in a turn. A design value from that ruling, not construction.starts_per_turn
+ /// (content/gdd03-balance.yaml), whose 1 is Amir's nationwide catalogue reading; map_actions_per_turn stays the
+ /// national limit.</summary>
+ public const int Gdd03CityStartsPerTurn = 1;
+
+ /// <summary>R-PROJ-001 under gdd-0.3: the city_cap refusal, formatted with the settlement's name ({0}). The English is
+ /// what a turn's Rejected list and a save carry; the UI words it in its language (SimBridge.ReasonText).</summary>
+ public const string RefusedCityCap = "{0} has started a city project this turn";
+
/// <summary>The city project at hex (q, r), being built or built, or null (Q-PROJ-2: one project or placement a hex).</summary>
public static CityProject? CityProjectAt(GameState s, int q, int r) => s.CityProjects.Values.FirstOrDefault(p => p.Q == q && p.R == r);
@@ -275,14 +285,16 @@ namespace Statecraft.Sim
/// (q, r) now, else the reason. Refused for an unknown kind or city; a kind whose resource the city lacks (R-PROJ-005); a
/// transit camp without the ma'abarot policy (Q-HOUSE-3, D-D3: the policy carries its sourced date); a hex that is not
/// land, is further than map_action_max_distance from the city's settlement hex, or holds a placement or another city
- /// project (Q-PROJ-2); and once map_actions_per_turn city projects were started this turn
- /// (Q-PROJ-4). A short Treasury is not a reason: it borrows (Q-MONEY-3). The reference player asks this before it orders.</summary>
+ /// project (Q-PROJ-2); under gdd-0.3, once the city started <see cref="Gdd03CityStartsPerTurn"/> this turn; and once
+ /// map_actions_per_turn city projects were started this turn (Q-PROJ-4). A short Treasury is not a reason: it borrows
+ /// (Q-MONEY-3). The reference player asks this before it orders.</summary>
public static string? CheckCity(Content c, GameState s, string kind, string city, int q, int r) => CheckCityReason(c, s, kind, city, q, r)?.Text;
/// <summary><see cref="CheckCity"/>'s one validator (#1122, owner ruling 2): null when the project may be started, else a
/// stable kind and invariant values for a UI to word in its language (the map actions' pattern), plus the English text.
/// The kinds, in check order: unknown_kind, unknown_city, locked (kind), maabarot_policy, no_resource (city, resource, kind), not_land,
- /// too_far (distance, city), occupied (the placement's action), occupied_project (the project's kind), turn_cap (cap).</summary>
+ /// too_far (distance, city), occupied (the placement's action), occupied_project (the project's kind), city_cap (city;
+ /// gdd-0.3 only), turn_cap (cap).</summary>
public static MapActionReason? CheckCityReason(Content c, GameState s, string kind, string city, int q, int r)
{
var k = c.ProjectKinds.FirstOrDefault(x => x.Id == kind);
@@ -308,6 +320,11 @@ namespace Statecraft.Sim
return new MapActionReason("occupied", $"This hex already has {PlayerText.MapAction(c, placed.Action)}", placed.Action);
if (CityProjectAt(s, q, r) is CityProject other)
return new MapActionReason("occupied_project", $"This hex already has {c.ProjectKinds.First(x => x.Id == other.Kind).Name}", other.Kind);
+ // R-PROJ-001 under gdd-0.3 (owner, 3 November 2026: "One per city, plus 2 nationally"): the city's own limit,
+ // before the national one, so a player over both sees the city's reason.
+ if (c.Ruleset == SaveGame.Gdd03Ruleset && s.MapActionsTurnDate == s.Date
+ && s.CityStartsThisTurn.TryGetValue(city, out var started) && started >= Gdd03CityStartsPerTurn)
+ return new MapActionReason("city_cap", string.Format(System.Globalization.CultureInfo.InvariantCulture, RefusedCityCap, name), city);
// Last, as for map actions, so a player over the cap still sees the specific reason an order is illegal. The count
// is the map actions' own (one national limit, Q-PROJ-4).
if ((s.MapActionsTurnDate == s.Date ? s.MapActionsThisTurn : 0) >= rules.MapActionsPerTurn)
@@ -345,8 +362,10 @@ namespace Statecraft.Sim
var reason = CheckCity(c, s, kind, city, q, r);
if (reason != null) return reason;
var k = c.ProjectKinds.First(x => x.Id == kind);
- if (s.MapActionsTurnDate != s.Date) { s.MapActionsTurnDate = s.Date; s.MapActionsThisTurn = 0; }
+ if (s.MapActionsTurnDate != s.Date) { s.MapActionsTurnDate = s.Date; s.MapActionsThisTurn = 0; s.CityStartsThisTurn.Clear(); }
s.MapActionsThisTurn++;
+ if (c.Ruleset == SaveGame.Gdd03Ruleset) // R-PROJ-001: the city's start, gdd-0.3 only, so no other ruleset's hash moves
+ s.CityStartsThisTurn[city] = s.CityStartsThisTurn.TryGetValue(city, out var n) ? n + 1 : 1;
var name = PlayerText.Settlement(c, city);
EconomySystem.PayOrBorrow(c, s, k.Cost, "to build " + k.Name, why, CauseKeys.Purpose.Project, k.Id);
var id = s.NextId++;
@@ -368,6 +387,7 @@ namespace Statecraft.Sim
if (p.BuiltOn != null) return $"{PlayerText.Capitalised(k.Name)} is already built";
s.CityProjects.Remove(project);
why.Add(new Cause("city", p.City, -1, $"{PlayerText.Settlement(c, p.City)}: {k.Name} was cancelled; the Money spent is not returned", key: CauseKeys.ProjectCancelled, args: new[] { k.Id }));
+ if (p.Builder) BuilderFreed(c, p, k, why);
return null;
}
@@ -406,10 +426,19 @@ namespace Statecraft.Sim
why.Add(new Cause("city", city, 1, $"{name}: a builder started on {k.Name}", key: CauseKeys.ProjectBuilder, args: new[] { k.Id }));
}
else
- foreach (var p in building.Where(p => p.Builder).Reverse().Take(builders - count)) s.CityProjects[p.Id] = p.WithBuilder(false);
+ foreach (var p in building.Where(p => p.Builder).Reverse().Take(builders - count))
+ {
+ s.CityProjects[p.Id] = p.WithBuilder(false);
+ BuilderFreed(c, p, c.ProjectKinds.First(y => y.Id == p.Kind), why);
+ }
return null;
}
+ /// <summary>R-CITY-011 (#1700 slice B, slice A's NIT-1): the Why line for a builder freed from project
+ /// <paramref name="p"/> of kind <paramref name="k"/>, as it is built or cancelled or the build count falls.</summary>
+ static void BuilderFreed(Content c, CityProject p, ProjectKind k, List<Cause> why) =>
+ why.Add(new Cause("city", p.City, -1, $"{PlayerText.Settlement(c, p.City)}: a builder left {k.Name} and is free again", key: CauseKeys.ProjectBuilderFreed, args: new[] { k.Id }));
+
/// <summary>R-PROJ-003, step 5 of the turn (D-A6), after the pioneer work: in ascending id, each city project being built
/// has one turn less to go. One that reaches 0 is built on <paramref name="next"/>, the turn's end date, and adds its
/// kind's housing capacity, condition (kept from 0 to 1) and job slots to its city, once: a built project is never
@@ -451,6 +480,7 @@ namespace Statecraft.Sim
var condition = city.Condition is double now ? Math.Min(1.0, Math.Max(0.0, now + k.Condition)) : (double?)null;
s.Cities[p.City] = new City(city.Id, city.HousingCapacity + k.Capacity, city.JobSlots + k.JobSlots, city.Civilians, city.Employed, city.Refugees, city.Recruits, condition, city.Craftsmen, city.JobsDefault, city.Qualified);
why.Add(new Cause("city", p.City, 1, $"{PlayerText.Settlement(c, p.City)}: {k.Name} was finished", key: CauseKeys.ProjectCompleted, args: new[] { k.Id }));
+ if (p.Builder) BuilderFreed(c, p, k, why);
}
}
}
diff --git a/unity/Assets/Scripts/UI/CauseText.cs b/unity/Assets/Scripts/UI/CauseText.cs
index 1e9d8810c..ab3581995 100644
--- a/unity/Assets/Scripts/UI/CauseText.cs
+++ b/unity/Assets/Scripts/UI/CauseText.cs
@@ -89,7 +89,7 @@ namespace Statecraft.Game.UI
// #1682: these branches use captured ids, values and resident flags, never the live GameState.
static readonly HashSet<string> RemainingKeys = new HashSet<string>
{
- CauseKeys.WorkersAssigned, CauseKeys.WagesPaid, CauseKeys.ImmigrantsHoused, CauseKeys.HousingShortage, CauseKeys.ImmigrantsWaiting, CauseKeys.RecruitsVeteran, CauseKeys.CorridorStarted, CauseKeys.CorridorCancelled, CauseKeys.CorridorCompleted, CauseKeys.PioneersVeteran, CauseKeys.MapBorrowed, CauseKeys.MapBuilt, CauseKeys.LandWorkStarted, CauseKeys.SiteStarted, CauseKeys.SiteCancelled, CauseKeys.SiteCompleted, CauseKeys.ProjectStarted, CauseKeys.ProjectCancelled, CauseKeys.ProjectCompleted, CauseKeys.ProjectBuilder, CauseKeys.ProjectWaiting, CauseKeys.ArmsBought, CauseKeys.WorkshopWorkers, CauseKeys.WorkshopArms, CauseKeys.WorkshopPaused, CauseKeys.DollarsConverted, CauseKeys.FoodHarvest, CauseKeys.FoodShortage, CauseKeys.FoodWithoutImports, CauseKeys.PrisonerFood, CauseKeys.PrisonerFoodShortage, CauseKeys.CraftsmenReturned, CauseKeys.CraftsmenReassigned, CauseKeys.PioneerReturned, CauseKeys.PioneersReassigned, CauseKeys.TrainingStarted, CauseKeys.TrainingArms, CauseKeys.TrainingCancelled, CauseKeys.TrainingArmsReturned, CauseKeys.ReplacementsStopped, CauseKeys.ReplacementsJoined, CauseKeys.MilitaryTrained, CauseKeys.PioneersTrained, CauseKeys.CraftsmenTrained, CauseKeys.Appointed, CauseKeys.Reshuffle, CauseKeys.AppointmentsEnded, CauseKeys.ApprovalStability, CauseKeys.CoalitionCollapsed, CauseKeys.LegislatureConvened, CauseKeys.GovernmentTookOffice, CauseKeys.CoalitionChanged, CauseKeys.EraEnded, CauseKeys.AdvisoryPolicyRejected, CauseKeys.PolicyRejected, CauseKeys.PolicySet, CauseKeys.AdvisoryBudgetRejected, CauseKeys.BudgetRejected, CauseKeys.PlaceCaptured, CauseKeys.EnemyRegained, CauseKeys.PlaceAnnexed, CauseKeys.PlaceWithdrawn, CauseKeys.PlaceDeported, CauseKeys.DeportEffect, CauseKeys.DeportCost, CauseKeys.OccupationStarted, CauseKeys.PendingBecameRaid, CauseKeys.OccupationLostUnit, CauseKeys.OccupationCountdown, CauseKeys.DepopulationSupport
+ CauseKeys.WorkersAssigned, CauseKeys.WagesPaid, CauseKeys.ImmigrantsHoused, CauseKeys.HousingShortage, CauseKeys.ImmigrantsWaiting, CauseKeys.RecruitsVeteran, CauseKeys.CorridorStarted, CauseKeys.CorridorCancelled, CauseKeys.CorridorCompleted, CauseKeys.PioneersVeteran, CauseKeys.MapBorrowed, CauseKeys.MapBuilt, CauseKeys.LandWorkStarted, CauseKeys.SiteStarted, CauseKeys.SiteCancelled, CauseKeys.SiteCompleted, CauseKeys.ProjectStarted, CauseKeys.ProjectCancelled, CauseKeys.ProjectCompleted, CauseKeys.ProjectBuilder, CauseKeys.ProjectBuilderFreed, CauseKeys.ProjectWaiting, CauseKeys.ArmsBought, CauseKeys.WorkshopWorkers, CauseKeys.WorkshopArms, CauseKeys.WorkshopPaused, CauseKeys.DollarsConverted, CauseKeys.FoodHarvest, CauseKeys.FoodShortage, CauseKeys.FoodWithoutImports, CauseKeys.PrisonerFood, CauseKeys.PrisonerFoodShortage, CauseKeys.CraftsmenReturned, CauseKeys.CraftsmenReassigned, CauseKeys.PioneerReturned, CauseKeys.PioneersReassigned, CauseKeys.TrainingStarted, CauseKeys.TrainingArms, CauseKeys.TrainingCancelled, CauseKeys.TrainingArmsReturned, CauseKeys.ReplacementsStopped, CauseKeys.ReplacementsJoined, CauseKeys.MilitaryTrained, CauseKeys.PioneersTrained, CauseKeys.CraftsmenTrained, CauseKeys.Appointed, CauseKeys.Reshuffle, CauseKeys.AppointmentsEnded, CauseKeys.ApprovalStability, CauseKeys.CoalitionCollapsed, CauseKeys.LegislatureConvened, CauseKeys.GovernmentTookOffice, CauseKeys.CoalitionChanged, CauseKeys.EraEnded, CauseKeys.AdvisoryPolicyRejected, CauseKeys.PolicyRejected, CauseKeys.PolicySet, CauseKeys.AdvisoryBudgetRejected, CauseKeys.BudgetRejected, CauseKeys.PlaceCaptured, CauseKeys.EnemyRegained, CauseKeys.PlaceAnnexed, CauseKeys.PlaceWithdrawn, CauseKeys.PlaceDeported, CauseKeys.DeportEffect, CauseKeys.DeportCost, CauseKeys.OccupationStarted, CauseKeys.PendingBecameRaid, CauseKeys.OccupationLostUnit, CauseKeys.OccupationCountdown, CauseKeys.DepopulationSupport
};
static string Remaining(Cause cause, Content c, UiText text, IReadOnlyDictionary<string, string>? namesHe)
@@ -153,6 +153,7 @@ namespace Statecraft.Game.UI
case CauseKeys.ProjectCompleted:
return text.Format(key, Settlement(cause.Target), ContentNames.Of(text, c.ProjectKinds.First(x => x.Id == A(0))));
case CauseKeys.ProjectBuilder: // R-CITY-011 (#1700)
+ case CauseKeys.ProjectBuilderFreed:
return text.Format(key, Settlement(cause.Target), ContentNames.Of(text, c.ProjectKinds.First(x => x.Id == A(0))));
case CauseKeys.ProjectWaiting: // R-PROJ-003: why.cause.project_waiting.<Projects.NoBuilder or .NoWorker>
return text.Format(key + "." + A(1), Settlement(cause.Target), ContentNames.Of(text, c.ProjectKinds.First(x => x.Id == A(0))));
diff --git a/unity/Assets/Scripts/UI/GddHexPanel.cs b/unity/Assets/Scripts/UI/GddHexPanel.cs
index b52e9d999..ddf1f302a 100644
--- a/unity/Assets/Scripts/UI/GddHexPanel.cs
+++ b/unity/Assets/Scripts/UI/GddHexPanel.cs
@@ -448,6 +448,7 @@ namespace Statecraft.Game.UI
case "occupied": return text.Format("info.map_action_reason.occupied", text["info.map_action." + reason.Values[0]]);
case "no_resource": return text.Format("city.project_reason.no_resource", townName(reason.Values[0]), ResourceName(text, reason.Values[1]),
ContentNames.Of(text, c.ProjectKinds.First(x => x.Id == reason.Values[2])));
+ case "city_cap": return text.Format("city.project_reason.city_cap", townName(reason.Values[0])); // R-PROJ-001, gdd-0.3 (#1700)
case "turn_cap": return text.Format("city.project_reason.turn_cap", int.Parse(reason.Values[0], CultureInfo.InvariantCulture));
default: return reason.Text;
}
diff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.cs
index c27601f54..0f2e4f9fb 100644
--- a/unity/Assets/Scripts/UI/SimBridge.cs
+++ b/unity/Assets/Scripts/UI/SimBridge.cs
@@ -268,6 +268,8 @@ namespace Statecraft.Game.UI
(Workshops.RefusedBuilt, "workshop.refused_built"),
(Workshops.RefusedPeople, "workshop.refused_people"),
(Workshops.RefusedPeopleNoJob, "workshop.refused_people_no_job"),
+ // R-PROJ-001 under gdd-0.3 (#1700 slice B): a second city project start in one city in one turn.
+ (Projects.RefusedCityCap, "city.project_reason.city_cap"),
}.Select(x => (new Regex("^" + string.Join("(.+?)", Regex.Split(x.format, @"\{\d+\}").Select(Regex.Escape)) + "$"), x.key)).ToArray();
/// <summary>A sim refusal in the UI's language where it has a string (<see cref="ReasonKeys"/>, <see cref="ReasonFormats"/>),
diff --git a/unity/Assets/Tests/EditMode/CauseTextTests.cs b/unity/Assets/Tests/EditMode/CauseTextTests.cs
index 24e1594b4..c92ca5853 100644
--- a/unity/Assets/Tests/EditMode/CauseTextTests.cs
+++ b/unity/Assets/Tests/EditMode/CauseTextTests.cs
@@ -438,6 +438,7 @@ public class CauseTextTests
new Cause("draft", "town", -1, "Town: Housing was cancelled; the Money spent is not returned", key: CauseKeys.ProjectCancelled, args: new[] { "housing" }),
new Cause("draft", "town", 1, "Town: Housing was finished", key: CauseKeys.ProjectCompleted, args: new[] { "housing" }),
new Cause("draft", "town", 1, "Town: a builder started on Housing", key: CauseKeys.ProjectBuilder, args: new[] { "housing" }), // #1700
+ new Cause("draft", "town", -1, "Town: a builder left Housing and is free again", key: CauseKeys.ProjectBuilderFreed, args: new[] { "housing" }), // #1700 slice B
new Cause("draft", "town", 0, "Town: Housing waits: no builder", key: CauseKeys.ProjectWaiting, args: new[] { "housing", Projects.NoBuilder }),
new Cause("draft", "arms", 2000000000, "Bought 2000000000 Arms, cost IL\u00A01.3m", key: CauseKeys.ArmsBought, args: new[] { "1.25" }),
new Cause("draft", "town", 2, "Town: arms workshops staffed: 2", key: CauseKeys.WorkshopWorkers, args: new[] { "2" }),
diff --git a/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs b/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs
index 3027011d9..4dd73845b 100644
--- a/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs
+++ b/unity/Assets/Tests/EditMode/CityProjectPanelTests.cs
@@ -512,6 +512,41 @@ public class WorkshopPanelTests
}
}
+ // R-PROJ-001 under gdd-0.3 (#1700 slice B): the city's one start a turn, worded in the UI's language on both paths a player
+ // meets it: the end of turn's refusal (SimBridge.ReasonText, as the toast shows it) and the panel's line once the city has
+ // started this turn (GddHexPanel.ReasonText). The town is named in the UI's language; the English is the sim's own.
+ [Test]
+ public void TheCityCapRefusalShowsInBothLanguages([Values] bool hebrew)
+ {
+ var t = hebrew ? He : En;
+ var expected = t.Format("city.project_reason.city_cap", hebrew ? TownsHe[City] : Towns[City]);
+
+ // The end of turn: two industry starts for Haifa in one turn; the sim refuses the second.
+ var s = GameSession.New(C03, GoldenRun.Seed, Mode.Historical).State;
+ var hexes = C03.Hexes.Where(h => h.Land && Projects.CheckCityReason(C03, s, "industry", City, h.Q, h.R) == null).Take(2).ToList();
+ Assert.AreEqual(2, hexes.Count, "precondition: two hexes Haifa may build on");
+ var reason = Simulation.Step(C03, s, hexes.Select(h => (Command)new StartProject("industry", City, h.Q, h.R)).ToArray()).Rejected.Single().Reason;
+ Assert.AreEqual(string.Format(System.Globalization.CultureInfo.InvariantCulture, Projects.RefusedCityCap, PlayerText.Settlement(C03, City)), reason,
+ "precondition: the sim's city_cap");
+ Assert.AreEqual(expected, SimBridge.ReasonText(t, reason, C03, TownsHe));
+ if (!hebrew) Assert.AreEqual(reason, expected, "the English string is the sim's own");
+
+ // The panel: Haifa has used its start this turn, so every kind it could build is refused for that one reason (the
+ // winery's missing vineyards aside), said once with no buttons.
+ var (q, r) = Hex(C03);
+ var g = GameSession.New(C03, GoldenRun.Seed, Mode.Historical);
+ g.State.Policies[MapActions.MaabarotPolicy] = 1; // so the transit camp is refused for the shared reason too
+ g.State.MapActionsTurnDate = g.State.Date;
+ g.State.CityStartsThisTurn[City] = 1;
+ var bridge = new SimBridge(g, t) { TownNamesHe = TownsHe };
+ Assert.AreEqual("city_cap", Projects.CheckCityReason(C03, bridge.State, "housing", City, q, r)?.Kind, "precondition: the sim refuses it");
+ using var ui = new UiTestKit();
+ using var panel = Panel(ui, bridge, t);
+ panel.Show(q, r);
+ Assert.AreEqual(expected, ui.Q<Label>("city-project-reason").text);
+ Assert.IsNull(ui.Root.Q("city-project-housing"), "refused for all alike: no buttons");
+ }
+
// R-ARMS-006, R-ARMS-007, R-CITY-010: a staffed workshop's cycle under way (staffed months of workshop.staffed_turns and
// the Money paid), the pause while the enemy holds its city, and the last turn's pauses for its city as the Why screen
// words them; with no cycle, the next cycle's price at its worker's tier.
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index 487f4cd91..8f0ad8ac9 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -807,6 +807,8 @@ city.project_reason.no_resource: "{0} has no {1} for {2}"
# key only (HebrewOverlay.Bindings), and a nested record has no such key. Without an entry the id stands.
city.resource.vineyards: "vineyards"
city.project_reason.turn_cap: "No more than {0} city projects in one turn"
+# #1700 slice B, gdd-0.3 only (R-PROJ-001; owner, 3 November 2026: "One per city, plus 2 nationally"): {0} the city.
+city.project_reason.city_cap: "{0} has started a city project this turn"
# The toggle that folds a city's own projects on a stacked bar or a short window (owner ruling on #1150).
city.projects_toggle: "City projects ({0})"
# #1722 slice E (#1701; R-ARMS-005 to R-ARMS-007), gdd-0.3 only: a built arms workshop's part of the info panel. The
@@ -1090,6 +1092,7 @@ why.cause.project_cancelled: "{0}: {1} was cancelled; the Money spent is not ret
why.cause.project_completed: "{0}: {1} was finished"
# The gdd-0.3 builders (#1700; R-CITY-011, R-PROJ-003).
why.cause.project_builder: "{0}: a builder started on {1}"
+why.cause.project_builder_freed: "{0}: a builder left {1} and is free again"
why.cause.project_waiting.no_builder: "{0}: {1} waits: no builder"
why.cause.project_waiting.no_worker: "{0}: {1} waits: no person without a job is left for its builder"
why.cause.arms_bought: "Bought {0} Arms, cost {1}"
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index 06c979d2c..0914d1417 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -893,6 +893,9 @@ city.project_reason.no_resource: "ב{0} אין {1} עבור {2}"
city.resource.vineyards: "כרמים"
# turn_cap: approved by Beri, a native speaker, on #1267 (21 Oct 2026).
city.project_reason.turn_cap: "אי אפשר להתחיל יותר מ־{0} מיזמים עירוניים בתור אחד"
+# #1700 slice B, gdd-0.3 only (R-PROJ-001), {0} the city, as the workshop refusals ("{0}: ...").
+# Agent-drafted Hebrew; native review pending (#564). No verb agrees with {0} (HE-15).
+city.project_reason.city_cap: "{0}: כבר יש התחלת מיזם עירוני בתור הזה"
# The toggle that folds a city's own projects on a stacked bar or a short window (owner ruling on #1150), {0} the
# number of kinds. For the native reviewer (#564).
city.projects_toggle: "מיזמי העיר ({0})"
@@ -1230,11 +1233,13 @@ why.cause.project_cancelled: "{0}: ביטול {1}; הכסף שהוצא לא יו
why.cause.project_completed: "{0}: סיום {1}"
# The gdd-0.3 builders (#1700; R-CITY-011, R-PROJ-003). Agent-drafted Hebrew: native-review-pending (#564).
# native-review-pending
-why.cause.project_builder: "{0}: בונה החל לעבוד על {1}"
+why.cause.project_builder: "{0}: תחילת עבודת בונה על {1}"
+# native-review-pending
+why.cause.project_builder_freed: "{0}: שחרור בונה מהעבודה על {1}"
# native-review-pending
why.cause.project_waiting.no_builder: "{0}: העבודה על {1} ממתינה: אין בונה"
# native-review-pending
-why.cause.project_waiting.no_worker: "{0}: העבודה על {1} ממתינה: לא נותר אדם ללא משרה שיבנה"
+why.cause.project_waiting.no_worker: "{0}: העבודה על {1} ממתינה: לא נותר אדם ללא משרה לבנייה"
why.cause.arms_bought: "נשק שנרכש: {0}, עלות {1}"
# The gdd-0.3 arms workshops (#1701; R-ARMS-005, R-ARMS-006). Agent-drafted Hebrew; native review pending (#564).
why.cause.workshop_workers: "{0}: סדנאות נשק מאוישות: {1}"