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.

GDD 0.3 start, PR 4 (ruled part): the opening field farmers counted per host (Refs #1725, Refs #1689) (#2945)

Eyal Golanecdade8047ce
diff --git a/changelog.d/1689-opening-field-farmer-hosts.md b/changelog.d/1689-opening-field-farmer-hosts.md
new file mode 100644
index 000000000..cf833a3fa
--- /dev/null
+++ b/changelog.d/1689-opening-field-farmer-hosts.md
@@ -0,0 +1,7 @@
+- GDD 0.3 starting population (Refs #1689, Refs #1725): the inactive Historical ledger now holds the 20 opening field
+ farmers on top of the census (owner, 7 November 2026: "On top of census (Recommended)"), one on each field from the
+ first turn, living in the field's host. They split 1:2:1 per host (owner: "Per host, 1/18/1 (Recommended)"): Tiberias
+ has a novice on F03, four trained and a veteran on F08 (owner, relayed: "F08 veteran, F03 novice (Recommended)"), and
+ every other host only trained farmers, all with no work experience (owner, relayed: "0 for all (Recommended)"). The
+ dark start adds one housing place per farmer in the census towns that host them; Nir Am and Nirim get none for now
+ (owner, relayed: "None for those two for now (Recommended)"). No new-game wiring, so there is no change in the game.
diff --git a/docs/population-ledger.md b/docs/population-ledger.md
index 0f54c1ba6..8b736613b 100644
--- a/docs/population-ledger.md
+++ b/docs/population-ledger.md
@@ -14,4 +14,4 @@ No save/reload round trip for population identity is claimed. The existing seed/
## Historical start inventory (R-POP-004)
-`HistoricalPopulation.Inventory` is internal and reads the shipped content under exact `gdd-0.3`: one free-civilian row per census city start unit (R-CITY-007) and one active-soldier row per population unit of each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006), at `rules.yaml`'s 1,000 people a unit (owner, 1 November 2026, D2). Rows carry a source key (`census/<city id>`, `units_1948/<row id>`) and a within-source ordinal, in R-POP-001's order. Enemy formations and dated arrivals (R-UNIT-009) are not in it. It builds no `PopulationUnit` itself. `HistoricalPopulation.LedgerFixture` (internal, fixture-only) turns it into an initialized Historical ledger and binds each record to a region of `content/regions.yaml`: a census record takes the region whose `member_locations` hold its city, and its location names that city (`PopulationLocation.City`), a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. Census records start with their reception done (`reception.turns`), so R-VET-001's received-free-civilian work XP can apply to them. One census record, the last `census/haifa` ordinal, is the training centre's veteran pioneer teacher (#1689, `start.pioneer_teachers` 1): a pioneer at the veteran tier with work XP 0 and no assignment, since a teaching teacher with no pupil is refused (R-TRAIN-008); see R-POP-004. Each formation record carries one issued military item (`units_1948/<row id>/<ordinal>`, recorded as paid), apart from the spare Arms (#1717). A formation record's military qualification is its type's `unit_types.yaml` class, and its combat XP is `gdd03-start.yaml`'s `formation_combat_xp` (#1689 rows 5 to 8, R-POP-004). The public `NewGame` does not call it, because an initialized ledger refuses the aggregate systems a `gdd-0.3` game still runs (R-POP-002). The dark start, `NewGame`'s internal fixture-only overload (#1725 PR 5), initializes the same ledger in place (`HistoricalPopulation.Initialize`, all or nothing) before `Pools.Init`, which then starts Food at `cover_months` of the ledger's rations; it places the starting forces against the ledger's soldiers and fires no opening event, since `EventSystem.Trigger` still refuses a ledger. The test `HistoricalPopulationTests` checks it, city by city and formation by formation, against the aggregate start of the same content.
+`HistoricalPopulation.Inventory` is internal and reads the shipped content under exact `gdd-0.3`: one free-civilian row per census city start unit (R-CITY-007) and one active-soldier row per population unit of each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006), at `rules.yaml`'s 1,000 people a unit (owner, 1 November 2026, D2). Rows carry a source key (`census/<city id>`, `units_1948/<row id>`) and a within-source ordinal, in R-POP-001's order. Enemy formations and dated arrivals (R-UNIT-009) are not in it. It builds no `PopulationUnit` itself. `HistoricalPopulation.LedgerFixture` (internal, fixture-only) turns it into an initialized Historical ledger and binds each record to a region of `content/regions.yaml`: a census record takes the region whose `member_locations` hold its city, and its location names that city (`PopulationLocation.City`), a formation record the region whose member hexes hold its starting anchor hex (R-POP-004); a source with no region is refused. Census records start with their reception done (`reception.turns`), so R-VET-001's received-free-civilian work XP can apply to them. One census record, the last `census/haifa` ordinal, is the training centre's veteran pioneer teacher (#1689, `start.pioneer_teachers` 1): a pioneer at the veteran tier with work XP 0 and no assignment, since a teaching teacher with no pupil is refused (R-TRAIN-008); see R-POP-004. The 20 opening field farmers (#1725 PR 4) are records too, on top of the census: source `field/<label>`, ordinal 0, each a free civilian farmer working its field from turn 1 and living in the field's host, split 1:2:1 per host (`HistoricalPopulation.FieldFarmerHosts`; 1 / 18 / 1 in all), work XP 0 and reception done; the dark start adds one housing place per farmer in a census host (18 of 20; Nir Am and Nirim have no city record); see R-POP-004. Each formation record carries one issued military item (`units_1948/<row id>/<ordinal>`, recorded as paid), apart from the spare Arms (#1717). A formation record's military qualification is its type's `unit_types.yaml` class, and its combat XP is `gdd03-start.yaml`'s `formation_combat_xp` (#1689 rows 5 to 8, R-POP-004). The public `NewGame` does not call it, because an initialized ledger refuses the aggregate systems a `gdd-0.3` game still runs (R-POP-002). The dark start, `NewGame`'s internal fixture-only overload (#1725 PR 5), initializes the same ledger in place (`HistoricalPopulation.Initialize`, all or nothing) before `Pools.Init`, which then starts Food at `cover_months` of the ledger's rations; it places the starting forces against the ledger's soldiers and fires no opening event, since `EventSystem.Trigger` still refuses a ledger. The test `HistoricalPopulationTests` checks it, city by city and formation by formation, against the aggregate start of the same content.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 3a956c35e..c58ca65fd 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -601,13 +601,13 @@ R-CAMERA-001: Only exact `gdd-0.3` fixes gameplay yaw at zero (north), including
These contracts cover #1689 steps 1–2 and the Historical start inventory (R-POP-004) only. Production era selection, Food consumption and command/save/reload integration remain held; helper coverage does not complete #1689. See [population-ledger.md](../population-ledger.md).
-R-POP-001: Only exact `gdd-0.3` enables the population-ledger capability, independently of the broad GDD loop and Attention (R-LOOP-002/005). An immutable own-population record has a dedicated nonnegative ordinal id. Synthetic fixture inventory is ordered by source key (ordinal string comparison), then within-source ordinal. Registered arrivals allocate monotonically; only explicit combat losses remove living ids. Sources remain registered after loss, and ids are never reused. Reconciliation checks the exact created-minus-lost id set against the living ledger, not just equal totals. Status/region counts include every matching record once. The gdd-0.3 scale of a synthetic or Open fixture reads one positive Agreed integer from `population.people_per_unit` in its catalogue (currently 10,000, Open mode's scale under D2); a Historical fixture reads `rules.yaml`'s `people_per_unit` for the start day (1,000), as R-UNIT-006 does (owner, 1 November 2026, D2: "Approve all six (Recommended)", "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)"; R-POP-004); rows with a `census/` or `units_1948/` source key are the Historical start's and are refused in any other fixture. Old identities retain the common rules scale. Missing, fractional, nonpositive, overflowing or Deferred values have no fallback, in either source.
+R-POP-001: Only exact `gdd-0.3` enables the population-ledger capability, independently of the broad GDD loop and Attention (R-LOOP-002/005). An immutable own-population record has a dedicated nonnegative ordinal id. Synthetic fixture inventory is ordered by source key (ordinal string comparison), then within-source ordinal. Registered arrivals allocate monotonically; only explicit combat losses remove living ids. Sources remain registered after loss, and ids are never reused. Reconciliation checks the exact created-minus-lost id set against the living ledger, not just equal totals. Status/region counts include every matching record once. The gdd-0.3 scale of a synthetic or Open fixture reads one positive Agreed integer from `population.people_per_unit` in its catalogue (currently 10,000, Open mode's scale under D2); a Historical fixture reads `rules.yaml`'s `people_per_unit` for the start day (1,000), as R-UNIT-006 does (owner, 1 November 2026, D2: "Approve all six (Recommended)", "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)"; R-POP-004); rows with a `census/`, `units_1948/` or `field/` source key are the Historical start's and are refused in any other fixture. Old identities retain the common rules scale. Missing, fractional, nonpositive, overflowing or Deferred values have no fallback, in either source.
R-POP-002: A ledger record has exactly one typed status and assignment, validated location, home and captor references, whole reception-turn ticks capped by the catalogue requirement, civilian profession-specific tier and actual-work XP, separate military qualification/combat XP, and distinct issued civilian/military equipment and paid facts. Unknown references, unresolved teacher ids, incompatible statuses/assignments, inconsistent region/hex/facility bindings, invalid progress/tiers and duplicate issued-item ownership are refused before mutation. Moves and atomic status/location/assignment transitions retain identity/history. Capture retains home context without inventing a prison hex or refunding equipment. Ledger changes never touch resources, causes, RNG or Attention. Initialization is internal and fixture-only; initialized ledger fixtures refuse aggregate Simulation commands and turns. The dark start (#1725 PR 5) is the internal, fixture-only `Simulation.NewGame` overload that initializes the Historical ledger (R-POP-004) in place before `Pools.Init`: `Pools.Init` then reads the ledger's need, one ration for each living own population id (R-FOOD-001, #2470), after the ledger reconciles, and `StartingForces.Init` places the forces once each own starting formation's strength is its ledger soldiers, refusing otherwise. Both read only a ledger initialized with mode Historical, the dark start's; a synthetic or Open ledger is refused by both, as by the other aggregate systems, with the state unchanged. `EventSystem.Trigger` still refuses a ledger, so a dark start fires no opening event; the public `NewGame` is unchanged. The step-7 Food settlement given a month's synthetic context is another exception to that refusal: it reads its need from that month's frozen snapshot (R-FOOD-002, #2470). Old identities refuse ledger mutation. Prices, progression awards, return destinations, tool lock-in and captive-equipment outcomes remain with their owning issues. A craftsman's tier is novice, apprentice or expert (R-CRAFT-003); a farmer's or pioneer's is novice, trained or veteran.
R-POP-003: Clone copies all ledger containers; immutable records and frozen bindings may be shared. The canonical writer emits a gdd-0.3-only section ordered by numeric population id, with fixed field order, stable machine tokens, invariant integer formatting and length-prefixed reference strings. It covers every record/assignment/equipment/reference field, binding, creation/loss provenance and allocator even after the last combat loss. Legacy/gdd-0.1 emit no ledger section or allocator marker. A location's optional city (a `regions.yaml` member location of its region that is a census city of `cities.yaml` or one of that region's field hosts, where R-POP-004 houses own people: a settlement hosts only F19 and F20, owner, 7 November 2026, #1689: "These two only (Recommended)"; any other, including a locality, a `sites.yaml` id or a map location, is refused when a fixture is created, naming the city and the region, R-POP-002) is written after its other fields as `|city=` with a length-prefixed id, only when set, as R-UNIT-002's `|home=` is, so a location without a city keeps its canonical text and hash. R-SAVE-001/002 still govern identity mismatch refusal and replay: no ledger snapshot or new command syntax is added in this foundation, and fixture injection is not replay evidence. Existing unpublished schema-4 draft hashes change; no migration promise is made.
-R-POP-004: The Historical start inventory under exact `gdd-0.3` (#1689; owner, 1 November 2026, D2: "Approve all six (Recommended)", and D4). It is read from the same content as the aggregate start: each census city (R-CITY-006) gives its R-CITY-007 start units as free civilians, and each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006) gives its strength as active soldiers. The 20 farmer units are added to the census total (owner, 7 November 2026: "On top, change the rule (Recommended)", which reverses this rule's earlier "no more and no less"); the inventory does not hold them until they are wired in. Enemy formations are not own population, and a dated arrival (R-UNIT-009) is not in the start inventory: it takes new ids when it arrives (Q11). Counts use `rules.yaml`'s `people_per_unit` (1,000, D2), as R-CITY-007 and R-UNIT-006 do; the `gdd-0.3` catalogue's `population.people_per_unit` (10,000) is Open mode's (D2). A city's records have source key `census/<city id>` and a formation's `units_1948/<row id>`, each with within-source ordinals from 0, so R-POP-001's order (source key by ordinal string comparison, then ordinal) gives the ascending population ids that Q10's "N units" commands take. Legacy and `gdd-0.1` content refuse it. It reads no RNG and changes no state. It is not yet wired into the public `Simulation.NewGame` (only the internal dark start of R-POP-002 calls it): an initialized ledger refuses every aggregate system (R-POP-002), so a new `gdd-0.3` game keeps the aggregate start until the producers are integrated. A fixture builder (`HistoricalPopulation.LedgerFixture`, internal, fixture-only) turns the inventory into an initialized Historical ledger with mode Historical (R-POP-001's 1,000 a record), each record in a region of `content/regions.yaml` (#1691): a census record takes the region whose `member_locations` hold its city (`census/tel_aviv` is `tel_aviv_jaffa`; Jaffa gets no records), and its location names that city, and a formation record takes the region whose member hexes hold the formation's starting anchor hex (owner, 3 November 2026, #1689 open question 1: "Its anchor hex's region (Recommended)"). A source with no region is refused; no region is invented. Census records are free civilians with no assignment and their reception done: they start at `reception.turns`, the "actual reception turns before free-civilian status" (`docs/gdd/balance.md:91`), the ledger's cap (R-POP-002), since R-VET-001 gives work XP only to a received free civilian (an agent reading of `balance.md:91`, not an owner ruling); formation records keep 0, which no ruling sets. Formation records are active soldiers whose service target is their own formation. Each formation record carries one issued military item, id `units_1948/<row id>/<ordinal>`, owned and recorded as paid; census records carry none. One census record is the training centre's veteran pioneer teacher (owner, 7 November 2026, [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704565066): "Yes to all three (Recommended)", whose third part reads "the training centre's one veteran pioneer teacher is a Haifa census unit"): `content/gdd03-balance.yaml`'s `start.pioneer_teachers` (1, Agreed, "included in population total") gives the count, so no record is added, and the fixture refuses any other value, since no ruling places a second teacher. It is the last `census/haifa` ordinal (maintainer call, the coordinator eyalgolan-30, 7 November 2026), a free civilian pioneer at the veteran tier (R-TRAIN-005: "a veteran of the matching profession"), with work XP 0 (owner, 7 November 2026, relayed by the coordinator: "0 (Recommended)"), and no assignment, since R-TRAIN-008 refuses a teaching teacher with no pupil; otherwise it is like any other census record. It is "Takeable, but last (Recommended)" (owner, 7 November 2026, relayed by the coordinator): there is no guard, and as the highest `census/haifa` id it is the last record that Q10's "N units" commands and #1692's job default reach. No ledger producer runs the job default or a Train order yet. Issued items are apart from the spare Arms: the fixture leaves the Arms stock untouched, and a new game still starts with `arms_start`'s 12 (#1717, 27M-24: "The starting formations are equipped, and the Arms stock starts at 12"). Still not in the inventory or the fixture: the work assignments of the employed share and the opening field farmers (fields, #1691/#1717; the owner's 1:2:1 novice/trained/veteran ratio then applies per host, which gives 1 / 18 / 1 nationally: owner, 7 November 2026, "Per host, 1/18/1 (Recommended)", [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704985642)). The formations' rows 5 to 8 are in the fixture (owner, 7 November 2026, #1689 comment 6704389240: "Veteran for all 8 (Recommended)" and "1 each, Negev 0 (Recommended)", Negev's 0 a labelled stand-in). The veteran level lives on the formation, a `veteran_soldier` (R-UNIT-006) that is each soldier's ActiveService target, so a formation record's military qualification is its type's `unit_types.yaml` class (`infantry`), the source basic-training graduates use, with no new level field (maintainer call, eyalgolan-30's coordinator, 7 November 2026). Its combat XP is `content/gdd03-start.yaml`'s `formation_combat_xp`: 1 for Golani, Carmeli, Alexandroni, Kiryati, Givati, Etzioni and Harel, 0 for Negev. The loader requires the list, refuses a row that is not an own opening formation, a duplicate, a missing formation or a value outside 0 to `military.combat_xp_full`, and the fixture refuses without it (no fallback). Only the ledger fixture reads it: the units `NewGame` starts with keep 0 combat XP (same maintainer call); a `veteran_soldier` gains none (R-UNIT-011). The paragraphs below record the owner's decision on each. The ledger scale for this start is no longer Deferred: a Historical ledger fixture counts each record at `rules.yaml`'s `people_per_unit` for the start day, 1,000 people (R-POP-001; D2: "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)").
+R-POP-004: The Historical start inventory under exact `gdd-0.3` (#1689; owner, 1 November 2026, D2: "Approve all six (Recommended)", and D4). It is read from the same content as the aggregate start: each census city (R-CITY-006) gives its R-CITY-007 start units as free civilians, and each Israeli starting formation of `map/units_1948.yaml` (R-UNIT-006) gives its strength as active soldiers. The 20 farmer units are added to the census total (owner, 7 November 2026: "On top, change the rule (Recommended)", which reverses this rule's earlier "no more and no less"), one a field, with source key `field/<label>` (F01 to F20 of `regions.yaml` `field_hexes`) and ordinal 0 (maintainer call, the coordinator, 7 November 2026, so the key stays if a host changes); see the farmers below. Enemy formations are not own population, and a dated arrival (R-UNIT-009) is not in the start inventory: it takes new ids when it arrives (Q11). Counts use `rules.yaml`'s `people_per_unit` (1,000, D2), as R-CITY-007 and R-UNIT-006 do; the `gdd-0.3` catalogue's `population.people_per_unit` (10,000) is Open mode's (D2). A city's records have source key `census/<city id>` and a formation's `units_1948/<row id>`, each with within-source ordinals from 0, so R-POP-001's order (source key by ordinal string comparison, then ordinal) gives the ascending population ids that Q10's "N units" commands take. Legacy and `gdd-0.1` content refuse it. It reads no RNG and changes no state. It is not yet wired into the public `Simulation.NewGame` (only the internal dark start of R-POP-002 calls it): an initialized ledger refuses every aggregate system (R-POP-002), so a new `gdd-0.3` game keeps the aggregate start until the producers are integrated. A fixture builder (`HistoricalPopulation.LedgerFixture`, internal, fixture-only) turns the inventory into an initialized Historical ledger with mode Historical (R-POP-001's 1,000 a record), each record in a region of `content/regions.yaml` (#1691): a census record takes the region whose `member_locations` hold its city (`census/tel_aviv` is `tel_aviv_jaffa`; Jaffa gets no records), and its location names that city, and a formation record takes the region whose member hexes hold the formation's starting anchor hex (owner, 3 November 2026, #1689 open question 1: "Its anchor hex's region (Recommended)"). A source with no region is refused; no region is invented. Census records are free civilians with no assignment and their reception done: they start at `reception.turns`, the "actual reception turns before free-civilian status" (`docs/gdd/balance.md:91`), the ledger's cap (R-POP-002), since R-VET-001 gives work XP only to a received free civilian (an agent reading of `balance.md:91`, not an owner ruling); formation records keep 0, which no ruling sets. Formation records are active soldiers whose service target is their own formation. Each formation record carries one issued military item, id `units_1948/<row id>/<ordinal>`, owned and recorded as paid; census records carry none. One census record is the training centre's veteran pioneer teacher (owner, 7 November 2026, [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704565066): "Yes to all three (Recommended)", whose third part reads "the training centre's one veteran pioneer teacher is a Haifa census unit"): `content/gdd03-balance.yaml`'s `start.pioneer_teachers` (1, Agreed, "included in population total") gives the count, so no record is added, and the fixture refuses any other value, since no ruling places a second teacher. It is the last `census/haifa` ordinal (maintainer call, the coordinator eyalgolan-30, 7 November 2026), a free civilian pioneer at the veteran tier (R-TRAIN-005: "a veteran of the matching profession"), with work XP 0 (owner, 7 November 2026, relayed by the coordinator: "0 (Recommended)"), and no assignment, since R-TRAIN-008 refuses a teaching teacher with no pupil; otherwise it is like any other census record. It is "Takeable, but last (Recommended)" (owner, 7 November 2026, relayed by the coordinator): there is no guard, and as the highest `census/haifa` id it is the last record that Q10's "N units" commands and #1692's job default reach. No ledger producer runs the job default or a Train order yet. Issued items are apart from the spare Arms: the fixture leaves the Arms stock untouched, and a new game still starts with `arms_start`'s 12 (#1717, 27M-24: "The starting formations are equipped, and the Arms stock starts at 12"). Still not in the inventory or the fixture: the work assignments of the employed share. The opening field farmers are (#1725 PR 4; the owner's 1:2:1 novice/trained/veteran ratio applies per host, which gives 1 / 18 / 1 nationally: owner, 7 November 2026, "Per host, 1/18/1 (Recommended)", [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704985642)). `HistoricalPopulation.FieldFarmerHosts` (internal) gives each `regions.yaml` `field_hexes` host its fields' farmers, one a field (owner, 3 November 2026, #1694: "One farmer per field (Recommended)"), split 1:2:1 per host by `Gdd03FarmerTierSplit` in field-label order; the 20 match `start.prepared_fields` (Agreed), and any other total, or a field with no host, is refused. Each farmer is a free civilian farmer staffed on its field from turn 1 (owner, 7 November 2026, [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6704565066): "Yes to all three (Recommended)"): its assignment is Work on the field's target (`field/<q>,<r>`, as `Gdd03FieldFixture`), its location the field's region with its host as the city (Nir Am and Nirim for F19 and F20, R-POP-003). Tiberias hosts six fields, F03 novice, F04 to F07 trained and F08 veteran (owner, 7 November 2026, relayed by the coordinator: "F08 veteran, F03 novice (Recommended)"); every other host has one or two, all trained. Work XP is 0 for every tier (owner, relayed by the coordinator: "0 for all (Recommended)"; veterans "0 (Recommended)", [#1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6710877137)). Reception is done (`reception.turns`), as for the census (maintainer call, the coordinator, 7 November 2026). No tools: post-MVP (#1693, owner, 3 November 2026, answer 1: "Tools in the MVP: no."). `field/` rows, like `census/` and `units_1948/` rows, are refused outside a Historical ledger (R-POP-001). Farmers hold a field, not a job, so they are not among a city's employed (R-CITY-007) or civilians, not in R-OBJ-004's sums, and not among the people without a job a `Train` order takes (R-TRAIN-001): the dark start's aggregate cities keep the census's counts. The dark start adds one housing place per farmer to each census host's housing capacity (same ruling); Nir Am and Nirim have no `cities.yaml` record and get none for now (owner, relayed by the coordinator: "None for those two for now (Recommended)"), so 18 of the 20 places exist until the housing producer (#1725 PR 7). The public `NewGame` is unchanged. The formations' rows 5 to 8 are in the fixture (owner, 7 November 2026, #1689 comment 6704389240: "Veteran for all 8 (Recommended)" and "1 each, Negev 0 (Recommended)", Negev's 0 a labelled stand-in). The veteran level lives on the formation, a `veteran_soldier` (R-UNIT-006) that is each soldier's ActiveService target, so a formation record's military qualification is its type's `unit_types.yaml` class (`infantry`), the source basic-training graduates use, with no new level field (maintainer call, eyalgolan-30's coordinator, 7 November 2026). Its combat XP is `content/gdd03-start.yaml`'s `formation_combat_xp`: 1 for Golani, Carmeli, Alexandroni, Kiryati, Givati, Etzioni and Harel, 0 for Negev. The loader requires the list, refuses a row that is not an own opening formation, a duplicate, a missing formation or a value outside 0 to `military.combat_xp_full`, and the fixture refuses without it (no fallback). Only the ledger fixture reads it: the units `NewGame` starts with keep 0 combat XP (same maintainer call); a `veteran_soldier` gains none (R-UNIT-011). The paragraphs below record the owner's decision on each. The ledger scale for this start is no longer Deferred: a Historical ledger fixture counts each record at `rules.yaml`'s `people_per_unit` for the start day, 1,000 people (R-POP-001; D2: "The Historical MVP keeps main's start: census cities at 1,000 people a unit (`R-CITY-007`)").
The four opening-ledger values were Deferred pending a separate sourced draft for owner approval (4 November 2026, Q24; the coordinator asked: "How should the four deferred opening-ledger values be approved before Historical NewGame initializes the ledger?"; the owner answered: "do the recommended for all"; the chosen option read: "Request and approve a separate sourced draft for employed assignments, farmer identities, formation qualifications and combat XP before wiring NewGame"; [recorded on #1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6623135448)). Farmer home cities needed a source-backed city-by-field proposal for owner approval (4 November 2026, Q26; the coordinator asked: "How should the census-city home of each opening field’s farmer be selected when its region contains several cities?"; the owner answered: "do the recommended for all"; the chosen option read: "Have an agent prepare a source-backed city-by-field proposal for owner approval"; [recorded on #1717](https://github.com/eyalgolan/statecraft-israel/issues/1717#issuecomment-6623136302)).
Owner decision on both drafts, 7 November 2026: "all reccomended in "Decisions for the owner: the GDD 0.3 starting population (#1689) and where the field farmers live (#1717)" - approved" ([recorded on #1689](https://github.com/eyalgolan/statecraft-israel/issues/1689#issuecomment-6703676150)). This wires nothing into `Simulation.NewGame`.
diff --git a/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerHostsTests.cs b/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerHostsTests.cs
new file mode 100644
index 000000000..a59ae3161
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerHostsTests.cs
@@ -0,0 +1,104 @@
+using Statecraft.Sim;
+
+/// <summary>#1725 PR 4 (Refs #1689): each opening field's farmer, counted per host; HistoricalFieldFarmerRecordsTests
+/// checks the records built from the count. Owner, 7 November 2026 (#1689 comment 6704389240): "On top of census (Recommended)"; (comment
+/// 6704565066) "Yes to all three (Recommended)": every farmer staffed on their field from turn 1 and one added housing
+/// place per farmer in their host; (comment 6704985642) "Per host, 1/18/1 (Recommended)". Owner, 3 November 2026 (#1694):
+/// "One farmer per field (Recommended)". Hosts: regions.yaml field_hexes (#1717, #2924).</summary>
+public class HistoricalFieldFarmerHostsTests
+{
+ static Content Gdd03() => HistoricalPopulationTests.Real(true);
+
+ // The ruling as numbers: one farmer per opening field, counted in the field's host, split 1:2:1 per host by
+ // Gdd03FarmerTierSplit. Tiberias hosts six fields (1 / 4 / 1, the 6-farmer ruling on #2465); every other host has
+ // one or two, which the split makes all trained.
+ [Fact]
+ public void EachHostSplitsItsFarmersOneToTwoToOne()
+ {
+ var expected = new (string Host, int Novice, int Trained, int Veteran)[]
+ {
+ ("hadera", 0, 2, 0), ("haifa", 0, 2, 0), ("nir_am", 0, 1, 0), ("nirim", 0, 1, 0), ("petah_tikva", 0, 2, 0),
+ ("rehovot", 0, 1, 0), ("rishon_lezion", 0, 1, 0), ("rosh_pinna", 0, 2, 0), ("tiberias", 1, 4, 1),
+ ("zikhron_yaakov", 0, 2, 0),
+ };
+ var hosts = HistoricalPopulation.FieldFarmerHosts(Gdd03());
+ Assert.Equal(expected, hosts.Select(h => (h.Host, h.Novice, h.Trained, h.Veteran)));
+ foreach (var h in hosts)
+ {
+ Assert.Equal(Gdd03FarmerTierSplit.Split(h.Fields.Count), (h.Novice, h.Trained, h.Veteran));
+ Assert.Equal(h.Fields.Count, h.Farmers);
+ }
+ }
+
+ // "Per host, 1/18/1 (Recommended)": the per-host split gives 1 / 18 / 1 nationally, 20 farmers, the Agreed
+ // start.prepared_fields, all on top of the census.
+ [Fact]
+ public void ThePerHostSplitGivesOneEighteenOneNationally()
+ {
+ var c = Gdd03();
+ var hosts = HistoricalPopulation.FieldFarmerHosts(c);
+ Assert.Equal((1, 18, 1), (hosts.Sum(h => h.Novice), hosts.Sum(h => h.Trained), hosts.Sum(h => h.Veteran)));
+ Assert.Equal(20, hosts.Sum(h => h.Farmers));
+ Assert.Equal(c.RequirePopulationInteger("start.prepared_fields"), hosts.Sum(h => h.Farmers));
+ }
+
+ // "One farmer per field": every opening field (Gdd03FieldFixture's ids) is counted once, in one host, and that host
+ // is a member location of the field's own region (Q27: a farmer lives in the field's region).
+ [Fact]
+ public void EveryOpeningFieldHasOneFarmerInAHostOfItsRegion()
+ {
+ var c = Gdd03();
+ var hosts = HistoricalPopulation.FieldFarmerHosts(c);
+ var fields = Gdd03FieldFixture.Fields(c);
+ var counted = hosts.SelectMany(h => h.Fields).ToList();
+ Assert.Equal(fields.Select(f => f.Id).OrderBy(x => x, StringComparer.Ordinal), counted.OrderBy(x => x, StringComparer.Ordinal));
+ Assert.Equal(counted.Count, counted.Distinct(StringComparer.Ordinal).Count());
+ foreach (var h in hosts)
+ {
+ Assert.Equal(h.Region, c.PlayerRegions.AtLocation(h.Host)!.Id);
+ foreach (var id in h.Fields) Assert.Equal(h.Region, fields.Single(f => f.Id == id).Region);
+ }
+ }
+
+ // "one added housing place per farmer in their host": the count each host gains. Nir Am and Nirim host one farmer each
+ // and have no cities.yaml record, so no city housing exists there to add the place to (an open question, not built).
+ [Fact]
+ public void EachFarmerGivesOneHousingPlaceInTheirHost()
+ {
+ var c = Gdd03();
+ var hosts = HistoricalPopulation.FieldFarmerHosts(c);
+ foreach (var h in hosts) Assert.Equal(h.Farmers, h.HousingPlaces);
+ Assert.Equal(20, hosts.Sum(h => h.HousingPlaces));
+ foreach (var settlement in new[] { "nir_am", "nirim" })
+ {
+ Assert.Equal(1, hosts.Single(h => h.Host == settlement).HousingPlaces);
+ Assert.DoesNotContain(c.Cities, x => x.Id == settlement);
+ }
+ }
+
+ // A field total other than the Agreed start.prepared_fields (20) is refused: no farmer count is invented or dropped.
+ [Fact]
+ public void AFieldTotalOtherThanThePreparedFieldsIsRefused()
+ {
+ var root = RealContentTests.ContentRoot();
+ var regions = File.ReadAllText(Path.Combine(root, "regions.yaml"));
+ var f20 = regions.Split('\n').Single(l => l.Contains("field: F20,", StringComparison.Ordinal));
+ var trimmed = regions.Replace(" field_hexes:\n" + f20 + "\n", " field_hexes: []\n", StringComparison.Ordinal);
+ Assert.NotEqual(regions, trimmed);
+ var c = ContentLoader.Load(rel =>
+ {
+ var path = Path.Combine(root, rel);
+ var text = File.Exists(path) ? File.ReadAllText(path) : null;
+ if (rel == "regions.yaml") return trimmed;
+ return rel == "eras.yaml" ? text!.Replace("loop: gdd", "loop: gdd, ruleset: gdd-0.3") : text;
+ }, Directory.GetFiles(Path.Combine(root, "events"), "*.yaml").Select(p => "events/" + Path.GetFileName(p)));
+ Assert.Equal(19, Gdd03FieldFixture.Fields(c).Count);
+ var e = Assert.Throws<InvalidOperationException>(() => HistoricalPopulation.FieldFarmerHosts(c));
+ Assert.Contains("start.prepared_fields", e.Message, StringComparison.Ordinal);
+ }
+
+ // R-POP-001: only exact gdd-0.3 has farmers on the ledger; gdd-0.1 content refuses.
+ [Fact]
+ public void Gdd01ContentRefuses()
+ => Assert.Throws<InvalidOperationException>(() => HistoricalPopulation.FieldFarmerHosts(HistoricalPopulationTests.Real(false)));
+}
diff --git a/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerRecordsTests.cs b/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerRecordsTests.cs
new file mode 100644
index 000000000..135af6977
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/HistoricalFieldFarmerRecordsTests.cs
@@ -0,0 +1,164 @@
+using System.Globalization;
+using Statecraft.Sim;
+
+/// <summary>#1725 PR 4 (Refs #1689): the 20 opening field farmers as Historical ledger records. Owner, 7 November 2026
+/// (#1689 comment 6704389240): "On top of census (Recommended)"; (comment 6704565066) "Yes to all three (Recommended)":
+/// every farmer staffed on their field from turn 1, one added housing place per farmer in their host; (comment 6704985642)
+/// "Per host, 1/18/1 (Recommended)". Owner, 7 November 2026, relayed by the coordinator: Tiberias "F08 veteran, F03 novice
+/// (Recommended)"; work XP "0 for all (Recommended)"; housing at Nir Am and Nirim "None for those two for now
+/// (Recommended)". Maintainer calls (the coordinator, 7 November 2026): source key field/&lt;label&gt;, ordinal 0; reception
+/// done (reception.turns), as for the census.</summary>
+public class HistoricalFieldFarmerRecordsTests
+{
+ const string Prefix = "field/F";
+
+ static Content Gdd03() => HistoricalPopulationTests.Real(true);
+ static GameState Dark(Content c) => Simulation.NewGame(c, 1, Mode.Historical, darkStart: true);
+
+ static (string Label, string Host, string Region, string FieldId)[] Fields(Content c) => c.PlayerRegions.Regions.Values
+ .SelectMany(r => r.FieldHosts.Select(h => (h.Field, h.Host, r.Id,
+ "field/" + h.Q.ToString(CultureInfo.InvariantCulture) + "," + h.R.ToString(CultureInfo.InvariantCulture))))
+ .OrderBy(x => x.Field, StringComparer.Ordinal).ToArray();
+
+ static List<(HistoricalPopulationRow Row, PopulationUnit Unit)> Farmers(Content c)
+ {
+ var rows = HistoricalPopulation.Inventory(c);
+ var units = HistoricalPopulation.LedgerFixture(c).PopulationLedger.Units;
+ return rows.Select((r, i) => (r, units[i])).Where(x => x.r.Source.StartsWith(Prefix, StringComparison.Ordinal)).ToList();
+ }
+
+ // "On top of census": 20 records, one per field, source field/<label> with ordinal 0 (maintainer call), added to the
+ // census's R-CITY-007 units and the soldiers, not taken from them.
+ [Fact]
+ public void TwentyFarmerRecordsAreAddedOnTopOfTheCensus()
+ {
+ var c = Gdd03();
+ var rows = HistoricalPopulation.Inventory(c);
+ var farmers = rows.Where(r => r.Source.StartsWith(Prefix, StringComparison.Ordinal)).ToList();
+ Assert.Equal(Fields(c).Select(f => "field/" + f.Label), farmers.Select(r => r.Source));
+ Assert.All(farmers, r => { Assert.Equal(0, r.Ordinal); Assert.Equal(PopulationStatus.FreeCivilian, r.Status); });
+ Assert.Equal(20, farmers.Count);
+ Assert.Equal(c.Cities.Sum(x => x.Civilians), rows.Count(r => r.Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)));
+ Assert.Equal(c.Cities.Sum(x => x.Civilians) + HistoricalPopulation.OpeningFormations(c).Sum(f => f.Strength) + 20, rows.Count);
+ }
+
+ // "every farmer is staffed on their field from turn 1": a free civilian farmer with the field's Work assignment, living
+ // in the field's host (its region, city = host), reception done (maintainer call), work XP 0 (owner, relayed: "0 for
+ // all (Recommended)"), no military fields, no tools (#1693: "Tools in the MVP: no.").
+ [Fact]
+ public void EachFarmerIsStaffedOnItsFieldFromTurnOne()
+ {
+ var c = Gdd03();
+ var byLabel = Fields(c).ToDictionary(f => "field/" + f.Label, StringComparer.Ordinal);
+ var farmers = Farmers(c);
+ Assert.Equal(20, farmers.Count);
+ foreach (var (row, u) in farmers)
+ {
+ var f = byLabel[row.Source];
+ Assert.Equal(PopulationStatus.FreeCivilian, u.Status);
+ Assert.Equal(PopulationAssignmentKind.Work, u.Assignment.Kind);
+ Assert.Equal(f.FieldId, u.Assignment.Target);
+ Assert.Equal(f.Region, u.Location!.Region);
+ Assert.Equal(f.Host, u.Location.City);
+ Assert.Equal(CivilianProfession.Farmer, u.Profession);
+ Assert.Equal(0, u.WorkXp);
+ Assert.Equal(c.RequirePopulationInteger("reception.turns"), u.ReceptionTicks);
+ Assert.Equal("", u.Qualification);
+ Assert.Equal(0, u.CombatXp);
+ Assert.Null(u.Equipment.ToolsId);
+ Assert.False(u.Equipment.ToolsPaid);
+ Assert.Null(u.Equipment.MilitaryId);
+ }
+ }
+
+ // Tiers: 1:2:1 per host (Gdd03FarmerTierSplit), in field-label order within a host. Tiberias (F03 to F08) is the only
+ // host with more than one tier: owner, relayed, "F08 veteran, F03 novice (Recommended)". 1 / 18 / 1 nationally.
+ [Fact]
+ public void TiersFollowThePerHostSplitWithF03NoviceAndF08Veteran()
+ {
+ var c = Gdd03();
+ var tiers = Farmers(c).ToDictionary(x => x.Row.Source, x => x.Unit.Tier, StringComparer.Ordinal);
+ Assert.Equal(CivilianTier.Novice, tiers["field/F03"]);
+ foreach (var l in new[] { "F04", "F05", "F06", "F07" }) Assert.Equal(CivilianTier.Trained, tiers["field/" + l]);
+ Assert.Equal(CivilianTier.Veteran, tiers["field/F08"]);
+ Assert.Equal(18, tiers.Values.Count(t => t == CivilianTier.Trained));
+ Assert.Equal(1, tiers.Values.Count(t => t == CivilianTier.Novice));
+ Assert.Equal(1, tiers.Values.Count(t => t == CivilianTier.Veteran));
+ var hostOf = Fields(c).ToDictionary(f => "field/" + f.Label, f => f.Host, StringComparer.Ordinal);
+ foreach (var h in HistoricalPopulation.FieldFarmerHosts(c))
+ {
+ var mine = tiers.Where(t => hostOf[t.Key] == h.Host).Select(t => t.Value).ToList();
+ Assert.Equal((h.Novice, h.Trained, h.Veteran),
+ (mine.Count(t => t == CivilianTier.Novice), mine.Count(t => t == CivilianTier.Trained), mine.Count(t => t == CivilianTier.Veteran)));
+ }
+ }
+
+ // "one added housing place per farmer in their host": the dark start adds each census host's farmers to its city's
+ // housing capacity. Nir Am and Nirim have no city record: "None for those two for now (Recommended)", so 18 of the 20
+ // places exist until the housing producer (#1725 PR 7). The public NewGame is unchanged.
+ [Fact]
+ public void TheDarkStartAddsOneHousingPlacePerFarmerInCensusHostsOnly()
+ {
+ var c = Gdd03();
+ var dark = Dark(c);
+ var pub = Simulation.NewGame(c, 1, Mode.Historical);
+ var hosted = Fields(c).GroupBy(f => f.Host).ToDictionary(g => g.Key, g => g.Count(), StringComparer.Ordinal);
+ foreach (var x in pub.Cities.Values)
+ Assert.Equal(x.HousingCapacity + (hosted.TryGetValue(x.Id, out var n) ? n : 0), dark.Cities[x.Id].HousingCapacity);
+ Assert.Equal(18, dark.Cities.Values.Sum(x => x.HousingCapacity) - pub.Cities.Values.Sum(x => x.HousingCapacity));
+ Assert.Equal(pub.Cities.Keys.OrderBy(k => k, StringComparer.Ordinal), dark.Cities.Keys.OrderBy(k => k, StringComparer.Ordinal));
+ Assert.DoesNotContain("nir_am", dark.Cities.Keys);
+ Assert.DoesNotContain("nirim", dark.Cities.Keys);
+ Assert.Equal(c.Cities.Single(x => x.Id == "haifa").HousingCapacity, pub.Cities["haifa"].HousingCapacity);
+ }
+
+ // Farmers stay out of the employed (R-CITY-007) and so out of R-OBJ-004's employed and civilians: the dark start's
+ // cities keep the census's civilians and employed, and every farmer holds a field, not an Industry or city job.
+ [Fact]
+ public void FarmersStayOutOfTheEmployedAndRObj004()
+ {
+ var c = Gdd03();
+ var dark = Dark(c);
+ var pub = Simulation.NewGame(c, 1, Mode.Historical);
+ var farmers = dark.PopulationLedger.Units.Where(u => u.Profession == CivilianProfession.Farmer).ToList();
+ Assert.Equal(20, farmers.Count);
+ var fields = new HashSet<string>(Gdd03FieldFixture.Fields(c).Select(f => f.Id), StringComparer.Ordinal);
+ Assert.All(farmers, u => Assert.Contains(u.Assignment.Target!, fields));
+ foreach (var x in pub.Cities.Values)
+ {
+ Assert.Equal(x.Employed, dark.Cities[x.Id].Employed);
+ Assert.Equal(x.Civilians, dark.Cities[x.Id].Civilians);
+ Assert.Equal(x.Craftsmen, dark.Cities[x.Id].Craftsmen);
+ }
+ }
+
+ // R-TRAIN-001: Train takes "civilians without a job". A farmer holds its field's Work assignment, so no farmer is an
+ // unassigned free civilian, and the aggregate Train pool (Training.Available) is the public start's in every city.
+ [Fact]
+ public void FarmersAreNotInTheTrainPool()
+ {
+ var c = Gdd03();
+ var dark = Dark(c);
+ var pub = Simulation.NewGame(c, 1, Mode.Historical);
+ var farmers = dark.PopulationLedger.Units.Where(u => u.Profession == CivilianProfession.Farmer).ToList();
+ Assert.Equal(20, farmers.Count);
+ Assert.DoesNotContain(farmers, u => u.Assignment.Kind == PopulationAssignmentKind.Unassigned);
+ foreach (var id in pub.Cities.Keys)
+ Assert.Equal(Training.Available(pub, id, Array.Empty<Command>()), Training.Available(dark, id, Array.Empty<Command>()));
+ }
+
+ // R-POP-001: field/ rows are the Historical start's, like census/ and units_1948/, so another fixture mode refuses them.
+ [Fact]
+ public void FarmerRowsNeedAHistoricalLedger()
+ {
+ var c = Gdd03();
+ var region = c.PlayerRegions.Regions.Keys.First();
+ var bindings = new PopulationBindings(new[] { new PopulationLocation(region) }, Array.Empty<PopulationTarget>(),
+ Array.Empty<string>(), Array.Empty<string>());
+ var row = new PopulationInventoryRow("field/F01", 0, new PopulationUnit(0, PopulationStatus.FreeCivilian, 0,
+ new PopulationLocation(region), PopulationAssignment.Unassigned, CivilianProfession.None, CivilianTier.None, 0, "", 0,
+ PopulationEquipment.None));
+ var open = new GameState(c);
+ Assert.Throws<ArgumentException>(() => open.PopulationLedger.Initialize(c, bindings, new[] { row }, 0, Mode.Open));
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/HistoricalPioneerTeacherTests.cs b/sim/Statecraft.Sim.Tests/HistoricalPioneerTeacherTests.cs
index 7ea2eae6a..c4899c20c 100644
--- a/sim/Statecraft.Sim.Tests/HistoricalPioneerTeacherTests.cs
+++ b/sim/Statecraft.Sim.Tests/HistoricalPioneerTeacherTests.cs
@@ -85,7 +85,7 @@ public class HistoricalPioneerTeacherTests
_ = new Gdd03TrainingCentreFixture(c, state, new[] {
new Gdd03FixtureTrainingCentre("centre/haifa", c.PlayerRegions.AtLocation("haifa")!.Id, operating: true) });
Assert.Equal(before, state.Hash());
- var t = state.PopulationLedger.Units.Single(u => u.Profession != CivilianProfession.None);
+ var t = state.PopulationLedger.Units.Single(u => u.Profession == CivilianProfession.Pioneer); // the farmers (#1725 PR 4) are the other professions
Assert.True(Gdd03ReceptionFixture.CanStartCivilianActivity(c, state.PopulationLedger, t));
}
diff --git a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs
index a6aec07ef..b481b862b 100644
--- a/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs
+++ b/sim/Statecraft.Sim.Tests/HistoricalPopulationTests.cs
@@ -20,7 +20,9 @@ public class HistoricalPopulationTests
static int Count(IReadOnlyList<HistoricalPopulationRow> rows, string source) => rows.Count(r => r.Source == source);
// R-POP-004, R-CITY-007, R-UNIT-006, R-CITY-008: one record per census population unit in each city and per population
- // unit of each Israeli starting formation, no more and no less, checked against the aggregate start of the same content.
+ // unit of each Israeli starting formation, checked against the aggregate start of the same content, plus the 20 opening
+ // field farmers on top of the census (#1725 PR 4; owner, 7 November 2026, #1689: "On top, change the rule
+ // (Recommended)"), no more and no less.
[Fact]
public void RealInventoryHoldsTheCensusCitiesAndTheStartingFormationsNoMoreNoLess()
{
@@ -40,14 +42,19 @@ public class HistoricalPopulationTests
foreach (var u in own)
Assert.Equal(u.Strength, Count(rows, HistoricalPopulation.FormationPrefix + c.StartingForces[u.Id].Row));
- var expected = start.Cities.Values.Sum(x => x.Civilians) + own.Sum(u => u.Strength);
+ var farmers = HistoricalPopulation.FieldFarmerHosts(c).Sum(h => h.Farmers);
+ Assert.Equal(20, farmers);
+ var expected = start.Cities.Values.Sum(x => x.Civilians) + own.Sum(u => u.Strength) + farmers;
Assert.Equal(expected, rows.Count);
Assert.All(rows.Where(r => r.Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)),
r => Assert.Equal(PopulationStatus.FreeCivilian, r.Status));
Assert.All(rows.Where(r => r.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)),
r => Assert.Equal(PopulationStatus.ActiveSoldier, r.Status));
+ Assert.All(rows.Where(r => r.Source.StartsWith(HistoricalPopulation.FarmerPrefix, StringComparison.Ordinal)),
+ r => Assert.Equal(PopulationStatus.FreeCivilian, r.Status));
Assert.All(rows, r => Assert.True(r.Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)
- || r.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)));
+ || r.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)
+ || r.Source.StartsWith(HistoricalPopulation.FarmerPrefix, StringComparison.Ordinal)));
}
// R-POP-004, R-CITY-006, R-CITY-007: an anchor independent of the loader. The census sources are exactly the twelve
@@ -186,7 +193,7 @@ public class HistoricalPopulationTests
var rows = LedgerRows(inventory.Where(r => r.Source.StartsWith(prefix, StringComparison.Ordinal)).Take(1).ToList());
Assert.Single(rows);
var e = Assert.Throws<ArgumentException>(() => PopulationLedger.CreateFixture(c, PopulationLedgerTests.Bindings(), rows, mode: mode));
- Assert.Equal("Census and units_1948 rows are the Historical start's; their fixture needs mode Historical (R-POP-004).", e.Message);
+ Assert.Equal("Census, units_1948 and field rows are the Historical start's; their fixture needs mode Historical (R-POP-004).", e.Message);
}
}
@@ -312,7 +319,7 @@ public class HistoricalPopulationTests
}
// R-POP-004, #1689 PR 1 city binding: each census record's location names its city, in that city's region; a formation
- // record's location names no city.
+ // record's location names no city. A farmer's names its host (HistoricalFieldFarmerRecordsTests).
[Fact]
public void EveryCensusRecordIsBoundToItsCity()
{
@@ -328,7 +335,7 @@ public class HistoricalPopulationTests
Assert.Equal(city, units[i].Location!.City);
Assert.Equal(c.PlayerRegions.AtLocation(city)!.Id, units[i].Location!.Region);
}
- else Assert.Null(units[i].Location!.City);
+ else if (source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)) Assert.Null(units[i].Location!.City);
}
}
diff --git a/sim/Statecraft.Sim/HistoricalPopulation.cs b/sim/Statecraft.Sim/HistoricalPopulation.cs
index ad45817d8..ec6031285 100644
--- a/sim/Statecraft.Sim/HistoricalPopulation.cs
+++ b/sim/Statecraft.Sim/HistoricalPopulation.cs
@@ -20,6 +20,34 @@ namespace Statecraft.Sim
}
}
+ /// <summary>#1725 PR 4, the ruled part (#1689): one host's opening field farmers, before any farmer record exists.
+ /// <see cref="Fields"/> are the Gdd03FieldFixture ids (field/q,r) of the fields it hosts, in field-label order; one farmer
+ /// each (owner, 3 November 2026, #1694: "One farmer per field (Recommended)"), split 1:2:1 per host by
+ /// <see cref="Gdd03FarmerTierSplit"/> (owner, 7 November 2026, #1689: "Per host, 1/18/1 (Recommended)"), with one housing
+ /// place per farmer (owner, 7 November 2026, #1689: "Yes to all three (Recommended)").</summary>
+ internal sealed class HistoricalFieldFarmerHost
+ {
+ public string Host { get; }
+ public string Region { get; }
+ public IReadOnlyList<string> Fields { get; }
+ /// <summary>The fields' regions.yaml labels (F01 to F20), in the same order as <see cref="Fields"/>: label order.</summary>
+ public IReadOnlyList<string> Labels { get; }
+ public int Novice { get; }
+ public int Trained { get; }
+ public int Veteran { get; }
+ public int Farmers => Fields.Count;
+ public int HousingPlaces => Farmers;
+ internal HistoricalFieldFarmerHost(string host, string region, IReadOnlyList<string> fields, IReadOnlyList<string> labels,
+ (int Novice, int Trained, int Veteran) split)
+ {
+ Host = host; Region = region; Fields = fields; Labels = labels; (Novice, Trained, Veteran) = split;
+ }
+ /// <summary>The tier of the farmer on <see cref="Labels"/>[i]: in label order, the novices first, then the trained,
+ /// then the veterans. Only Tiberias has more than one tier (owner, 7 November 2026, relayed by the coordinator:
+ /// "F08 veteran, F03 novice (Recommended)").</summary>
+ public CivilianTier TierAt(int i) => i < Novice ? CivilianTier.Novice : i < Novice + Trained ? CivilianTier.Trained : CivilianTier.Veteran;
+ }
+
/// <summary>R-POP-004 (#1689; owner, 1 November 2026, D2 and D4): the own population a gdd-0.3 Historical game starts with,
/// read from the content the aggregate start reads. Each census city gives its R-CITY-007 start units as free civilians;
/// each Israeli starting formation of map/units_1948.yaml (R-UNIT-006) gives its strength as active soldiers. Enemy
@@ -31,6 +59,9 @@ namespace Statecraft.Sim
{
internal const string CensusPrefix = "census/";
internal const string FormationPrefix = "units_1948/";
+ /// <summary>#1725 PR 4, maintainer call (the coordinator, 7 November 2026): an opening field farmer's source key is
+ /// this prefix plus the field's regions.yaml label (F01 to F20), ordinal 0, so it stays stable if a host changes.</summary>
+ internal const string FarmerPrefix = "field/";
/// <summary>The census city of the training centre's one veteran pioneer teacher (owner, 7 November 2026, #1689
/// comment 6704565066: "the training centre's one veteran pioneer teacher is a Haifa census unit").</summary>
internal const string TeacherCity = "haifa";
@@ -52,6 +83,10 @@ namespace Statecraft.Sim
foreach (var city in c.Cities) counts.Add((CensusPrefix + city.Id, city.Civilians, PopulationStatus.FreeCivilian));
foreach (var f in OpeningFormations(c))
counts.Add((FormationPrefix + f.Row, f.Strength, PopulationStatus.ActiveSoldier));
+ // #1725 PR 4: one free civilian a field, on top of the census (owner, 7 November 2026, #1689: "On top of census
+ // (Recommended)").
+ foreach (var h in FieldFarmerHosts(c))
+ foreach (var label in h.Labels) counts.Add((FarmerPrefix + label, 1, PopulationStatus.FreeCivilian));
if (counts.Select(x => x.Source).Distinct(StringComparer.Ordinal).Count() != counts.Count)
throw new InvalidOperationException("Duplicate Historical population source.");
var rows = new List<HistoricalPopulationRow>();
@@ -60,6 +95,59 @@ namespace Statecraft.Sim
return rows.AsReadOnly();
}
+ /// <summary>#1725 PR 4: the opening field farmers counted per host, ordered by host id (ordinal).
+ /// Owner, 7 November 2026, #1689: "On top of census (Recommended)", so these are added to the census, not taken
+ /// from it. Each field_hexes row's host (regions.yaml, #1717) hosts its field's one farmer; the loader has already
+ /// checked that the host is a member location of the field's region (Q27). A field with no host, or a total other
+ /// than the Agreed start.prepared_fields, is refused: no host or farmer count is invented. Nothing reads it yet:
+ /// <see cref="Inventory"/> and <see cref="Initialize"/> build the farmer records from it, and
+ /// <see cref="AddFarmerHousing"/> the dark start's housing places.</summary>
+ internal static IReadOnlyList<HistoricalFieldFarmerHost> FieldFarmerHosts(Content c)
+ {
+ if (c == null) throw new ArgumentNullException(nameof(c));
+ if (!c.UsesPopulationLedger) throw new InvalidOperationException("The Historical field farmers require gdd-0.3.");
+ var hostOf = new Dictionary<(int Q, int R), string>();
+ var labelOf = new Dictionary<(int Q, int R), string>();
+ foreach (var region in c.PlayerRegions.Regions.Values)
+ foreach (var h in region.FieldHosts) { hostOf.Add((h.Q, h.R), h.Host); labelOf.Add((h.Q, h.R), h.Field); }
+ var fields = Gdd03FieldFixture.Fields(c);
+ var unhosted = fields.Where(f => !hostOf.ContainsKey((f.Q, f.R))).Select(f => f.Id).ToList();
+ if (unhosted.Count > 0)
+ throw new InvalidOperationException("No field_hexes host in regions.yaml for " + string.Join(", ", unhosted) + " (R-POP-004, #1717).");
+ var prepared = c.RequirePopulationInteger("start.prepared_fields");
+ if (fields.Count != prepared)
+ throw new InvalidOperationException("The opening fields are " + fields.Count.ToString(CultureInfo.InvariantCulture)
+ + " but start.prepared_fields is " + prepared.ToString(CultureInfo.InvariantCulture) + "; one farmer per field (#1694, #1689).");
+ return fields.GroupBy(f => hostOf[(f.Q, f.R)], StringComparer.Ordinal).OrderBy(g => g.Key, StringComparer.Ordinal)
+ .Select(g =>
+ {
+ var hosted = g.OrderBy(f => labelOf[(f.Q, f.R)], StringComparer.Ordinal).ToArray();
+ var region = g.Select(f => f.Region).Distinct(StringComparer.Ordinal).Single();
+ return new HistoricalFieldFarmerHost(g.Key, region, Array.AsReadOnly(hosted.Select(f => f.Id).ToArray()),
+ Array.AsReadOnly(hosted.Select(f => labelOf[(f.Q, f.R)]).ToArray()), Gdd03FarmerTierSplit.Split(hosted.Length));
+ }).ToList().AsReadOnly();
+ }
+
+ /// <summary>#1725 PR 4: the dark start's housing places for the opening farmers. Owner, 7 November 2026 (#1689 comment
+ /// 6704565066), "Yes to all three (Recommended)": one added housing place per farmer in their host, so each census
+ /// host's city gains its farmers' count in HousingCapacity. Nir Am and Nirim have no cities.yaml record and get none
+ /// (owner, relayed by the coordinator: "None for those two for now (Recommended)"): 18 of the 20 places, until the
+ /// housing producer (#1725 PR 7). Refuses, unchanged, a state whose census host city is missing.</summary>
+ internal static void AddFarmerHousing(Content c, GameState s)
+ {
+ if (s == null) throw new ArgumentNullException(nameof(s));
+ var census = c.Cities.Select(x => x.Id).ToHashSet(StringComparer.Ordinal);
+ var add = FieldFarmerHosts(c).Where(h => census.Contains(h.Host)).ToList();
+ var missing = add.Where(h => !s.Cities.ContainsKey(h.Host)).Select(h => h.Host).ToList();
+ if (missing.Count > 0) throw new InvalidOperationException("No city record for farmer host " + string.Join(", ", missing) + " (#1689).");
+ foreach (var h in add)
+ {
+ var x = s.Cities[h.Host];
+ s.Cities[h.Host] = new City(x.Id, checked(x.HousingCapacity + h.HousingPlaces), x.JobSlots, x.Civilians, x.Employed,
+ x.Refugees, x.Recruits, x.Condition, x.Craftsmen, x.JobsDefault, x.Qualified);
+ }
+ }
+
/// <summary>R-POP-004 (#1689 region slice): the Inventory as an initialized Historical ledger fixture, each record in
/// its real region of regions.yaml. A census record takes the region that lists its city (AtLocation), and its location names that city. A formation
/// record takes the region of its starting anchor hex (AtHex): the owner's ruling on #1689's open question 1
@@ -89,16 +177,27 @@ namespace Statecraft.Sim
if (sources.Contains(CensusPrefix + city.Id)) regions[CensusPrefix + city.Id] = c.PlayerRegions.AtLocation(city.Id)?.Id ?? "";
foreach (var f in c.StartingForces)
if (sources.Contains(FormationPrefix + f.Row)) regions[FormationPrefix + f.Row] = c.PlayerRegions.AtHex(f.Q, f.R)?.Id ?? "";
+ // #1725 PR 4: a farmer lives in its field's host, a member location of the field's region (Q27).
+ var farmer = new Dictionary<string, (string Host, string Field, CivilianTier Tier)>(StringComparer.Ordinal);
+ foreach (var h in FieldFarmerHosts(c))
+ for (int i = 0; i < h.Labels.Count; i++)
+ {
+ farmer[FarmerPrefix + h.Labels[i]] = (h.Host, h.Fields[i], h.TierAt(i));
+ regions[FarmerPrefix + h.Labels[i]] = h.Region;
+ }
var missing = regions.Where(x => x.Value == "").Select(x => x.Key).ToList();
if (missing.Count > 0)
throw new InvalidOperationException("No region in regions.yaml for " + string.Join(", ", missing) + " (R-POP-004).");
var locations = regions.Values.Distinct(StringComparer.Ordinal).ToDictionary(r => r, r => new PopulationLocation(r), StringComparer.Ordinal);
// A census record is bound to its city in that region; a formation record keeps the region-only location.
var placed = regions.ToDictionary(x => x.Key, x => x.Key.StartsWith(CensusPrefix, StringComparison.Ordinal)
- ? new PopulationLocation(x.Value, city: x.Key.Substring(CensusPrefix.Length)) : locations[x.Value], StringComparer.Ordinal);
+ ? new PopulationLocation(x.Value, city: x.Key.Substring(CensusPrefix.Length))
+ : farmer.TryGetValue(x.Key, out var fm) ? new PopulationLocation(x.Value, city: fm.Host) : locations[x.Value], StringComparer.Ordinal);
// A formation is its soldiers' ActiveService target, in the formation's region.
var targets = regions.Where(x => x.Key.StartsWith(FormationPrefix, StringComparison.Ordinal))
- .Select(x => new PopulationTarget(x.Key, PopulationAssignmentKind.ActiveService, x.Value));
+ .Select(x => new PopulationTarget(x.Key, PopulationAssignmentKind.ActiveService, x.Value))
+ // A field is its farmer's Work target in the field's region (Gdd03FieldFixture.Targets' ids, field/q,r).
+ .Concat(farmer.Select(x => new PopulationTarget(x.Value.Field, PopulationAssignmentKind.Work, regions[x.Key])));
// #1689 rows 5 to 8. Owner, 7 November 2026 (comment 6704389240): "Veteran for all 8 (Recommended)" and "1 each,
// Negev 0 (Recommended)", Negev's 0 a labelled stand-in. Maintainer call, eyalgolan-30's coordinator, 7 November
// 2026: the veteran level lives on the formation (a veteran_soldier, R-UNIT-006, each soldier's ActiveService
@@ -116,7 +215,8 @@ namespace Statecraft.Sim
throw new InvalidOperationException("No gdd03-start.yaml formation_combat_xp for formation " + f.Row + "; no fallback (#1689).");
soldier[FormationPrefix + f.Row] = (cls!, combatXp);
}
- var bindings = new PopulationBindings(locations.Values.Concat(placed.Values.Where(l => l.City != null)), targets,
+ var bindings = new PopulationBindings(locations.Values.Concat(placed.Values.Where(l => l.City != null)
+ .GroupBy(l => l.Canonical(), StringComparer.Ordinal).Select(g => g.First())), targets,
Array.Empty<string>(), soldier.Values.Select(x => x.Qualification).Distinct(StringComparer.Ordinal));
// reception.turns is the reception before free-civilian status (docs/gdd/balance.md:91), so a census free civilian
// starts with it done: R-VET-001 gives work XP only to a received free civilian. Soldiers keep 0 (not ruled).
@@ -137,11 +237,22 @@ namespace Statecraft.Sim
var teacher = inventory.Where(r => r.Source == teacherSource).OrderBy(r => r.Ordinal).LastOrDefault()
?? throw new InvalidOperationException("No " + teacherSource + " record for the veteran pioneer teacher (#1689).");
bool IsTeacher(HistoricalPopulationRow r) => ReferenceEquals(r, teacher);
+ // #1725 PR 4. Owner, 7 November 2026 (#1689 comment 6704565066), "Yes to all three (Recommended)": every farmer
+ // is staffed on their field from turn 1, so each holds its field's Work assignment. Tier: the per-host 1:2:1 split
+ // in label order (FieldFarmerHosts; owner, relayed by the coordinator: "F08 veteran, F03 novice (Recommended)").
+ // Work XP 0 (owner, relayed: "0 for all (Recommended)"; veterans "0 (Recommended)", #1689 comment 6710877137).
+ // Reception done (reception.turns), as for the census (maintainer call, the coordinator, 7 November 2026). No
+ // tools: post-MVP (#1693 answer 1, "Tools in the MVP: no.").
+ PopulationAssignment Assignment(HistoricalPopulationRow r) => r.Status == PopulationStatus.ActiveSoldier
+ ? new PopulationAssignment(PopulationAssignmentKind.ActiveService, r.Source)
+ : farmer.TryGetValue(r.Source, out var f) ? new PopulationAssignment(PopulationAssignmentKind.Work, f.Field) : PopulationAssignment.Unassigned;
+ CivilianProfession Profession(HistoricalPopulationRow r) => IsTeacher(r) ? CivilianProfession.Pioneer
+ : farmer.ContainsKey(r.Source) ? CivilianProfession.Farmer : CivilianProfession.None;
+ CivilianTier Tier(HistoricalPopulationRow r) => IsTeacher(r) ? CivilianTier.Veteran
+ : farmer.TryGetValue(r.Source, out var f) ? f.Tier : CivilianTier.None;
var rows = inventory.Select(r => new PopulationInventoryRow(r.Source, r.Ordinal, new PopulationUnit(0, r.Status,
r.Status == PopulationStatus.FreeCivilian ? received : 0,
- placed[r.Source], r.Status == PopulationStatus.ActiveSoldier
- ? new PopulationAssignment(PopulationAssignmentKind.ActiveService, r.Source) : PopulationAssignment.Unassigned,
- IsTeacher(r) ? CivilianProfession.Pioneer : CivilianProfession.None, IsTeacher(r) ? CivilianTier.Veteran : CivilianTier.None, 0,
+ placed[r.Source], Assignment(r), Profession(r), Tier(r), 0,
r.Status == PopulationStatus.ActiveSoldier ? soldier[r.Source].Qualification : "",
r.Status == PopulationStatus.ActiveSoldier ? soldier[r.Source].CombatXp : 0, r.Status == PopulationStatus.ActiveSoldier
? new PopulationEquipment(militaryId: r.Source + "/" + r.Ordinal.ToString(CultureInfo.InvariantCulture), militaryPaid: true)
diff --git a/sim/Statecraft.Sim/PopulationLedger.cs b/sim/Statecraft.Sim/PopulationLedger.cs
index 0d8b6b307..9acf98fc5 100644
--- a/sim/Statecraft.Sim/PopulationLedger.cs
+++ b/sim/Statecraft.Sim/PopulationLedger.cs
@@ -308,8 +308,9 @@ namespace Statecraft.Sim
bindings.ValidateCities(c);
var ordered = rows.OrderBy(x => x.Source, StringComparer.Ordinal).ThenBy(x => x.Ordinal).ToList();
if (mode != Mode.Historical && ordered.Any(x => x.Source.StartsWith(HistoricalPopulation.CensusPrefix, StringComparison.Ordinal)
- || x.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)))
- throw new ArgumentException("Census and units_1948 rows are the Historical start's; their fixture needs mode Historical (R-POP-004).");
+ || x.Source.StartsWith(HistoricalPopulation.FormationPrefix, StringComparison.Ordinal)
+ || x.Source.StartsWith(HistoricalPopulation.FarmerPrefix, StringComparison.Ordinal)))
+ throw new ArgumentException("Census, units_1948 and field rows are the Historical start's; their fixture needs mode Historical (R-POP-004).");
l.peoplePerUnit = mode == Mode.Historical ? HistoricalPeoplePerUnit(c) : c.PopulationPeoplePerUnit;
l.receptionLimit = c.RequirePopulationInteger("reception.turns");
l.NextPopulationId = nextPopulationId;
diff --git a/sim/Statecraft.Sim/Simulation.cs b/sim/Statecraft.Sim/Simulation.cs
index d62bd4f31..8a9c0528f 100644
--- a/sim/Statecraft.Sim/Simulation.cs
+++ b/sim/Statecraft.Sim/Simulation.cs
@@ -26,6 +26,7 @@ namespace Statecraft.Sim
PopulationSystem.Init(c, s);
Cities.Init(c, s);
if (darkStart) HistoricalPopulation.Initialize(c, s); // before Pools.Init, which reads the ledger's need
+ if (darkStart) HistoricalPopulation.AddFarmerHousing(c, s); // #1725 PR 4: one housing place per farmer in a census host
Pools.Init(c, s);
StartingForces.Init(c, s); // R-UNIT-006: before any event can grant a unit, so the forces take ids 0 to n-1
SecuritySystem.Init(c, s, why);