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: GDD 0.3 housing repair, a city project on the city's own hex (Refs #1700, Refs #1703) (#2409)

Eyal Golanb91f8c13bb0e
diff --git a/changelog.d/1700-housing-repair.md b/changelog.d/1700-housing-repair.md
new file mode 100644
index 000000000..0b25edc5a
--- /dev/null
+++ b/changelog.d/1700-housing-repair.md
@@ -0,0 +1,7 @@
+- GDD 0.3 housing repairs in the sim (Refs #1700, #1703): under the gdd-0.3 ruleset only, a city can order a housing
+ repair, a city project costing 0.5 Money and 1 work (borrowing the shortfall) that raises its housing condition by
+ 10 percentage points, never above the maximum. It uses the turn's city start and needs a builder like any project.
+ It is done on the city's own hex and needs no free hex, so a city whose nearby hexes are all built on can still
+ repair, and it leaves no building. The current game (gdd-0.1) is unchanged. Its Hebrew name is owner-approved
+ (3 November 2026, #564); its Hebrew refusal is an agent draft awaiting a native read. Older saves show the
+ "different game content" notice.
diff --git a/content/projects.yaml b/content/projects.yaml
index a974b6ed8..2b2830ee7 100644
--- a/content/projects.yaml
+++ b/content/projects.yaml
@@ -19,6 +19,14 @@
# arms_workshop cost 15 and work 3). Built, it gives one workshop worker slot (`worker_slots`, the catalogue's 1) and no
# housing, condition or job slots. Its cycle (R-ARMS-006) reads workshop.staffed_turns and workshop.cost there; the
# owner's rulings 27M-11 to 27M-14 and Q55 are in docs/rules/mvp.md R-ARMS-004 to R-ARMS-007.
+# housing_repair: GDD 0.3 only (R-HOUSE-006, #1700, #1703): 0.5 Money and 1 work (maintainer call (not an owner ruling):
+# 1 work is one turn of work, as arms_workshop's work 3 is its 3 turns) for +10 percentage points of the city's
+# housing condition (owner, 1 November 2026: "Fixed price 0.5 Money + 1 work"; docs/GDD.md "Housing repair price";
+# gdd03-balance.yaml housing_repair cost 0.5, work 1, condition_pp 10, which the loader checks). No capacity or job
+# slots. It is done on the city's own hex and takes no hex of its own, so it is left as no record once done (owner,
+# 3 November 2026: "No hex needed (Recommended)").
+# Its name_he "שיפוץ דיור": native review: owner, 3 Nov 2026 ("Approve 'שיפוץ דיור'", recorded on #564,
+# https://github.com/eyalgolan/statecraft-israel/issues/564#issuecomment-6611646005).
# name: the phrase the player reads in a sentence ("a transit camp").
# name_he: the Hebrew UI's noun for the kind (#1122, owner ruling 3), optional: without it the Hebrew UI shows `name`.
# Draft wording, not a native-language approval: name_he_review: agent-checked until a native speaker reviews it.
@@ -29,3 +37,4 @@ projects:
- { id: industry, name: an industry project, name_he: מיזם תעשייה, name_he_review: agent-checked, cost: 2, turns: 6, capacity: 0, condition: 0, job_slots: 5 } # DESIGN VALUE: owner-set balance, not a historical figure (D-C6, D-A3; Q-PROJ-1: job slots)
- { id: winery, name: a winery, name_he: יקב, name_he_review: agent-checked, cost: 2, turns: 6, capacity: 0, condition: 0, job_slots: 10, requires: vineyards } # DESIGN VALUE: owner-set balance, not a historical figure (D-D8, D-C6; Q-SPEC-2: the specialised industry)
- { id: arms_workshop, name: an arms workshop, name_he: סדנת נשק, name_he_review: agent-checked, cost: 15, turns: 3, capacity: 0, condition: 0, job_slots: 0, worker_slots: 1, rulesets: [gdd-0.3] } # DESIGN VALUE: owner-set balance, not a historical figure (D-G6, D-A3; #1701 OQ2, owner 2 November 2026: IL 15m and 3 turns, the recommended option)
+ - { id: housing_repair, name: a housing repair, name_he: שיפוץ דיור, name_he_review: agent-checked, cost: 0.5, turns: 1, capacity: 0, condition: 0.1, job_slots: 0, rulesets: [gdd-0.3] } # DESIGN VALUE: owner-set balance, not a historical figure (D-D2, D-C6, D-A3; #1700, #1703; owner 1 November 2026: "Fixed price 0.5 Money + 1 work", docs/GDD.md "Housing repair price")
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 6284204b6..308704237 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -132,7 +132,7 @@ For R-HOUSE-001, the preceding legacy/gdd-0.1 wording remains unchanged. The ina
R-HOUSE-002: A city's overflow is `max(0, housed - housing_capacity)`, one capacity point housing one population unit (D-D1, Q-HOUSE-1, owner, 15 October 2026). On the housing step, after R-CITY-004 and before Social cohesion (D-A6), a city with overflow loses `overflow_condition_loss * overflow / housed` of its condition, never below 0; a city without overflow keeps its condition. `overflow_condition_loss` is 0.15, a design value. The loader requires both values, from 0 to 1. Overflow reaches Social cohesion through R-HOUSE-004 (a lower condition lowers the base of the national `housing` indicator) and the existing `homes_lift_morale` link (k 0.15) from `housing` into `morale`, which is Social cohesion (R-NAT-001); there is no direct overflow term (Q-HOUSE-1, decided by the owner 15 October 2026, plan:165 of `docs/superpowers/plans/2026-10-15-gdd-phase-3.md`: cohesion follows through the existing `housing` to `morale` link, "so it needs no number of its own"; the cohesion half was built after #728, merged as #857, owner 17 October 2026).
-For R-HOUSE-002, inactive gdd-0.3 synthetic arithmetic prices the surcharge as `SurchargeResidents * max(0, money_threshold - ConditionBefore) * money_slope`, then subtracts overflow and unpaid-upkeep losses and clamps condition. Overflow loss is `(overflow_deterioration / 100) * max(0, PreArrivalResidents - Capacity) / PreArrivalResidents`; unpaid loss is `(max_deterioration / 100) * (UpkeepDue - UpkeepPaid) / UpkeepDue`. Zero pre-arrival residents or zero upkeep due gives zero for the respective loss. The returned cohesion contribution is `max_cohesion_loss * (CohesionResidents / OwnPopulation) * max(0, (cohesion_threshold - ConditionAfter) / cohesion_threshold)`, zero with no own population. It is displayed points, not an indicator write or a national summation (`sim/Statecraft.Sim/Gdd03HousingFormula.cs:65-85@7ec122145`; worked-number, distinct-count, post-deterioration and zero-denominator fixtures in `sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs:16-75@7ec122145`). Source: `docs/gdd/cities.md:29-35@605277dfa511dc512562ececeb273b8393b21d35`; #1703 says, "Price the surcharge from pre-deterioration condition, then deteriorate once, then apply cohesion once." Under `gdd-0.3` this arithmetic is now live, per city, as R-HOUSE-005 (#1703); under `gdd-0.1` and legacy the preceding active rule (0.15) is unchanged. Repairs (#1700) and monthly snapshot timing (#1716) remain pending.
+For R-HOUSE-002, inactive gdd-0.3 synthetic arithmetic prices the surcharge as `SurchargeResidents * max(0, money_threshold - ConditionBefore) * money_slope`, then subtracts overflow and unpaid-upkeep losses and clamps condition. Overflow loss is `(overflow_deterioration / 100) * max(0, PreArrivalResidents - Capacity) / PreArrivalResidents`; unpaid loss is `(max_deterioration / 100) * (UpkeepDue - UpkeepPaid) / UpkeepDue`. Zero pre-arrival residents or zero upkeep due gives zero for the respective loss. The returned cohesion contribution is `max_cohesion_loss * (CohesionResidents / OwnPopulation) * max(0, (cohesion_threshold - ConditionAfter) / cohesion_threshold)`, zero with no own population. It is displayed points, not an indicator write or a national summation (`sim/Statecraft.Sim/Gdd03HousingFormula.cs:65-85@7ec122145`; worked-number, distinct-count, post-deterioration and zero-denominator fixtures in `sim/Statecraft.Sim.Tests/Gdd03HousingFormulaTests.cs:16-75@7ec122145`). Source: `docs/gdd/cities.md:29-35@605277dfa511dc512562ececeb273b8393b21d35`; #1703 says, "Price the surcharge from pre-deterioration condition, then deteriorate once, then apply cohesion once." Under `gdd-0.3` this arithmetic is now live, per city, as R-HOUSE-005 (#1703); under `gdd-0.1` and legacy the preceding active rule (0.15) is unchanged. Repairs are R-HOUSE-006 under `gdd-0.3` (#1700); monthly snapshot timing (#1716) remains pending.
R-HOUSE-003: The people who take a city's housing (`housed`) are its civilians, its craftsmen, its recruits and its groups in training, a halutz group included until it becomes a movable unit. Halutz units do not (Q-HOUSE-5, owner, 15 October 2026). Refugees wait for housing and are not in it.
@@ -140,17 +140,19 @@ For R-HOUSE-003, the inactive gdd-0.3 helper takes independently supplied surcha
R-HOUSE-004: In the GDD loop the base of the national `housing` indicator is the people-weighted mean of the cities' housing condition, each city weighed by its housed people (R-HOUSE-003): `sum(condition * housed) / sum(housed)`. Policy effects, map actions and events still act on top, as on any indicator. Decided (owner, 17 Oct 2026, option (a) of Q-PR3-A, relayed on [#855 at 06:33Z](https://github.com/eyalgolan/statecraft-israel/pull/855#issuecomment-6230731177)): the national housing base is the people-weighted mean of city condition, with policy, map actions and events still applied on top. When no city houses anybody the mean is undefined, and the base is `model.yaml`'s. Capacity reaches the level through overflow and condition (R-HOUSE-002).
-R-HOUSE-005: Under `gdd-0.3` only (#1703, the MVP's per-city housing condition), the housing step after R-CITY-004 settles, in #1703's order ("Price the surcharge from pre-deterioration condition, then deteriorate once, then apply cohesion once."), for every city with a condition, with R its housed people (R-HOUSE-003) and P all own population (every city's housed people and refugees plus the strength of every player unit, halutz units included): (1) a surcharge of `R * max(0, money_threshold - c) * money_slope` Money a turn from the condition c before this turn's deterioration, summed over the cities into one Money line (`housing_surcharge`) and borrowed when the Treasury is short (R-MONEY-003); `money_threshold` is 0.50 and `money_slope` is 0.1 Money per housed population unit (owner, 2 November 2026: "Scale it to unit size (Recommended)"; the option read: "0.1 per unit (as #2112 did for Industry), about 7.6 Money a turn at start."), so the shipped census start charges 511 housed units x 0.15 x 0.1 = 7.665 Money on the opening turn; (2) overflow deterioration of `overflow_deterioration * max(0, R - housing_capacity) / R` percentage points (5 pp; owner, 2 November 2026: "Yes, 5 pp under GDD 0.3 (Recommended)"), never below 0, in place of R-HOUSE-002's `overflow_condition_loss`; zero housed loses nothing; (3) a Social cohesion loss of `max_cohesion_loss * sum((R / P) * max(0, (cohesion_threshold - c') / cohesion_threshold))` displayed points (`max_cohesion_loss` 2, `cohesion_threshold` 0.25; owner, 2 November 2026: "Keep the 2-point loss (Recommended)") from the condition c' after deterioration, applied once to `morale` through its permanent shift with one cause line (`housing_cohesion`); zero own population loses nothing. The legacy `homes_lift_morale` link from `housing` into `morale` adds nothing under `gdd-0.3`, so housing lowers Social cohesion only through (3) (#1703 Done-when, with #1715; the Food term stays #1715's). There is no housing upkeep (27M-17, IL 0m), so no unpaid-upkeep deterioration. Values: `content/gdd03-balance.yaml` (`housing.*`), read by `Gdd03HousingFormula`; code: `Cities.UpdateCondition` and `Cities.SettleGdd03`, `EffectsSystem.RetiredGdd03Link`; tests: `Gdd03HousingConditionTests`, `Gdd03MoneyLedgerTests`. The issue's three rules run under `gdd-0.3`: the 5 pp overflow (owner, 2 November 2026: "Yes, 5 pp under GDD 0.3 (Recommended)") and the cohesion term (owner, 2 November 2026: "Keep the 2-point loss (Recommended)"; the option read: "As issue #1703 specifies, GDD 0.3 only."). P is the 12 cities' people as built, plus the player units (owner, 2 November 2026: "The 12 cities' people (Recommended)"; the option read: "As built: only the cities whose housing is tracked."). R is counted after the step's housing arrivals (owner, 2 November 2026: "After housing arrivals (Recommended)"; 27M-15). Formations are not housed (owner, 3 November 2026: "Yes, formations not housed (Recommended)", #1703); repairs wait on #1700.
+R-HOUSE-005: Under `gdd-0.3` only (#1703, the MVP's per-city housing condition), the housing step after R-CITY-004 settles, in #1703's order ("Price the surcharge from pre-deterioration condition, then deteriorate once, then apply cohesion once."), for every city with a condition, with R its housed people (R-HOUSE-003) and P all own population (every city's housed people and refugees plus the strength of every player unit, halutz units included): (1) a surcharge of `R * max(0, money_threshold - c) * money_slope` Money a turn from the condition c before this turn's deterioration, summed over the cities into one Money line (`housing_surcharge`) and borrowed when the Treasury is short (R-MONEY-003); `money_threshold` is 0.50 and `money_slope` is 0.1 Money per housed population unit (owner, 2 November 2026: "Scale it to unit size (Recommended)"; the option read: "0.1 per unit (as #2112 did for Industry), about 7.6 Money a turn at start."), so the shipped census start charges 511 housed units x 0.15 x 0.1 = 7.665 Money on the opening turn; (2) overflow deterioration of `overflow_deterioration * max(0, R - housing_capacity) / R` percentage points (5 pp; owner, 2 November 2026: "Yes, 5 pp under GDD 0.3 (Recommended)"), never below 0, in place of R-HOUSE-002's `overflow_condition_loss`; zero housed loses nothing; (3) a Social cohesion loss of `max_cohesion_loss * sum((R / P) * max(0, (cohesion_threshold - c') / cohesion_threshold))` displayed points (`max_cohesion_loss` 2, `cohesion_threshold` 0.25; owner, 2 November 2026: "Keep the 2-point loss (Recommended)") from the condition c' after deterioration, applied once to `morale` through its permanent shift with one cause line (`housing_cohesion`); zero own population loses nothing. The legacy `homes_lift_morale` link from `housing` into `morale` adds nothing under `gdd-0.3`, so housing lowers Social cohesion only through (3) (#1703 Done-when, with #1715; the Food term stays #1715's). There is no housing upkeep (27M-17, IL 0m), so no unpaid-upkeep deterioration. Values: `content/gdd03-balance.yaml` (`housing.*`), read by `Gdd03HousingFormula`; code: `Cities.UpdateCondition` and `Cities.SettleGdd03`, `EffectsSystem.RetiredGdd03Link`; tests: `Gdd03HousingConditionTests`, `Gdd03MoneyLedgerTests`. The issue's three rules run under `gdd-0.3`: the 5 pp overflow (owner, 2 November 2026: "Yes, 5 pp under GDD 0.3 (Recommended)") and the cohesion term (owner, 2 November 2026: "Keep the 2-point loss (Recommended)"; the option read: "As issue #1703 specifies, GDD 0.3 only."). P is the 12 cities' people as built, plus the player units (owner, 2 November 2026: "The 12 cities' people (Recommended)"; the option read: "As built: only the cities whose housing is tracked."). R is counted after the step's housing arrivals (owner, 2 November 2026: "After housing arrivals (Recommended)"; 27M-15). Formations are not housed (owner, 3 November 2026: "Yes, formations not housed (Recommended)", #1703); repairs are R-HOUSE-006.
+
+R-HOUSE-006: Under `gdd-0.3` only (#1700, #1703), a housing repair is the city project `housing_repair` (`content/projects.yaml`): "A repair costs 0.5 Money and 1 work and raises the city's housing condition by 10 percentage points" (`docs/GDD.md`, "Housing repair price"; owner, 1 November 2026: "Fixed price 0.5 Money + 1 work"; labelled design values). Its row matches `content/gdd03-balance.yaml` `housing_repair`, which the loader checks: `cost` 0.5, `work` 1 as `turns: 1` (maintainer call (not an owner ruling): one turn of a builder's work, as `arms_workshop`'s work 3 is its 3 turns), `condition_pp` 10 as `condition: 0.1`, and no capacity or job slots. It is started, paid, built and cancelled as any city project (R-PROJ-001 to R-PROJ-003, R-CITY-010, R-CITY-011): the Treasury pays 0.5 at the start and borrows what it lacks (R-MONEY-003), it uses the turn's city start (one per city, plus `map_actions_per_turn` 2 nationally), it needs a builder to gain its turn of work, the `housing_construction` multiplier (the Labour minister's, `content/rules.yaml`) scales that work as for every housing build (R-MIN-002; maintainer call (not an owner ruling): a repair counts as a Housing build, so with a weak minister it can take more than one turn), and its builder is freed when it is done or cancelled. When done it adds 10 percentage points to its city's condition, never above 1. A repair is done on the city itself and has no hex of its own (owner, 3 November 2026: "No hex needed (Recommended)"; the option read: "Repairs are done on the city itself; they fix existing housing." [#1700](https://github.com/eyalgolan/statecraft-israel/issues/1700#issuecomment-6610259201)). This departs from Q-PROJ-2 for repairs only: a repair is ordered on its city's settlement hex and nowhere else (refused elsewhere as "A housing repair is done on Town A's own hex"), whatever placement or city project that hex holds, and takes the hex from no other project; once done its record leaves the state, so it leaves no building and the hex still shows its own project. Every other kind keeps Q-PROJ-2's free hex. The repair lands on step 5, before R-HOUSE-005's deterioration on the housing step, so a city with overflow can gain less than 10 points in that turn. `gdd-0.1` and legacy have no repair: the loader keeps the row out of them.
## City projects
-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).
+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) and the housing repair (`housing_repair`, R-HOUSE-006). 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). 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-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; a `gdd-0.3` housing repair is on its city's own hex and needs no free hex, R-HOUSE-006); 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).
-R-PROJ-003: On step 5 of the turn (D-A6), after the pioneer work, every city project being built has one turn of work less to go, in ascending id - `1 x m` of one at the system's office multiplier since the ministers (R-MIN-002), the fraction carried on the record as on R-SITE-003. One that reaches 0 is built on the turn's end date and adds its kind's `capacity` to the city's housing capacity, its `condition` to the city's housing condition (kept from 0 to 1, R-HOUSE-001) and its `job_slots` to the city's job slots, once: a built project keeps its record, with its hex, and is never advanced again. `GameState.CityProjects` is hashed as `cproj[...]` only when it has a project (R-LOOP-002). Under gdd-0.3, at step 5 a project gains the turn's progress only when it has a builder and its city still has that person without a job (each project with a builder takes one, in ascending id). A project with no builder waits: its record, turns left and carried fraction stay as they were, as in R-CITY-010, and the Why screen says why ("Town: a housing project waits: no builder", or "... no person without a job is left for its builder"). Money is never an input to progress. A project's builder is written into its hashed record (`;builder`) only when it has one, so no gdd-0.1 hash changes.
+R-PROJ-003: On step 5 of the turn (D-A6), after the pioneer work, every city project being built has one turn of work less to go, in ascending id - `1 x m` of one at the system's office multiplier since the ministers (R-MIN-002), the fraction carried on the record as on R-SITE-003. One that reaches 0 is built on the turn's end date and adds its kind's `capacity` to the city's housing capacity, its `condition` to the city's housing condition (kept from 0 to 1, R-HOUSE-001) and its `job_slots` to the city's job slots, once: a built project keeps its record, with its hex, and is never advanced again (a `gdd-0.3` housing repair has no hex, and its record leaves the state once done, R-HOUSE-006). `GameState.CityProjects` is hashed as `cproj[...]` only when it has a project (R-LOOP-002). Under gdd-0.3, at step 5 a project gains the turn's progress only when it has a builder and its city still has that person without a job (each project with a builder takes one, in ascending id). A project with no builder waits: its record, turns left and carried fraction stay as they were, as in R-CITY-010, and the Why screen says why ("Town: a housing project waits: no builder", or "... no person without a job is left for its builder"). Money is never an input to progress. A project's builder is written into its hashed record (`;builder`) only when it has one, so no gdd-0.1 hash changes.
R-PROJ-004: In the GDD loop a map action (`map_action`, the legacy transit camp or housing placement) is refused with the reason "Map actions are not part of this game: start a city project instead" and its Attention refunded, whatever its action or hex (plan PR 4, spec §1.4: "Placements become completed projects"). So no placement is built and none counts against R-PROJ-001's turn limit. The info panel shows no legacy Build button in the GDD loop. The legacy loop keeps the map actions until that code is deleted (D-E1). The pioneer orders from the map (`pioneer_work`, R-SITE-001) are not map actions.
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index f9c1515d5..3f2ce4edd 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -148,6 +148,12 @@ public partial class DesignValuesTests
("projects.yaml", "projects[arms_workshop].condition"),
("projects.yaml", "projects[arms_workshop].job_slots"),
("projects.yaml", "projects[arms_workshop].worker_slots"),
+ // R-HOUSE-006 (#1700, #1703; owner, 1 November 2026: "Fixed price 0.5 Money + 1 work"): gdd-0.3 only.
+ ("projects.yaml", "projects[housing_repair].cost"),
+ ("projects.yaml", "projects[housing_repair].turns"),
+ ("projects.yaml", "projects[housing_repair].capacity"),
+ ("projects.yaml", "projects[housing_repair].condition"),
+ ("projects.yaml", "projects[housing_repair].job_slots"),
// Movement (Phase 5 PR 5, #744; Q-MOVE-1, Q-MOVE-3): agent-proposed under "Take all recommendations" (#375).
("rules.yaml", "attention_cost.move"),
("rules.yaml", "mvp.move_cost.coastal_plain"),
diff --git a/sim/Statecraft.Sim.Tests/Gdd03HousingRepairTests.cs b/sim/Statecraft.Sim.Tests/Gdd03HousingRepairTests.cs
new file mode 100644
index 000000000..a5216eae7
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/Gdd03HousingRepairTests.cs
@@ -0,0 +1,232 @@
+using System;
+using System.IO;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>#1700 with #1703 (GDD 0.3 housing repairs), under gdd-0.3 only: R-HOUSE-006. A repair is a city project costing
+/// 0.5 Money and 1 work that raises its city's housing condition by 10 percentage points, never above the maximum, and uses
+/// the turn's city start (owner, 1 November 2026: "Fixed price 0.5 Money + 1 work"; docs/GDD.md "Housing repair price"). It
+/// is done on the city itself, with no hex of its own (owner, 3 November 2026: "No hex needed (Recommended)"), so it leaves
+/// no record once done. The fixture's town_a is on (1, 0); its land in reach is (1, 0), (2, 0), (1, 1) and (0, 1).</summary>
+public class Gdd03HousingRepairTests
+{
+ const string Repair = "housing_repair";
+ /// <summary>The real projects.yaml row, so every test runs the shipped values.</summary>
+ static string Row => File.ReadAllLines(Path.Combine(RealContentTests.ContentRoot(), "projects.yaml")).Single(l => l.Contains("id: housing_repair")) + "\n";
+
+ static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);
+
+ static Content Load(bool gdd03, string? projects = null) => ArmsWorkshopTests.Load(gdd03, projects ?? Fixture.GddProjects + Row);
+
+ /// <summary>A gdd-0.3 game whose town_a houses its people with room to spare (no overflow, so R-HOUSE-005 moves no
+ /// condition) at <paramref name="condition"/>, with <paramref name="civilians"/> civilians, <paramref name="employed"/> of
+ /// them in jobs.</summary>
+ static (Content C, GameState S) Game(double condition = 0.35, int civilians = 10, int employed = 8)
+ {
+ var c = Load(true);
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var x = s.Cities["town_a"];
+ s.Cities["town_a"] = new City(x.Id, 100, employed, civilians, employed, 0, 0, condition, jobsDefault: false);
+ return (c, s);
+ }
+
+ static StartProject Start(int q = 1, int r = 0) => new StartProject(Repair, "town_a", q, r);
+
+ static double Condition(GameState s) => s.Cities["town_a"].Condition!.Value;
+
+ // R-HOUSE-006: the row is read under gdd-0.3 only; gdd-0.1 keeps exactly its kinds.
+ [Fact]
+ public void TheRepairIsAKindUnderGdd03Only()
+ {
+ Assert.Equal(new[] { "housing", "transit_camp", "industry" }, Load(false).ProjectKinds.Select(k => k.Id));
+ var k = Load(true).ProjectKinds.Single(x => x.Id == Repair);
+ Assert.Equal((0.5, 1, 0, 0.1, 0, 0), (k.Cost, k.Turns, k.Capacity, k.Condition, k.JobSlots, k.WorkerSlots));
+ Assert.Equal(new[] { SaveGame.Gdd03Ruleset }, k.Rulesets);
+ }
+
+ // R-HOUSE-006: the real row is the ruled repair (content/gdd03-balance.yaml housing_repair: cost 0.5, work 1,
+ // condition_pp 10), and the loader refuses a row that does not match that catalogue under gdd-0.3.
+ [Fact]
+ public void TheRealRepairRowMatchesTheCatalogue()
+ {
+ var k = Load(true).ProjectKinds.Single(x => x.Id == Repair);
+ Assert.Equal(HebrewReview.AgentChecked, k.NameHeReview);
+ // The real game (gdd-0.1) has no repair.
+ Assert.DoesNotContain(ContentLoader.Load(RealContentTests.ContentRoot()).ProjectKinds, x => x.Id == Repair);
+ foreach (var (from, to, field, says) in new[]
+ {
+ ("cost: 0.5", "cost: 0.6", "cost", "balance catalogue's housing_repair cost"),
+ ("turns: 1", "turns: 2", "turns", "balance catalogue's housing_repair work"),
+ ("condition: 0.1", "condition: 0.2", "condition", "balance catalogue's housing_repair condition_pp"),
+ ("capacity: 0", "capacity: 1", "capacity", "adds no capacity"),
+ ("job_slots: 0", "job_slots: 1", "job_slots", "adds no job slots"),
+ ("rulesets: [gdd-0.3]", "rulesets: [gdd-0.1, gdd-0.3]", "rulesets", "under gdd-0.3 only"),
+ })
+ {
+ Assert.Contains(from, Row);
+ var e = Assert.Throws<ContentException>(() => Load(true, Fixture.GddProjects + Row.Replace(from, to)));
+ Assert.Contains($"projects[housing_repair].{field}", e.Message);
+ Assert.Contains(says, e.Message);
+ }
+ // A row with no rulesets would be a gdd-0.1 kind: refused there too.
+ Assert.Contains("under gdd-0.3 only", Assert.Throws<ContentException>(() => Load(false, Fixture.GddProjects + Row.Replace(", rulesets: [gdd-0.3]", ""))).Message);
+ }
+
+ // R-HOUSE-006 with R-PROJ-001 and R-MONEY-003: the repair is paid in full at the start, borrowing the shortfall.
+ [Fact]
+ public void ARepairCostsHalfAMoneyAndBorrowsTheRest()
+ {
+ var (c, s) = Game();
+ s.Treasury = 0.2; s.Debt = 0;
+ var r = Step(c, s, Start());
+ Assert.Empty(r.Rejected);
+ Assert.Equal(-0.5, r.Why.Single(w => w.Key == CauseKeys.Paid && w.Args[0] == CauseKeys.Purpose.Project).Delta, 9);
+ Assert.Equal(0.3, r.Why.Single(w => w.Key == CauseKeys.Borrowed && w.Args[0] == CauseKeys.Purpose.Project).Delta, 9);
+ }
+
+ // R-HOUSE-006 with R-CITY-011 and R-PROJ-003: with a builder, the repair is done in its one turn of work and adds 10 pp
+ // of condition; its builder is free again.
+ [Fact]
+ public void ARepairWithABuilderRaisesConditionTenPoints()
+ {
+ var (c, s) = Game(0.35);
+ Assert.Equal(0.35, Condition(Step(c, s).State), 9); // precondition: no overflow, so the turn alone moves nothing
+ var r = Step(c, s, Start());
+ Assert.Empty(r.Rejected);
+ Assert.Equal(0.45, Condition(r.State), 9);
+ Assert.Equal(0, Projects.Builders(r.State, "town_a"));
+ Assert.Contains(r.Why, w => w.Key == CauseKeys.ProjectBuilder && w.Args.Single() == Repair);
+ Assert.Contains(r.Why, w => w.Key == CauseKeys.ProjectCompleted && w.Args.Single() == Repair);
+ Assert.Contains(r.Why, w => w.Key == CauseKeys.ProjectBuilderFreed && w.Args.Single() == Repair);
+ }
+
+ // R-HOUSE-006: never above the maximum.
+ [Fact]
+ public void ARepairNeverTakesConditionAboveOne()
+ {
+ var (c, s) = Game(0.95);
+ Assert.Equal(1.0, Condition(Step(c, s, Start()).State), 9);
+ }
+
+ // R-HOUSE-006 with R-CITY-011 and R-PROJ-003: with nobody free at the start, the repair waits with no builder and
+ // changes nothing; once the player puts a builder on it, it is done the next turn.
+ [Fact]
+ public void ARepairWithNoBuilderWaits()
+ {
+ var (c, s) = Game(0.35, civilians: 10, employed: 10);
+ var state = Step(c, s, Start()).State;
+ var id = state.CityProjects.Keys.Single();
+ for (int i = 0; i < 3; i++)
+ {
+ Assert.False(state.CityProjects[id].Builder);
+ Assert.Equal((1, (DateTime?)null), (state.CityProjects[id].TurnsLeft, state.CityProjects[id].BuiltOn));
+ Assert.Equal(0.35, Condition(state), 9);
+ state = Step(c, state).State;
+ }
+ var x = state.Cities["town_a"];
+ state.Cities["town_a"] = new City(x.Id, x.HousingCapacity, x.JobSlots, x.Civilians + 1, x.Employed, 0, 0, x.Condition, jobsDefault: false);
+ var built = Step(c, state, new AssignWorkers("town_a", Projects.BuildRole, 1));
+ Assert.Empty(built.Rejected);
+ Assert.Equal(0.45, Condition(built.State), 9);
+ Assert.Empty(built.State.CityProjects);
+ }
+
+ // R-HOUSE-006 with R-PROJ-001 (owner, 3 November 2026: "One per city, plus 2 nationally"): a repair uses the city's one
+ // start of the turn, and counts toward the national map_actions_per_turn.
+ [Fact]
+ public void ARepairUsesTheCitysStart()
+ {
+ var (c, s) = Game();
+ var both = Step(c, s, new StartProject("housing", "town_a", 1, 1), Start());
+ var refused = Assert.Single(both.Rejected);
+ Assert.Equal(Repair, ((StartProject)refused.Command).ProjectKind);
+ Assert.Equal("Town A has started a city project this turn", refused.Reason);
+ Assert.Single(both.Why, w => w.Key == CauseKeys.Paid && w.Args[0] == CauseKeys.Purpose.Project);
+
+ var full = s.Clone();
+ full.MapActionsTurnDate = full.Date; full.MapActionsThisTurn = c.RulesAt(full.Date).MapActionsPerTurn;
+ Assert.Equal("turn_cap", Projects.CheckCityReason(c, full, Repair, "town_a", 1, 0)?.Kind);
+ }
+
+ // R-HOUSE-006 (owner, 3 November 2026: "No hex needed (Recommended)", departing from Q-PROJ-2 for repairs only): with
+ // every hex in reach built on, the city itself included, a repair still starts; once done it leaves no record, so the
+ // hex still shows its own project, and the next turn another repair starts.
+ [Fact]
+ public void ARepairNeedsNoFreeHexAndLeavesNone()
+ {
+ var (c, s) = Game(0.35);
+ foreach (var (q, r) in new[] { (1, 0), (2, 0), (1, 1), (0, 1) })
+ {
+ var built = s.NextId++;
+ s.CityProjects.Add(built, new CityProject(built, "housing", "town_a", q, r, 0, s.Date));
+ }
+ Assert.Equal("occupied_project", Projects.CheckCityReason(c, s, "housing", "town_a", 1, 0)?.Kind);
+ var x = s.Cities["town_a"];
+ s.Cities["town_a"] = new City(x.Id, 100, x.JobSlots, x.Civilians, x.Employed, 0, 0, x.Condition, jobsDefault: false);
+ var one = Step(c, s, Start());
+ Assert.Empty(one.Rejected);
+ Assert.Equal(0.45, Condition(one.State), 9);
+ Assert.Equal(4, one.State.CityProjects.Count);
+ Assert.DoesNotContain(one.State.CityProjects.Values, p => p.Kind == Repair);
+ Assert.Equal("housing", Projects.CityProjectAt(one.State, 1, 0)?.Kind);
+ var two = Step(c, one.State, Start());
+ Assert.Empty(two.Rejected);
+ Assert.Equal(0.55, Condition(two.State), 9);
+ }
+
+ // R-HOUSE-006: a repair is done on the city itself, so a neighbouring hex is refused, with the state unchanged.
+ [Fact]
+ public void ARepairIsOnlyOnTheCitysOwnHex()
+ {
+ var (c, s) = Game();
+ Assert.Equal("repair_city_hex", Projects.CheckCityReason(c, s, Repair, "town_a", 1, 1)?.Kind);
+ var r = Step(c, s, Start(1, 1));
+ Assert.Equal("A housing repair is done on Town A's own hex", Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).State.Hash(), r.State.Hash());
+ }
+
+ // R-HOUSE-006 with R-PROJ-002: a repair being built can be cancelled; the Money is not returned and its builder is free
+ // again at once.
+ [Fact]
+ public void CancellingARepairKeepsTheMoneySpent()
+ {
+ var (c, s) = Game(0.35);
+ var id = s.NextId++;
+ s.CityProjects.Add(id, new CityProject(id, Repair, "town_a", 1, 0, 1, builder: true));
+ var cancel = Step(c, s, new CancelProject(id));
+ Assert.Empty(cancel.Rejected);
+ Assert.Empty(cancel.State.CityProjects);
+ Assert.Equal(0, Projects.Builders(cancel.State, "town_a"));
+ Assert.Contains(cancel.Why, w => w.Key == CauseKeys.ProjectBuilderFreed && w.Args.Single() == Repair);
+ Assert.Equal(0.35, Condition(cancel.State), 9);
+ var none = s.Clone(); none.CityProjects.Clear();
+ Assert.Equal(Step(c, none).State.Treasury, cancel.State.Treasury, 9);
+ }
+
+ // R-HOUSE-006 with R-CITY-010: in a city the enemy holds, a repair gains no progress: its record and the condition stay.
+ [Fact]
+ public void ARepairInAHeldCityWaits()
+ {
+ var (c, s) = Game(0.35);
+ var id = s.NextId++;
+ s.CityProjects.Add(id, new CityProject(id, Repair, "town_a", 1, 0, 1, builder: true));
+ s.Units.Add(s.NextId, new Unit(s.NextId++, "enemy", 1, 0, side: "egypt", strength: 3));
+ var held = Step(c, s).State;
+ Assert.Equal((1, (DateTime?)null, true), (held.CityProjects[id].TurnsLeft, held.CityProjects[id].BuiltOn, held.CityProjects[id].Builder));
+ Assert.Equal(0.35, Condition(held), 9);
+ }
+
+ // R-HOUSE-006: the real game (gdd-0.1) has no repair, with the row in projects.yaml: StartProject on a city's own hex
+ // refuses it as unknown and nothing changes.
+ [Fact]
+ public void Gdd01HasNoRepair()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ Assert.Equal(SaveGame.GddRuleset, c.Ruleset);
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var home = c.SettlementHexes.First(h => s.Cities.ContainsKey(h.Id));
+ var r = Step(c, s, new StartProject(Repair, home.Id, home.Q, home.R));
+ Assert.Equal("There is no such city project", Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).State.Hash(), r.State.Hash());
+ }
+}
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index f891e8795..98518dfd3 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -1639,9 +1639,38 @@ namespace Statecraft.Sim
if (!string.IsNullOrEmpty(x.Requires) && !c.Cities.Any(k => k.Resources.Any(r => r.Id == x.Requires)))
throw new ContentException(pf, at + ".requires", $"no city in cities.yaml has the resource '{x.Requires}'");
ValidateWorkshopKind(c, x, pf, at);
+ ValidateRepairKind(c, x, pf, at);
}
}
+ /// <summary>R-HOUSE-006: the housing_repair row exists under gdd-0.3 only and adds no capacity or job slots, and under
+ /// gdd-0.3 it has the balance catalogue's housing_repair price and effect: its cost, its work as turns (maintainer call
+ /// (not an owner ruling): 1 work is one turn, as arms_workshop's work 3 is its 3 turns) and its condition_pp as a change
+ /// of the 0 to 1 condition (owner, 1 November 2026: "Fixed price 0.5 Money + 1 work").</summary>
+ static void ValidateRepairKind(Content c, ProjectKind x, string pf, string at)
+ {
+ if (x.Id != Projects.HousingRepair) return;
+ if (!(x.Rulesets.Count == 1 && x.Rulesets[0] == SaveGame.Gdd03Ruleset))
+ throw new ContentException(pf, at + ".rulesets", $"a housing repair exists under {SaveGame.Gdd03Ruleset} only: rulesets: [{SaveGame.Gdd03Ruleset}]");
+ if (x.Capacity != 0) throw new ContentException(pf, at + ".capacity", "must be 0: a housing repair adds no capacity");
+ if (x.JobSlots != 0) throw new ContentException(pf, at + ".job_slots", "must be 0: a housing repair adds no job slots");
+ if (c.Ruleset != SaveGame.Gdd03Ruleset) return;
+ const string key = "housing_repair";
+ if (!c.Gdd03Balance!.Values.TryGetValue(key, out var row) || row?.Parts == null)
+ throw new ContentException(pf, at, $"the gdd-0.3 balance catalogue has no {key} row");
+ decimal Part(string part) => row.Parts.TryGetValue(part, out var v) && v?.Values?.Count == 1 ? v.Values[0]
+ : throw new ContentException(pf, at, $"the gdd-0.3 balance catalogue's {key} has no single {part} value");
+ void Match(string field, decimal actual, decimal expected, string part)
+ {
+ if (actual != expected)
+ throw new ContentException(pf, at + "." + field, FormattableString.Invariant($"must be {expected}, the gdd-0.3 balance catalogue's {key} {part}"));
+ }
+ Match("cost", (decimal)x.Cost, Part("cost"), "cost");
+ // Maintainer call (not an owner ruling): work is matched as turns, 1 work = 1 turn (the arms_workshop precedent).
+ Match("turns", x.Turns, Part("work"), "work");
+ Match("condition", (decimal)x.Condition, Part("condition_pp") / 100m, "condition_pp / 100");
+ }
+
/// <summary>R-ARMS-004: a kind's `rulesets` names GDD rulesets only, and `worker_slots` is 0 or 1. A kind with a worker
/// slot is an arms workshop: it adds no housing, condition or job slots (its worker holds no job), exists under
/// gdd-0.3 only, and under gdd-0.3 the arms_workshop row has the balance catalogue's worker slots.</summary>
diff --git a/sim/Statecraft.Sim/GddState.cs b/sim/Statecraft.Sim/GddState.cs
index 3a61850e0..82644b538 100644
--- a/sim/Statecraft.Sim/GddState.cs
+++ b/sim/Statecraft.Sim/GddState.cs
@@ -296,7 +296,8 @@ namespace Statecraft.Sim
/// <summary>A city project (projects.yaml; R-PROJ-001 to R-PROJ-003): <see cref="Kind"/> built for <see cref="City"/> on hex
/// (<see cref="Q"/>, <see cref="R"/>) with <see cref="TurnsLeft"/> more turns to go, or, once <see cref="BuiltOn"/> is set,
/// built on that date (its capacity, condition and slots added then, once). A built project keeps its record, so its hex
- /// stays taken (Q-PROJ-2) and the map can draw it (Phase 3 PR 8). No workers (Q-PROJ-3); under gdd-0.3 at most one
+ /// stays taken (Q-PROJ-2) and the map can draw it (Phase 3 PR 8); a gdd-0.3 housing repair, which has no hex of its own,
+ /// leaves no record once done (R-HOUSE-006). No workers (Q-PROJ-3); under gdd-0.3 at most one
/// builder (<see cref="Builder"/>, R-CITY-011). Immutable; a change replaces the record.</summary>
public sealed class CityProject
{
diff --git a/sim/Statecraft.Sim/Projects.cs b/sim/Statecraft.Sim/Projects.cs
index 71a7211eb..f00a53e44 100644
--- a/sim/Statecraft.Sim/Projects.cs
+++ b/sim/Statecraft.Sim/Projects.cs
@@ -55,11 +55,14 @@ namespace Statecraft.Sim
: "";
/// <summary>The GDD minister system a city project's kind belongs to (R-MIN-001; Q-MIN-1): housing, a transit
- /// camp included (Q-HOUSE-3's low-condition housing type), and industry construction are Labour's; a kind the map
- /// does not name is "" (neutral).</summary>
+ /// camp included (Q-HOUSE-3's low-condition housing type) and a gdd-0.3 housing repair (R-HOUSE-006; maintainer call
+ /// (not an owner ruling): a repair counts as a Housing build, so housing construction's multiplier applies and with a
+ /// weak minister it can take more than one turn), and industry construction are Labour's; a kind the map does not
+ /// name is "" (neutral).</summary>
public static string SystemOfKind(string kind) =>
kind == "industry" ? EffectsSystem.IndustryConstructionSystem
- : kind == "housing" || kind == "transit_camp" ? EffectsSystem.HousingConstructionSystem
+ // HousingRepair here is a maintainer call, not an owner ruling (R-HOUSE-006): see the summary above.
+ : kind == "housing" || kind == "transit_camp" || kind == HousingRepair ? EffectsSystem.HousingConstructionSystem
: "";
/// <summary>The turns, this one included, in which the unit completes the site's remaining whole work and
@@ -278,14 +281,25 @@ namespace Statecraft.Sim
/// 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);
+ /// <summary>R-HOUSE-006 (#1700, #1703), gdd-0.3 only (the loader keeps the row out of every other ruleset): the
+ /// projects.yaml id of the housing repair, a city project done on its city's own hex with no hex of its own (owner,
+ /// 3 November 2026: "No hex needed (Recommended)").</summary>
+ public const string HousingRepair = "housing_repair";
+
+ /// <summary>R-HOUSE-006: a housing repair's refusal on a hex other than its city's own, formatted with the settlement's
+ /// name ({0}).</summary>
+ public const string RefusedRepairCityHex = "A housing repair is done on {0}'s own hex";
+
+ /// <summary>The city project at hex (q, r), being built or built, or null (Q-PROJ-2: one project or placement a hex). A
+ /// housing repair has no hex of its own (R-HOUSE-006), so it is never the project at a hex.</summary>
+ public static CityProject? CityProjectAt(GameState s, int q, int r) => s.CityProjects.Values.FirstOrDefault(p => p.Q == q && p.R == r && p.Kind != HousingRepair);
/// <summary>R-PROJ-001: null when city project <paramref name="kind"/> may be started for <paramref name="city"/> on hex
/// (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); under gdd-0.3, once the city started <see cref="Gdd03CityStartsPerTurn"/> this turn; and once
+ /// project (Q-PROJ-2), except that a gdd-0.3 housing repair must be on the city's own hex and may be ordered whatever it
+ /// holds (R-HOUSE-006); 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;
@@ -293,7 +307,8 @@ namespace Statecraft.Sim
/// <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), city_cap (city;
+ /// too_far (distance, city), repair_city_hex (city; a housing repair off its city's own hex), 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)
{
@@ -316,9 +331,16 @@ namespace Statecraft.Sim
if (!InReach(c, s, city, q, r))
return new MapActionReason("too_far", FormattableString.Invariant($"This hex is more than {max} {(max == 1 ? "hex" : "hexes")} from {name}"),
max.ToString(System.Globalization.CultureInfo.InvariantCulture), city);
- if (MapActions.At(s, q, r) is Placement placed)
+ // R-HOUSE-006 (owner, 3 November 2026: "No hex needed (Recommended)"): a repair is done on the city itself, so it
+ // goes on the city's own hex whatever that hex holds, and takes none (Q-PROJ-2 is for the other kinds).
+ if (kind == HousingRepair)
+ {
+ if (Distance(c, city, q, r) != 0)
+ return new MapActionReason("repair_city_hex", string.Format(System.Globalization.CultureInfo.InvariantCulture, RefusedRepairCityHex, name), city);
+ }
+ else if (MapActions.At(s, q, r) is Placement placed)
return new MapActionReason("occupied", $"This hex already has {PlayerText.MapAction(c, placed.Action)}", placed.Action);
- if (CityProjectAt(s, q, r) is CityProject other)
+ else 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.
@@ -442,7 +464,8 @@ namespace Statecraft.Sim
/// <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
- /// advanced again. R-CITY-010: a project in a city the enemy holds keeps its record as it is. R-CITY-011 (gdd-0.3 only):
+ /// advanced again, except a gdd-0.3 housing repair, whose record then leaves the state (R-HOUSE-006: it has no hex to
+ /// keep). R-CITY-010: a project in a city the enemy holds keeps its record as it is. R-CITY-011 (gdd-0.3 only):
/// a project gains the turn's progress only when it has a builder and its city still has that person without a job
/// (each project with a builder takes one, in ascending id); otherwise it waits with its record as it is, and the turn
/// report says why. Money is never an input to progress.</summary>
@@ -474,7 +497,8 @@ namespace Statecraft.Sim
var whole = (int)Math.Floor(acc);
acc -= whole;
if (p.TurnsLeft > whole) { s.CityProjects[p.Id] = p.WithProgress(p.TurnsLeft - whole, acc); continue; }
- s.CityProjects[p.Id] = p.Built(next);
+ if (p.Kind == HousingRepair) s.CityProjects.Remove(p.Id); // R-HOUSE-006: no hex, so nothing is left
+ else s.CityProjects[p.Id] = p.Built(next);
var k = c.ProjectKinds.First(x => x.Id == p.Kind);
var city = s.Cities[p.City];
var condition = city.Condition is double now ? Math.Min(1.0, Math.Max(0.0, now + k.Condition)) : (double?)null;
diff --git a/unity/Assets/Scripts/UI/GddHexPanel.cs b/unity/Assets/Scripts/UI/GddHexPanel.cs
index ddf1f302a..ad18362f5 100644
--- a/unity/Assets/Scripts/UI/GddHexPanel.cs
+++ b/unity/Assets/Scripts/UI/GddHexPanel.cs
@@ -449,6 +449,7 @@ namespace Statecraft.Game.UI
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 "repair_city_hex": return text.Format("city.project_reason.repair_city_hex", townName(reason.Values[0])); // R-HOUSE-006, gdd-0.3
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/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index f37766458..1269868e8 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -813,6 +813,9 @@ 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"
+# R-HOUSE-006, gdd-0.3 only (owner, 3 November 2026: "No hex needed (Recommended)"): a housing repair off its city's own
+# hex, {0} the city.
+city.project_reason.repair_city_hex: "A housing repair is done on {0}'s own hex"
# 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
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index 26427feb9..d432eaa84 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -964,6 +964,8 @@ 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}: כבר יש התחלת מיזם עירוני בתור הזה"
+# R-HOUSE-006, gdd-0.3 only, {0} the city. Agent-drafted Hebrew; native review pending (#564). No verb agrees with {0} (HE-15).
+city.project_reason.repair_city_hex: "שיפוץ דיור נעשה רק במשבצת של {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: native review: owner, 3 Nov 2026 (HE batch 4: "Approve all as they are").