A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: annex or withdraw after an occupation, residents flee at capture (GDD Phase 6 PR 7, Refs #799) (#1526)
Beried3650e4e307
diff --git a/changelog.d/sim-gdd-annex-799.md b/changelog.d/sim-gdd-annex-799.mdnew file mode 100644index 000000000..40b0a2304--- /dev/null+++ b/changelog.d/sim-gdd-annex-799.md@@ -0,0 +1,7 @@+- Annex or withdraw when an occupation ends, GDD Phase 6 PR 7 (#799). Each target row says whether its residents fled or+ stayed (#793's per-place ruling). The residents of a fled town are recorded as fled when it is captured, and the record+ stays after a Raid or any other return to enemy control; the town can be captured again. `EndOccupation` offers Annex+ and Withdraw; there is no puppet regime. Annexing a fled town adds land only; annexing Acre or Nazareth adds one city+ from its census-day count (approved by the owner on #799). An annexed town stays Israeli with no upkeep. New+ golden `mvp-annex-nazareth`; no other golden moves. Deport of a fled town is refused with its reason (the owner's+ ruling), and `EndOccupation` needs an Israeli military unit on the town for Withdraw as for Annex.diff --git a/content/rules.yaml b/content/rules.yamlindex 1c70beffe..bf3864987 100644--- a/content/rules.yaml+++ b/content/rules.yaml@@ -27,6 +27,7 @@ attention_cost:move: 0 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6: unit orders are free)buy_arms: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6, D-G6, #781: one order, whatever the quantity)resolve_capture: 0 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6: unit orders are free; Q-TECH-3: one key, so Raid, Occupy and Deport cost the same; proposed on #797)+ end_occupation: 0 # DESIGN VALUE: owner-set balance, not a historical figure (D-A6: unit orders are free; R-CTRL-014: one key for Annex and Withdraw, as resolve_capture; proposed on #799)# Turn length on each security rung, rungs 1 to 5 (R-TURN-001). The GDD MVP plays monthly turns on every rung (D-B1), so# turns from 15 May 1948 end on the 15th of each month.turn_lengths: [month, month, month, month, month]diff --git a/content/settlement_targets.yaml b/content/settlement_targets.yamlindex 98319348e..efea9fe02 100644--- a/content/settlement_targets.yaml+++ b/content/settlement_targets.yaml@@ -1,14 +1,15 @@# GDD Phase 6 settlement-control targets (docs/gdd/settlement-control.md; R-CTRL-001). Owner ruling Q-TGT-1 (a), 18 October# 2026 (#783): only the `arab_town` rows of map/settlements_1948.yaml that a sourced operation names. Each row:-# { id, q, r, operation, sources: [{ url, checked }], status }+# { id, q, r, operation, sources: [{ url, checked }], residents, residents_sources, annexation (stayed only), status }# The list ships with the six rows the owner approved for list and sensitivity suitability on 19 October 2026# (https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6267660409), filled by the owner's go-ahead of# 21 October 2026 (#793). Gaza is excluded. The rows come from research_notes/GDD phase 6/settlement-targets.md, which keeps# the historical accounts, conflicts and source gaps. The owner sensitivity-reviewed the six rows and checked each row's-# operation against its sources (#793, https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840): each is `status: sensitivity-reviewed` (Q-TGT-3 (b)). The+# operation against its sources (#793, https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840): each was `status: sensitivity-reviewed` (Q-TGT-3 (b)); #799 returns them to `draft` for the residents fields. The# Morris link is a bibliographic record, not the book's text. Each `checked` date stays the research packet's# (18 October 2026).-# The game annotations of that ruling (residents' default outcome; Jaffa what-if only) are not fields of this file.+# residents (R-CTRL-016, #799): fled or stayed, per the owner's per-place ruling (#793); a stayed row's annexation block holds+# the people who join the player's population (OWNER QUESTION 1 (a) on #799). Jaffa is captured only in a what-if.# Capture applies only to a target also on mvp.enemy_held_localities (rules.yaml): jaffa is not, since it is Israeli-held# at the start, so it is captured only if an alternate-timeline card returns it to Arab control. lod and ramla share a hex.targets:@@ -19,8 +20,12 @@ targets:sources:- { url: "https://m.knesset.gov.il/About/Occasion/Documents/IndependenceWar.pdf", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: fled # Q-ANNEX-1: the ruling's default ("default is fled", #783); Jaffa is captured only in a what-if (#793)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draft- id: acreq: 7r: 6@@ -28,8 +33,19 @@ targets:sources:- { url: "https://m.knesset.gov.il/About/Occasion/Documents/IndependenceWar.pdf", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: stayed # Q-ANNEX-1: "Count as stayed" (owner, #793); about 5,000 remained after the surrender (Morris pp. 228-232)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Approved by the owner on #799, 24 Oct 2026 (OWNER QUESTION 1 (a), the starting-city rule): the census-day count,+ # 8 November 1948, CBS Statistical Abstract No. 3 (1951/52), list of settlements, p. 142, row "עכו (עיר)": 4,016. It counts+ # everyone present on the day, so it may include people displaced from elsewhere (research_notes/GDD phase 6/+ # annexation-residents.md).+ annexation:+ people: { value: 4016, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1952_num3.pdf", checked: 2026-10-23 }] }+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (Q-START-1: the national share, as cities.yaml's seven towns)+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draft- id: nazarethq: 7r: 10@@ -37,8 +53,19 @@ targets:sources:- { url: "https://m.knesset.gov.il/About/Occasion/Documents/IndependenceWar.pdf", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: stayed # Q-ANNEX-1: stayed (owner, #793); the expulsion order of 17 July was not carried out (Morris p. 419)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Approved by the owner on #799, 24 Oct 2026 (OWNER QUESTION 1 (a), the starting-city rule): the census-day count,+ # 8 November 1948, CBS Statistical Abstract No. 3 (1951/52), list of settlements, p. 141, row "נצרת (עיר)": 16,994. It counts+ # everyone present on the day, so it may include people displaced from elsewhere (research_notes/GDD phase 6/+ # annexation-residents.md).+ annexation:+ people: { value: 16994, status: sourced, date: 1948-11-08, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1952_num3.pdf", checked: 2026-10-23 }] }+ employed_share: { value: 0.439, status: design, sources: [{ url: "https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1951_num2.pdf", checked: 2026-10-15 }] } # DESIGN VALUE: owner-set balance, not a historical figure (Q-START-1: the national share, as cities.yaml's seven towns)+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draft- id: lodq: -3r: 21@@ -48,8 +75,12 @@ targets:- { url: "https://archives.mod.gov.il/sites/English/Exhibitions/Pages/Yitzhak-Rabin.aspx", checked: 2026-10-18 }- { url: "https://jewishvirtuallibrary.org/jsource/History/Danny.html", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: fled # Q-ANNEX-1: the ruling's default ("Default 'fled'; Morris isn't enough", #793)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draft- id: ramlaq: -3r: 21@@ -59,8 +90,12 @@ targets:- { url: "https://archives.mod.gov.il/sites/English/Exhibitions/Pages/Yitzhak-Rabin.aspx", checked: 2026-10-18 }- { url: "https://jewishvirtuallibrary.org/jsource/History/Danny.html", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: fled # Q-ANNEX-1: the ruling's default ("Default 'fled'; Morris isn't enough", #793)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draft- id: beershebaq: -9r: 31@@ -69,5 +104,9 @@ targets:- { url: "https://m.knesset.gov.il/About/Occasion/Documents/IndependenceWar.pdf", checked: 2026-10-18 }- { url: "https://jewishvirtuallibrary.org/jsource/History/Yoav.html", checked: 2026-10-18 }- { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }- # The owner sensitivity-reviewed this row (#793): https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840- status: sensitivity-reviewed+ residents: fled # Q-ANNEX-1: the ruling's default ("Default 'fled'; Morris isn't enough", #793)+ residents_sources:+ - { url: "https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6252718065", checked: 2026-10-23 }+ - { url: "https://www.cambridge.org/core/books/birth-of-the-palestinian-refugee-problem-revisited/8AE72A6813CEA7DDDE8F9386313F0D97", checked: 2026-10-18 }+ # Back to draft for the owner's sensitivity review of the residents fields (#799); the row was sensitivity-reviewed on #793.+ status: draftdiff --git a/docs/GDD.md b/docs/GDD.mdindex 138cef7dd..f558e9ee2 100644--- a/docs/GDD.md+++ b/docs/GDD.md@@ -189,6 +189,8 @@ The player selects one of three outcomes:After X turns of occupation, the player chooses to install a puppet regime or annex the settlement. X is unset. A puppet regime provides indirect control; annexation incorporates the settlement into the player's territory. Population management, jobs, housing, defense responsibilities and resource access under each outcome are open.+**Then decided (owner, 18 Oct 2026, Q-PUP-1 (c), [#783](https://github.com/eyalgolan/statecraft-israel/issues/783#issuecomment-6249846499); 22 Oct 2026, Q-OCC-3, [#1324](https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839); 24 Oct 2026, in the coordinator session, "1520: do this: 1. When the player annexes a town whose residents stayed (Acre, Nazareth), how many people, homes and jobs join the game? - a. The same rule as the 12 starting cities: a sourced resident count you approve. (Recommended) 2.b 3.a"; [#799](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6374876433)):** no puppet regime in the MVP. X is six monthly turns. When an occupation ends the player annexes or withdraws. The residents of a fled town are recorded as fled when it is captured, and the record of the flight stays after a Raid. A town emptied by flight adds land only. A town whose residents stayed (Acre, Nazareth) adds one city by the starting-city rule, from a sourced resident count the owner approves. An annexed town stays Israeli for good, with no upkeep and no unit that has to stay. For a town whose residents already fled at capture, Deport stays listed and is refused with its reason (OWNER QUESTION 4 (a), owner, 24 Oct 2026, "Hide it, button explains (Recommended)", [#799](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6375591758)). Rules R-CTRL-014 to R-CTRL-017.+Open: when is a settlement captured, what constitutes enemy control, and can an occupying force withdraw before the timer ends? Capturing enemy soldiers earns the bonus specified in the MVP objectives. Settlement-control rewards and political penalties remain open.## Events and consequencesdiff --git a/docs/determinism.md b/docs/determinism.mdindex ae3651c3d..df6a9c188 100644--- a/docs/determinism.md+++ b/docs/determinism.md@@ -21,7 +21,7 @@ The simulation must produce the same state, bit for bit, on .NET, Unity Mono and- **Settlement control:** the player capture check runs after the route step and each order, then again in resolverstep 3 after enemy combat. Each check visits targets in ordinal id order and reads only unit positions, with no RNGdraw (R-CTRL-004; `CaptureTests.SettlementsResolveInOrdinalOrder`, `NoRngDraw` and `TheInstantCheckDrawsNothing`).- The shipped list has six targets (#793), and only `mvp-occupy-cost` captures a place (Nazareth): player units may+ The shipped list has six targets (#793), and only `mvp-occupy-cost` and `mvp-annex-nazareth` capture a place (Nazareth, whose residents stayed, so no golden records a flight, `fled=1`, #799): player units mayenter the five enemy-held ones since #1304 (R-MOVE-005), but the reference player sends no Move, so none of its units stands on one, and its unit onJaffa's hex (shared with Tel Aviv) captures nothing, since Jaffa is not enemy-held at the start. The smoke-ordersmove skips the lit hexes of enemy-held places on purpose (`GoldenRun.SmokeMove`), so it stays a plain move.@@ -33,7 +33,7 @@ The simulation must produce the same state, bit for bit, on .NET, Unity Mono andits hex, with no RNG draw (R-CTRL-011 to R-CTRL-013; `OccupyTests.TheTimerCountsDownInStepTen` and`OccupationDrawsNothing`). `mvp-occupy-cost` (#798) is the golden that occupies a place: it plays the real content, movesGolani's unit onto Nazareth, answers the capture with Occupy and runs to the end of the timer; `OccupyTests` plays the- same run on fixture content. No other golden occupies a place, so none moves.+ same run on fixture content. `mvp-annex-nazareth` (#799) plays the same run and annexes Nazareth when the timer ends (R-CTRL-016): one new city from the row's count, with no RNG draw (`EndOccupationTests`). No other golden occupies a place, so none moves.- **Deport (resolver step 10, after the occupation timers):** the units leave as in Raid; the costs, the drag (each turn,per place in `DisplacedByPlayer`) and the International Support ceiling are plain arithmetic on the indicator's shift,with no RNG draw (R-CTRL-018; `DeportTests.DeportDrawsNothing`). `DisplacedByPlayer` is hashed as `displaced=` only when@@ -431,3 +431,4 @@ The hash reads the state keys, so it never sees a record outside its window. An| #80: rationing, rationing_feeds and rationing_grates from 10 March 1949 (owner ruling 22 Oct 2026) | scenario-cautious | `f672a0f3` | rationing can no longer be set on 15 May 1948, so the scenario sets it (0.4) on the first turn the office exists (15 March 1949) and runs to 15 April 1949 (was 15 January 1949) so it acts; the snapshot moves with the three extra turns (was `95982cf8`) || #80: rationing, rationing_feeds and rationing_grates from 10 March 1949 (owner ruling 22 Oct 2026) | scenario-reckless | `cb1c96d5` | same as cautious, rationing 1.0 (was `6650ed3e`) || #798: the `mvp-occupy-cost` golden (the plan's PR 6 scenario; owner, 23 Oct 2026, now that a capture is reachable in play, #1304) | scenario-mvp-occupy-cost | `a767bb66` | new: Golani's unit moves to Nazareth on 15 May 1948, the scenario answers the capture with Occupy on 15 June, and the run ends on 15 December 1948 with Nazareth awaiting `EndOccupation` (`since=1948-06-15`). No existing golden moves |+| #799: the `mvp-annex-nazareth` golden (the plan's Task 6, #1520) | scenario-mvp-annex-nazareth | `d37e6db4` | new: `mvp-occupy-cost`'s two steps, then `end_occupation nazareth annex` on 15 December 1948, run to 15 January 1949. Nazareth ends `owner=israel,state=annexed,since=1948-06-15` and is a city of 17 units, 7 employed (16,994 people, the census-day count the owner approved on #799, times the national share 0.439), housing 17. It pins the approved count. The fled field and EndOccupation move no existing golden: `mvp-occupy-cost` captures Nazareth (stayed) and keeps `a767bb66` |diff --git a/docs/gdd/settlement-control.md b/docs/gdd/settlement-control.mdindex 503fad2da..c23a99b3a 100644--- a/docs/gdd/settlement-control.md+++ b/docs/gdd/settlement-control.md@@ -9,7 +9,7 @@ As the player, I want a captured settlement to present a sober choice between le- Only `arab_town` rows of `settlements_1948.yaml` that a sourced operation names may enter the curated target list (R-CTRL-001). Jaffa and Gaza require the target research before they can enter it. Every target row is `sensitivity-reviewed`, and an unreviewed row is refused by the release gate (`Q-TGT-1`, `Q-TGT-3`, owner ruling [S3]). **Then decided (owner, 18 Oct 2026, "Only in a what-if"; [#793](https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6254333177)):** Jaffa stays on the target list, but is a target in play only if an alternate-timeline card returns it to Arab control; in the historical course it is Israeli-held from the start and no capture decision is offered [S9].- Enemy units may capture the player's localities. The capture changes their state, and every place tied by sources to a dated loss receives a sourced card. A capture that exists only in an alternate timeline also requires researched cards (`Q-TGT-2`; planned R-CTRL-006; owner ruling [S3]).- Settlement state uses one immutable record per settlement in an ordinal `SortedDictionary<string, SettlementControl>`. It is written to the deterministic hash as `ctrl{...}` only when non-empty, and each field is written only when it differs from its default. `DisplacedByPlayer` is an integer count of places and is written only when non-zero (`Q-TECH-2`, `Q-CAP-2`; R-CTRL-002 for the collection; owner rulings [S3], [S4]).-- Residents and combatants are distinct. The state records only whether a place is inhabited, not a resident count, and only enemy military units on its hex are combatants (`Q-CAP-2`, `Q-CAP-3`; R-CTRL-003; owner ruling [S4]).+- Residents and combatants are distinct. The state records whether a place is inhabited, fled or depopulated, not a resident count, and only enemy military units on its hex are combatants (`Q-CAP-2`, `Q-CAP-3`; R-CTRL-003; owner ruling [S4]).- A target is captured the moment a player unit's move ends on its hex while no enemy combatant is there. The capture answer still takes effect at End turn (`Q-CAP-1` / `D-F2`; R-CTRL-004, R-CTRL-005; owner ruling [S4]; owner, 23 October 2026, #1402 and #1398: "Instant", "Yes, answer at End turn" and "Approve, start building").- A capture awaiting a decision remains pending and the player's units stay in place. What happens if that decision is still pending at the MVP's end remains open (`Q-HIST-1`; planned R-CTRL-008; owner ruling [S5]). **Then decided (owner, 18 Oct 2026, "Counts as Raid"; [#797](https://github.com/eyalgolan/statecraft-israel/issues/797#issuecomment-6254333420)):** at the MVP's end the units leave, nothing changes for the residents and the pending capture adds nothing to the score [S10].- Capture outcomes use one `ResolveCapture(settlement, outcome)` command and one Attention-cost key. End-of-occupation outcomes likewise use one `EndOccupation(settlement, outcome)` command. The capture dialog reads its options and cost preview from public simulation helpers and sends the selected command through the existing queue; it holds no rule of its own (`Q-TECH-3`, `Q-TECH-5`; owner ruling [S3]).@@ -19,6 +19,7 @@ As the player, I want a captured settlement to present a sober choice between le- The MVP has no puppet-regime outcome. When an occupation ends, the choices are annex or withdraw (`Q-PUP-1` / `D-F4`; planned R-CTRL-015; owner ruling [S6]).- On capture, the residents of a target place are recorded as having fled, unless highly credible Israeli sources, such as an official or state-archive history, say otherwise for that place (in the owner's words, "default is fled, unless you have super credible israeli sources that say otherwise"). Every place's outcome is recorded in its reviewed target row. Where the residents stayed, annexation joins them to the player's population with their housing and jobs (`Q-ANNEX-1` / `D-F4`; planned R-CTRL-016; owner rulings [S6], [S7]).- A place emptied by flight grants territory only. Annexation of it grants no housing, jobs or score (`Q-ANNEX-1` follow-up; planned R-CTRL-016; owner ruling [S7]).+- **Then decided (owner, 24 Oct 2026, in the coordinator session; [#799](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6374876433)):** annexing a stayed town (Acre, Nazareth) adds one city by the starting-city rule, from a sourced resident count the owner approves (R-CTRL-016); a fled town's residents are recorded as fled at capture, and the record stays after any return to enemy control (R-CTRL-003 to R-CTRL-005, R-CTRL-010); an annexed town stays Israeli for good, with no upkeep and no unit that has to stay (R-CTRL-016). Deport of a town whose residents fled at capture stays listed third and is refused, with its reason on the button (OWNER QUESTION 4 (a), "Hide it, button explains (Recommended)"; R-CTRL-018; owner ruling [S12]). (unitless)- After Deport, the depopulated place offers neither puppet regime nor annexation; Deport ends the occupation permanently (`Q-ANNEX-2`; planned R-CTRL-017; owner ruling [S6]).- Deport follows impact-plan §4.1 items 1, 2, 3, 5 and 6 as written, with the two clerical fixes. It affects every resident the state holds and records only `DisplacedByPlayer`, with no destination on the board (`Q-DEP-1` to `Q-DEP-3`; owner ruling [S8]). (unitless)- Deportation and razing are separate rules, with no razing option in the MVP (`Q-DEP-4` / `D-F3`; owner ruling [S8]).@@ -71,6 +72,8 @@ As the player, I want a captured settlement to present a sober choice between le- [S8] [Owner decision, "Accept all 16 drafts"](https://github.com/eyalgolan/statecraft-israel/issues/783#issuecomment-6254310676), 18 October 2026, checked 2026-10-18.- [S9] [Owner decision, "Only in a what-if"](https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6254333177), 18 October 2026, checked 2026-10-18.- [S10] [Owner decision, "Counts as Raid"](https://github.com/eyalgolan/statecraft-israel/issues/797#issuecomment-6254333420), 18 October 2026, checked 2026-10-18.+- [S11] [Owner's answers to plan #1520](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6374876433), 24 October 2026, checked 2026-10-23.+- [S12] [Owner ruling on OWNER QUESTION 4, "Hide it, button explains (Recommended)"](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6375591758), 24 October 2026, checked 2026-10-24.## Open questionsdiff --git a/docs/oss/DECISIONS.md b/docs/oss/DECISIONS.mdindex 8cbceebcb..c5c58cac8 100644--- a/docs/oss/DECISIONS.md+++ b/docs/oss/DECISIONS.md@@ -93,3 +93,4 @@ The owner's answers to the questions in section 9 of `docs/superpowers/specs/202- **Then decided (owner, 23 Oct 2026, "Two-way, keep training"; [#1511](https://github.com/eyalgolan/statecraft-israel/issues/1511#issuecomment-6372356482)):** craftsmen, halutzim and veteran pioneers can return to civilian life, keep their qualification, and be reassigned either way without training again. Built under #1511: the qualification is kept as a count of qualified civilians inside each city's civilians (R-QUAL-001), so jobs, housing and income treat them as ordinary civilians; a halutz keeps its partial service (owner answer 3).- **Then decided (owner, 23 Oct 2026, "Freeze for MVP (Recommended)"; [#1512](https://github.com/eyalgolan/statecraft-israel/issues/1512#issuecomment-6372356819)):** the eight `hexes.json` biomes are the complete MVP terrain catalogue, with no terrain conversions.- **Then decided (owner, 23 Oct 2026, "Yes, complete (Recommended)"; [#1513](https://github.com/eyalgolan/statecraft-israel/issues/1513#issuecomment-6372357178)):** R-MIN-001 to R-MIN-003 and `Cabinet.Appoint` are the complete MVP minister mechanic (D-H3 closed).+- **Then decided (owner, 24 Oct 2026, in the coordinator session, "1520: do this: 1. When the player annexes a town whose residents stayed (Acre, Nazareth), how many people, homes and jobs join the game? - a. The same rule as the 12 starting cities: a sourced resident count you approve. (Recommended) 2.b 3.a"; [#799](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6374876433)):** for #799's plan (#1520): (1a) a stayed town that is annexed becomes one city by the starting-city rule, from a sourced count the owner approves; (2b) residents of a fled town are recorded as fled at capture; (3a) an annexed town stays Israeli for good, with no upkeep. OWNER QUESTION 4 (Deport of a fled town): **then decided (owner, 24 Oct 2026, "Hide it, button explains (Recommended)"; [#799](https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6375591758)):** (a), Deport stays listed and is refused with its reason. Implementation is #799.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex dba7e0bf5..72d226559 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -32,31 +32,39 @@ The ID R-LOOP-003 (the Phase 1 overlay, `MvpSlice.Overlay`) is retired with the## Settlement control-R-CTRL-001: Only a settlement in `settlement_targets.yaml` may be captured. Each target is an `arab_town` row of `map/settlements_1948.yaml` (Q-TGT-1 (a), owner ruling of 18 October 2026), stands on a land hex of `map/hexes.json` that is its own hex in `map/settlement_hexes.yaml`, names a sourced operation (each source an https URL with a `checked` date) and carries a review status; any other row is a load error naming file and field. The shipped list holds the six rows the owner approved on 19 October 2026 and filled on 21 October 2026 (#793: jaffa, acre, nazareth, lod, ramla, beersheba; Gaza excluded), each `status: draft` until a person checks its sources (D-F5).+R-CTRL-001: Only a settlement in `settlement_targets.yaml` may be captured. Each target is an `arab_town` row of `map/settlements_1948.yaml` (Q-TGT-1 (a), owner ruling of 18 October 2026), stands on a land hex of `map/hexes.json` that is its own hex in `map/settlement_hexes.yaml`, names a sourced operation (each source an https URL with a `checked` date) and carries a review status; any other row is a load error naming file and field. The shipped list holds the six rows the owner approved on 19 October 2026 and filled on 21 October 2026 (#793: jaffa, acre, nazareth, lod, ramla, beersheba; Gaza excluded), which the owner sensitivity-reviewed on #793. #799 adds each row's residents outcome (R-CTRL-016) and returns every row to `status: draft` until the owner reviews those fields, so the release gate holds them (D-F5).R-CTRL-002: Settlement control is an ordinal `SortedDictionary<string, SettlementControl>`. It is written to the state hash as `ctrl{...}` only when non-empty, in ordinal id order; each record field is written only when it differs from its default (R-LOOP-002).-R-CTRL-003: Residents and combatants are distinct fields. Residents are a state, inhabited or depopulated, not a count (Q-CAP-2 (b)). No rule reads residents as combatants, prisoners, refugee units, labour or a resource; annexation is the one place a later owner-approved rule may say otherwise.+R-CTRL-003: Residents and combatants are distinct fields. Residents are a state, inhabited, fled or depopulated, not a count (Q-CAP-2 (b)). Fled is the record's `Fled`, set at capture from the target row's `residents: fled` and never cleared (OWNER QUESTION 2 (b), owner, 24 October 2026, #799); flight is not Deport: it adds nothing to `DisplacedByPlayer` and costs nothing. No rule reads residents as combatants, prisoners, refugee units, labour or a resource; annexation is the one place a later owner-approved rule may say otherwise.-R-CTRL-004: The capture check runs after the route step and each order, and still in resolver step 3 after enemy combat, in ordinal settlement id (Q-CAP-1 (a), Q-CAP-3 (a), owner rulings of 18 October 2026). A target that starts under enemy control, one listed in `mvp.enemy_held_localities` (owner, 21 October 2026, #796), is captured at once when Israeli military units are on its hex and no enemy military unit is; only enemy military units are combatants (Q-CAP-3 (a)), and a halutz holds nothing (#796). Passing through a target does not capture it; only a move's or go-to's stopping hex counts (owner, 23 October 2026, OQ-2: "Instant"). Its record names `israel` as owner and has the state `awaiting_choice`; the preview leaves `Since` unset, and Step stamps the turn's end before the resolver, preserving the date through a same-turn answer. The answer stays deferred until End turn (R-TURN-004). A capture remains when the unit leaves; the player's units stay on the hex. A captured target still awaiting the choice that only enemy military units are on is under enemy control again, and its record is removed (#796). A target not enemy-held at the start (Jaffa, owner ruling of 18 October 2026 on #793, "Only in a what-if") is never captured. The check is an integer rule on unit positions and draws nothing from the RNG. Enemy captures of the player's localities (Q-TGT-2 (c), the plan's R-CTRL-006) are not built yet: with the real starting forces a Syrian unit stands on Degania Alef's hex with no Israeli unit, so the rule would record a capture at the first turn's end (#796).+R-CTRL-004: The capture check runs after the route step and each order, and still in resolver step 3 after enemy combat, in ordinal settlement id (Q-CAP-1 (a), Q-CAP-3 (a), owner rulings of 18 October 2026). A target that starts under enemy control, one listed in `mvp.enemy_held_localities` (owner, 21 October 2026, #796), is captured at once when Israeli military units are on its hex and no enemy military unit is; only enemy military units are combatants (Q-CAP-3 (a)), and a halutz holds nothing (#796). Passing through a target does not capture it; only a move's or go-to's stopping hex counts (owner, 23 October 2026, OQ-2: "Instant"). Its record names `israel` as owner and has the state `awaiting_choice`; the preview leaves `Since` unset, and Step stamps the turn's end before the resolver, preserving the date through a same-turn answer. The answer stays deferred until End turn (R-TURN-004). A capture remains when the unit leaves; the player's units stay on the hex. A captured target still awaiting the choice that only enemy military units are on is under enemy control again, and its record is removed (#796). A target not enemy-held at the start (Jaffa, owner ruling of 18 October 2026 on #793, "Only in a what-if") is never captured. The check is an integer rule on unit positions and draws nothing from the RNG. Enemy captures of the player's localities (Q-TGT-2 (c), the plan's R-CTRL-006) are not built yet: with the real starting forces a Syrian unit stands on Degania Alef's hex with no Israeli unit, so the rule would record a capture at the first turn's end (#796). A fled record goes back to enemy control as an ownerless record, `since=<capture date>,fled=1`, instead of being removed, after Raid, the timer's raid, the end-of-game raid and enemy units retaking an awaiting capture alike, and such a record (not depopulated) is no record for the capture check, so the place can be captured again; the new record keeps `fled=1` and takes the new turn's date. `Stamp` dates a fled record as it dates Deport's (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).-R-CTRL-005: Capture writes the settlement state only. It changes no resident field (the place stays inhabited), no unit, no resource, parameter, city or score, and counts towards no objective (constraint 6 of the Phase 6 plan; impact plan section 4.3).+R-CTRL-005: Capture writes the settlement state only. It changes no resident field except that a target whose row says `residents: fled` is recorded with `fled=1` and its capture line says its residents fled (OWNER QUESTION 2 (b), owner, 24 October 2026, #799), no unit, no resource, parameter, city or score, and counts towards no objective (constraint 6 of the Phase 6 plan; impact plan section 4.3).R-CTRL-007: `ResolveCapture(settlement, outcome)` answers a capture. It is one command kind for every outcome, with one `attention_cost.resolve_capture` (Q-TECH-3, owner, 18 October 2026, #783 batch 1), set at 0 as a design value proposed on #797 (D-A6: unit orders are free). It is valid only for a settlement whose record is awaiting the choice, including the turn of its instant capture until it is answered, and only for an outcome that is built. The answer remains deferred and runs at End turn (owner, 23 October 2026; R-TURN-004). Otherwise it is refused with a reason, the state unchanged and the Attention refunded: the place is not awaiting a decision, the outcome is not known, or Deport is not in play: with `mvp.deport_in_play` off, as in the real content until the owner has reviewed Deport's cards and dialog (Phase 6 PRs 9 and 10), it is refused as "not built yet" (R-CTRL-018). The legacy loop refuses it before charging Attention.-R-CTRL-008: `SettlementControl.CaptureOptions(content, state, settlement)` lists the outcomes in one fixed order, Raid and withdraw, Occupy, Deport, so Deport is never first (impact plan section 4.1 item 1). An option carries no default or selected flag. Each option has either the reason it is refused or a preview: the change resolving it makes at once to Attention, Money (the Treasury and the debt), Food, Arms, Social cohesion, International Support and the score, computed by resolving it on a copy of the state, so the preview is the outcome (spec section 2.6). A place not awaiting the choice offers no option. A capture the player does not answer waits, and the units stay (Q-HIST-1 (a), owner, 18 October 2026, #783 batch 3). On the turn that reaches the game's end, where resolver step 10 sits and before objectives and score, every capture still awaiting the choice counts as Raid, in ordinal id order (owner, 18 October 2026 on #797, "Counts as Raid"): the units leave as R-CTRL-010 says, nothing changes for the residents and the score gains nothing. A unit with nowhere to go stays while the others leave, and the record goes all the same. No unanswered choice ever resolves as Deport.+R-CTRL-008: `SettlementControl.CaptureOptions(content, state, settlement)` lists the outcomes in one fixed order, Raid and withdraw, Occupy, Deport, so Deport is never first (impact plan section 4.1 item 1). An option carries no default or selected flag. Each option has either the reason it is refused or a preview: the change resolving it makes at once to Attention, Money (the Treasury and the debt), Food, Arms, Social cohesion, International Support and the score, computed by resolving it on a copy of the state, so the preview is the outcome (spec section 2.6). A place not awaiting the choice offers no option. A capture the player does not answer waits, and the units stay (Q-HIST-1 (a), owner, 18 October 2026, #783 batch 3). On the turn that reaches the game's end, where resolver step 10 sits and before objectives and score, every capture still awaiting the choice counts as Raid, in ordinal id order (owner, 18 October 2026 on #797, "Counts as Raid"): the units leave as R-CTRL-010 says, nothing changes for the residents and the score gains nothing. A unit with nowhere to go stays while the others leave, and the record goes all the same. No unanswered choice ever resolves as Deport. A fled place's end-of-game raid keeps its ownerless fled record (R-CTRL-004) (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).R-CTRL-009: `HistoricalAI` answers every capture awaiting the choice with Raid, in ordinal id order, leaving out a Raid the sim would refuse (a unit with nowhere to go), which then waits, and the reference player sends `HistoricalAI`'s orders, so it does too (Q-REF-1 (a), owner, 18 October 2026, #783 batch 3). Neither ever issues Deport, and nothing delegates a capture: `EventSystem.Delegate` answers events only (impact plan section 4.1 item 1).-R-CTRL-010: Raid and withdraw (Q-RAID-1 (a), owner, 18 October 2026, #783 batch 3). The player's units on the place's hex, soldiers and halutzim alike, leave in ascending id, each to the first neighbouring hex in the fixed neighbour order (R-MOVE-002) that is land, holds no enemy unit, is not an enemy-held locality (R-MOVE-005) and has room under the stack limit (R-MOVE-003). Leaving costs no movement points, and the units keep their orders, as after a `Move` that ends on another hex: a fortify is lost at the turn's order step (R-ORDER-002); both are defaults proposed on #797. The record is removed, so the place is under enemy control again at once, and its residents are unchanged. Raid changes nothing else: no resource, parameter, city, score or objective, and no RNG draw. If a unit has no such hex, Raid is refused with a reason and the state is unchanged, so the choice waits.+R-CTRL-010: Raid and withdraw (Q-RAID-1 (a), owner, 18 October 2026, #783 batch 3). The player's units on the place's hex, soldiers and halutzim alike, leave in ascending id, each to the first neighbouring hex in the fixed neighbour order (R-MOVE-002) that is land, holds no enemy unit, is not an enemy-held locality (R-MOVE-005) and has room under the stack limit (R-MOVE-003). Leaving costs no movement points, and the units keep their orders, as after a `Move` that ends on another hex: a fortify is lost at the turn's order step (R-ORDER-002); both are defaults proposed on #797. The record is removed, so the place is under enemy control again at once, and its residents are unchanged. Raid changes nothing else: no resource, parameter, city, score or objective, and no RNG draw. If a unit has no such hex, Raid is refused with a reason and the state is unchanged, so the choice waits. For a fled place the record stays ownerless and fled (R-CTRL-004), and the line says "Its residents fled when it was captured" instead of "Its residents are unchanged" (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).-R-CTRL-011: Occupy (Q-OCC-1 (a), owner, 18 October 2026, #783 batch 3): `ResolveCapture(settlement, occupy)` keeps the place under the player's control. It needs an Israeli military unit on the place's hex, the one unit that stays (a halutz holds nothing, #796), and is refused with a reason otherwise, the state unchanged. It moves no unit. It changes the record's state to `occupied` and starts its timer (R-CTRL-012), and nothing else: no resident field (the place stays inhabited, R-CTRL-003), unit, resource, parameter, city, score or objective, so its preview (R-CTRL-008) is all zeros. Each turn's step 10, while the place is occupied or awaiting `EndOccupation`, the Treasury pays `mvp.occupation_upkeep_per_turn` for it, borrowing what it lacks (R-MONEY-003); the Occupy turn pays too. The upkeep is a design value accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839): IL 0.005m, one month of `income_per_job_per_year` for the one population unit that stays, derived as `held_soldier_cost_per_turn` is. It comes on top of the garrison formation's own `military_upkeep_per_turn` (IL 0.05m, R-UNIT-010), so holding a place costs IL 0.055m a turn in all (owner ruling, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6341877796). Money is shown to one decimal of IL millions, so when the Treasury has to borrow for it the Why line shows the borrowed amount, at most IL 0.005m, as "IL 0.0m".+R-CTRL-011: Occupy (Q-OCC-1 (a), owner, 18 October 2026, #783 batch 3): `ResolveCapture(settlement, occupy)` keeps the place under the player's control. It needs an Israeli military unit on the place's hex, the one unit that stays (a halutz holds nothing, #796), and is refused with a reason otherwise, the state unchanged. It moves no unit. It changes the record's state to `occupied` and starts its timer (R-CTRL-012), and nothing else: no resident field (the place stays inhabited, R-CTRL-003), unit, resource, parameter, city, score or objective, so its preview (R-CTRL-008) is all zeros. Each turn's step 10, while the place is occupied or awaiting `EndOccupation`, the Treasury pays `mvp.occupation_upkeep_per_turn` for it, borrowing what it lacks (R-MONEY-003); the Occupy turn pays too. The upkeep is a design value accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839): IL 0.005m, one month of `income_per_job_per_year` for the one population unit that stays, derived as `held_soldier_cost_per_turn` is. It comes on top of the garrison formation's own `military_upkeep_per_turn` (IL 0.05m, R-UNIT-010), so holding a place costs IL 0.055m a turn in all (owner ruling, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6341877796). Money is shown to one decimal of IL millions, so when the Treasury has to borrow for it the Why line shows the borrowed amount, at most IL 0.005m, as "IL 0.0m". For a fled place Occupy's line ends "Its residents fled when it was captured", and Occupy and the timer keep `fled=1` on every record (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).R-CTRL-012: The occupation timer (Q-OCC-3 (a), owner, 18 October 2026, #783 batch 4: one X for every place). Occupy sets the record's `Turns` to `mvp.occupation_turns`, X, a design value accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1324#issuecomment-6338594839): 6 monthly turns. Resolver step 10, after step 9's arrivals and before objectives and score (step 11), takes each occupied place in ordinal id order and counts one turn off, the Occupy turn included; at 0 the place's state is `awaiting_end`, where it awaits `EndOccupation` (Phase 6 PR 7) and the count stops. `Turns` is written to the hash as `turns=` only when non-zero (R-CTRL-002). The step draws nothing from the RNG.-R-CTRL-013: Withdrawal before the timer ends (Q-OCC-2 (a), owner, 18 October 2026, #783 batch 3: allowed, and it becomes a Raid). An occupation lasts while an Israeli military unit is on the place's hex. When step 10 finds none on an occupied or `awaiting_end` place (the player moved them out, or they were lost), the occupation ends as a Raid does: the record is removed, so the place is under enemy control again at once, its residents unchanged, and no upkeep is paid that turn. Nothing else changes, and nothing is refunded. A halutz left on the hex keeps nothing.+R-CTRL-013: Withdrawal before the timer ends (Q-OCC-2 (a), owner, 18 October 2026, #783 batch 3: allowed, and it becomes a Raid). An occupation lasts while an Israeli military unit is on the place's hex. When step 10 finds none on an occupied or `awaiting_end` place (the player moved them out, or they were lost), the occupation ends as a Raid does: the record is removed, so the place is under enemy control again at once, its residents unchanged, and no upkeep is paid that turn. Nothing else changes, and nothing is refunded. A halutz left on the hex keeps nothing. For a fled place the timer's raid keeps the ownerless fled record and its line says the residents fled when it was captured (OWNER QUESTION 2 (b), owner, 24 October 2026, #799).-R-CTRL-018: Deport (impact plan section 4.1; owner ruling 1, "honest cost, no reward"; Q-DEP-1 (a), Q-DEP-5 (c) and Q-DEP-7 (c), which includes (a), owner, 18 October 2026, #783 "Accept all 16 drafts"): `ResolveCapture(settlement, deport)`, only while `mvp.deport_in_play` is on (R-CTRL-007). The player's units on the place's hex leave exactly as in Raid (R-CTRL-010), and Deport is refused the same way, the state unchanged, when one has nowhere to go: it gives no military advantage over Raid and pays no occupation upkeep. Social cohesion (`morale`) falls at once by `mvp.deport_cohesion_cost` and International Support (`intl_standing`) by `mvp.deport_support_cost`, through the permanent event shift. The Treasury pays `mvp.deport_money_cost` at once, borrowing what it lacks (R-MONEY-003), so Deport never pays on Money (owner decision, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6337946480): a design value set at or above the most Occupy can pay in upkeep over the whole game plus the dearest city project, IL 6.25m. The place is added to `DisplacedByPlayer`. From then on, every turn's resolver step 10, after the occupation timers, International Support falls by `mvp.deport_support_drag_per_turn` for each place in `DisplacedByPlayer`, the Deport turn included, for the rest of the game; and International Support's ceiling is 1 less `mvp.deport_support_ceiling_drop` for each such place (never below 0), which every write to it respects. The four indicator values (0.15, 0.15, 0.005 and 0.25, the drag and the ceiling drop per place) and the IL 6.25m were proposed on #800 and #1327 and accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6350226175); they stay design values the balance pass (#813) may revisit. Nothing draws from the RNG.+R-CTRL-014: `EndOccupation(settlement, outcome)` answers the end of an occupation (#799). It is one deferred command kind (not instant, R-TURN-004) with one `attention_cost.end_occupation`, set at 0 as a design value proposed on #799 (D-A6: unit orders are free). It is valid only for a place in `awaiting_end` with an Israeli military unit on its hex, as Occupy needs (R-CTRL-011), and an outcome of `annex` or `withdraw`; the unit is checked for both outcomes. Otherwise it is refused with a reason, the state unchanged and the Attention refunded. It draws nothing from the RNG. Saved as `endocc <settlement> <outcome>`; scenario kind `end_occupation`.++R-CTRL-015: No puppet regime (Q-PUP-1 (c), owner, 18 October 2026, #783). `SettlementControl.EndOptions(content, state, settlement)` offers Annex and Withdraw, in that order (the ruling's words, "annex or withdraw"), with no default or selected flag, each with its refusal or its preview as `CaptureOptions` (R-CTRL-008); it is empty when the place is not awaiting the end. Withdraw is R-CTRL-010's withdrawal, the same code path.++R-CTRL-016: Annexation and the residents (Q-ANNEX-1, owner, 18 October 2026, #783; OWNER QUESTIONS 1 (a) and 3 (a), owner, 24 October 2026, #799). The record becomes `owner=israel,state=annexed`, keeping its capture date and `fled`, with no timer. A fled place adds nothing else: no city, people, housing, jobs, Food, Money, Arms, indicator change, score or objective progress ("Territory only, no gain"). A stayed place adds one city by the starting-city rule: its row's `annexation.people` (a sourced count the owner approves) in population units (R-CITY-007), housing equal to them, job slots equal to the employed (people times `annexation.employed_share`, the national share 0.439, to the nearest unit), the condition `mvp.housing_start_condition`, and no refugees, recruits or craftsmen; refused, the state unchanged, if the id is already a city. Each target row says `residents: fled` or `stayed` with at least one source (`residents_sources`); only a stayed row has an `annexation` block, whose `people` must be a sourced whole number; any other row is a load error naming file and field. The town stays Israeli for good: step 10 ignores an annexed record, so the upkeep stops and no unit has to stay, and an annexed target is no enemy-held locality for movement (R-MOVE-005, R-ENEMY-001). A city that exists only in state has no training facility.++R-CTRL-017: A depopulated place (Deport) is never offered or given `EndOccupation`, so it is never annexed (Q-ANNEX-2 (a), owner, 18 October 2026, #783).++R-CTRL-018: Deport (impact plan section 4.1; owner ruling 1, "honest cost, no reward"; Q-DEP-1 (a), Q-DEP-5 (c) and Q-DEP-7 (c), which includes (a), owner, 18 October 2026, #783 "Accept all 16 drafts"): `ResolveCapture(settlement, deport)`, only while `mvp.deport_in_play` is on (R-CTRL-007). The player's units on the place's hex leave exactly as in Raid (R-CTRL-010), and Deport is refused the same way, the state unchanged, when one has nowhere to go: it gives no military advantage over Raid and pays no occupation upkeep. Social cohesion (`morale`) falls at once by `mvp.deport_cohesion_cost` and International Support (`intl_standing`) by `mvp.deport_support_cost`, through the permanent event shift. The Treasury pays `mvp.deport_money_cost` at once, borrowing what it lacks (R-MONEY-003), so Deport never pays on Money (owner decision, 22 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6337946480): a design value set at or above the most Occupy can pay in upkeep over the whole game plus the dearest city project, IL 6.25m. The place is added to `DisplacedByPlayer`. From then on, every turn's resolver step 10, after the occupation timers, International Support falls by `mvp.deport_support_drag_per_turn` for each place in `DisplacedByPlayer`, the Deport turn included, for the rest of the game; and International Support's ceiling is 1 less `mvp.deport_support_ceiling_drop` for each such place (never below 0), which every write to it respects. The four indicator values (0.15, 0.15, 0.005 and 0.25, the drag and the ceiling drop per place) and the IL 6.25m were proposed on #800 and #1327 and accepted by the owner on 22 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1327#issuecomment-6350226175); they stay design values the balance pass (#813) may revisit. Nothing draws from the RNG. For a place whose record is `fled` (its residents fled at capture, R-CTRL-005) Deport stays listed third and is refused, the state unchanged, with the reason "Its residents fled when it was captured, so there is no one to deport", which the options helper shows on its button (OWNER QUESTION 4 (a), owner, 24 October 2026, "Hide it, button explains (Recommended)", https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6375591758).R-CTRL-019: The residents (Q-DEP-2 (a), every resident the state holds; Q-DEP-3 (a), a count only, with no destination on the board): a Deport adds 1 to `DisplacedByPlayer`, a count of places, not people (Q-CAP-2 (b)), written to the hash as `displaced=` only when non-zero. They are outside the player's control: never refugee units, civilians, cohorts, units, prisoners, labour, housing occupants or score.@@ -236,7 +244,7 @@ R-MOVE-003: A hex holds at most `mvp.stack_limit` units of one side (Q-MOVE-3; rR-MOVE-004: There is no zone of control (Q-MOVE-4): a unit passes next to an enemy unit at the terrain's cost, but no path enters or passes through an enemy unit's hex. Units may enter any land hex on the board; the 1948 control layer stays display-only. There is no transport (Q-MOVE-5).-R-MOVE-005: A player unit cannot enter the hex of an enemy-held locality that is not a curated target (`settlement_targets.yaml`, R-CTRL-001), and no path passes through one: in Phase 6 only Gaza stays closed (Q-CIV-1, owner, 15 October 2026: "No entry until Phase 6"; Q-TGT-1 (a)). The hex of an enemy-held target is open, so a player unit may move onto it, or through it, and capture it in play (R-CTRL-004; the owner's ruling on #793, 21 October 2026, that the targets "can be captured in play", https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6322289565; #1304). Raid's withdrawal (R-CTRL-010) and combat retreat (R-COMBAT-003) still never end on any enemy-held locality, target or not, and the enemy's mirror (R-ENEMY-001) is unchanged. The localities are the settlements listed in `rules.yaml` `mvp.enemy_held_localities` (`settlements_1948.yaml` ids; the loader refuses an unknown one). The real list is the owner-accepted DRAFT (19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1073#issuecomment-6259083180): acre, nazareth, lod, ramla, gaza, beersheba. It is unchecked: no person has yet checked each place's control on 15 May 1948; research task #1096 will check it.+R-MOVE-005: A player unit cannot enter the hex of an enemy-held locality that is not a curated target (`settlement_targets.yaml`, R-CTRL-001), and no path passes through one: in Phase 6 only Gaza stays closed (Q-CIV-1, owner, 15 October 2026: "No entry until Phase 6"; Q-TGT-1 (a)). The hex of an enemy-held target is open, so a player unit may move onto it, or through it, and capture it in play (R-CTRL-004; the owner's ruling on #793, 21 October 2026, that the targets "can be captured in play", https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6322289565; #1304). Raid's withdrawal (R-CTRL-010) and combat retreat (R-COMBAT-003) still never end on any enemy-held locality, target or not, and the enemy's mirror (R-ENEMY-001) is unchanged. The localities are the settlements listed in `rules.yaml` `mvp.enemy_held_localities` (`settlements_1948.yaml` ids; the loader refuses an unknown one). The real list is the owner-accepted DRAFT (19 October 2026, https://github.com/eyalgolan/statecraft-israel/pull/1073#issuecomment-6259083180): acre, nazareth, lod, ramla, gaza, beersheba. It is unchecked: no person has yet checked each place's control on 15 May 1948; research task #1096 will check it. An annexed target (R-CTRL-016) is no enemy-held locality: the player's withdrawal and retreat may end on it, and enemy units may not enter it, as any Israeli town (#799).R-MOVE-006: `Move` is refused with the state unchanged and a reason when the unit does not exist, is not the player's (a unit of a side other than Israel), cannot move or is already on the hex, when the hex is water or off the board, holds an enemy unit, is an enemy-held locality closed by R-MOVE-005 or is full of the unit's side, or when no path reaches it within the points the unit has left this turn. It costs no Attention (D-A6). A Move that goes through clears a fortify order (`fortify`, or `fortifying` the turn it is given) and the hex it names at once, so a unit that leaves its hex and comes back in the same turn is not fortified (Q-HOLD-1, "lost on move"); hold moves with the unit; a refused Move changes nothing.@@ -288,7 +296,7 @@ R-COMBAT-009: From accepting a truce card until its window ends, the player's atPhase 5 PR 10, part 1 (#749). Q-ENEMY-1 to Q-ENEMY-4 are the plan's recommendations (owner, 15 October 2026, #375: "Take all recommendations"). The march's turns (through the 15 June 1948 turn, until the first truce ends on 8 July) are the owner's (owner, 21 October 2026, #749); so is the truce guard (R-ENEMY-006, same ruling). The scripted anchor's choice, the goal order, `mvp.enemy_attack_ratio_percent` and the truce guard's turn-middle reading are agent defaults proposed on #749 and #1263. The operation cards' orders (Q-ENEMY-5, the plan's R-ENEMY-005) are part 2.-R-ENEMY-001: Resolver step 1, before combat, gives every enemy military unit its orders, in ascending unit id, from the state alone: two equal states get the same orders. They go through the player's own checks with the sides swapped (`Movement.Move`, `Combat.Give`, `Orders.Give`), and a refused order changes nothing. So an enemy unit may not enter a hex holding a player unit, water or a full hex (R-MOVE-003), and, as R-MOVE-005's mirror, no locality's hex that is not on `mvp.enemy_held_localities`: while enemy capture (R-CTRL-006) is unbuilt, no enemy move ends on a player's locality. Its attacks pay no Arms (Q-ENEMY-4: no enemy supply). Step 1 draws nothing from the RNG (Q-ENEMY-2).+R-ENEMY-001: Resolver step 1, before combat, gives every enemy military unit its orders, in ascending unit id, from the state alone: two equal states get the same orders. They go through the player's own checks with the sides swapped (`Movement.Move`, `Combat.Give`, `Orders.Give`), and a refused order changes nothing. So an enemy unit may not enter a hex holding a player unit, water or a full hex (R-MOVE-003), and, as R-MOVE-005's mirror, no locality's hex that is not on `mvp.enemy_held_localities`: while enemy capture (R-CTRL-006) is unbuilt, no enemy move ends on a player's locality. Its attacks pay no Arms (Q-ENEMY-4: no enemy supply). Step 1 draws nothing from the RNG (Q-ENEMY-2). An annexed target counts as an Israeli town for enemy movement (R-CTRL-016, #799).R-ENEMY-002: In Historical mode each starting Arab force (R-UNIT-006) has a script from `map/units_1948.yaml` (Q-ENEMY-1; `research_notes/GDD phase 5/arab-forces-1948.md` section 10). Its 15 May 1948 position is the start. Its target is the row's first anchor from 11 June 1948 that cites at least two sources other than Wikipedia and Wikidata, on that anchor's hex (`map/unit_anchor_hexes.yaml`): Isdud for Egypt (the forward base), Latrun for the Arab Legion, the bridgehead at Mishmar HaYarden for Syria and Jenin for Iraq; the ALA has none. On each turn that starts before the anchor's window ends (its `to`, 8 July 1948 for all four), the unit moves along its cheapest path to the target (R-MOVE-002) as far as its movement points reach. A unit on its target, with no path to it or whose move is refused follows R-ENEMY-003 that turn, and so does every unit from the turn its window has ended. The script never places a unit anywhere but its own path to a sourced anchor.diff --git a/docs/superpowers/plans/2026-10-15-gdd-phase-6.md b/docs/superpowers/plans/2026-10-15-gdd-phase-6.mdindex 9ba72cb25..8fd93508a 100644--- a/docs/superpowers/plans/2026-10-15-gdd-phase-6.md+++ b/docs/superpowers/plans/2026-10-15-gdd-phase-6.md@@ -365,11 +365,11 @@ The note proposes no list. The owner picks the list.**Goal:** when a settlement's occupation timer ends, `EndOccupation(settlement, puppet / annex / withdraw)` applies the owner's answers. A depopulated settlement is never offered either outcome for gain (constraint 2, and Q-ANNEX-2 for what is offered at all).-**Files:** `SettlementControl.cs` (`EndOccupation`, `Puppet`, `Annex`), the five touch-points for `EndOccupation`, `Cities.cs` (only if Q-ANNEX-1 joins residents to a city), `content/rules.yaml`, new `EndOccupationTests.cs`, `docs/rules/mvp.md`.+**Files:** `SettlementControl.cs` (`EndOccupation`, `Annex`; no `Puppet`, Q-PUP-1 (c)), the five touch-points for `EndOccupation`, `Cities.cs` (only if Q-ANNEX-1 joins residents to a city), `content/rules.yaml`, new `EndOccupationTests.cs`, `docs/rules/mvp.md`.**Rule IDs (proposed):**- **R-CTRL-014**: `EndOccupation` is valid only when the timer has ended, and is refused with a reason otherwise.-- **R-CTRL-015**: the puppet regime (Q-PUP-1).+- **R-CTRL-015**: no puppet regime; the end options are Annex and Withdraw (Q-PUP-1 (c); #799).- **R-CTRL-016**: annexation and the residents (Q-ANNEX-1).- **R-CTRL-017**: what a depopulated settlement is offered (Q-ANNEX-2).diff --git a/research_notes/GDD phase 6/annexation-residents.md b/research_notes/GDD phase 6/annexation-residents.mdnew file mode 100644index 000000000..9b9a42eb0--- /dev/null+++ b/research_notes/GDD phase 6/annexation-residents.md@@ -0,0 +1,42 @@+# Annexation: the resident counts for Acre and Nazareth (research note, 2026-10-23)++Status: research for #799 (OWNER QUESTION 1 (a) of plan #1520, "the same rule as the 12 starting cities:+a sourced resident count you approve"). The two counts are in `content/settlement_targets.yaml` as `annexation.people`.+The owner approved both on 24 Oct 2026 ("Approve both", https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6379785979).++## The rule they follow++The starting cities use the 8 November 1948 Registration of Population (the census day), all residents counted, labelled+with their date (owner, 15 October 2026, on #569; `research_notes/GDD phase 3/city-start-values-1948-cbs.md`). The same+source and basis are used here. The 1945 Village Statistics figures (Acre 12,360; Nazareth 14,200) are "before" values+and are not used (plan #1520, global constraints).++## The figures [V]++Both read from the scans on the CBS website on 2026-10-23, agent read; a person's check is pending.++| place | 8 XI 1948 | 31 XII 1951 | where |+|---|---|---|---|+| Nazareth (נצרת (עיר)) | 16,994 | 20,000 | CBS Statistical Abstract of Israel No. 3 (1951/52), list of settlements, p. 141. https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1952_num3.pdf |+| Acre (עכו (עיר)) | 4,016 | 15,650 | same list, p. 142 |++Cross-check: CBS Statistical Abstract No. 14 (1963), Table 11, p. 31+(https://www.cbs.gov.il/he/publications/DocLib/shnaton_saruk/shnaton1963_num14.pdf) gives Akko 4,016 on 8 XI 1948, the+same figure. For Nazareth that table shows ".." (no figure) on 8 XI 1948 and 18,500 at the end of 1949. The same SA 3 page+gives Netanya 11,589, which matches SA 14 and `cities.yaml`, so the column is the census day.++## What the counts are and are not [G]++- They count everyone present on the census day. The research packet for #793 (`settlement-targets.md`) lists+ "residents and refugees not separable" as a gap for Nazareth, so the 16,994 may include people who were not residents+ before July 1948. Not checked further here.+- Acre's figure is taken nearly six months after its surrender (17-18 May 1948). The #793 packet records about 5,000 remaining+ after the surrender, many of them refugees from Haifa and non-local workers (Morris pp. 228-232). Whether the 4,016 also+ includes new Jewish residents settled in Acre by November 1948 was not checked [G].+- Jobs: no per-town working share was found; the national share 0.439 (SA No. 2, as for seven of the starting cities) is+ used as a design value, as the owner's answer says.++## Owner decision++The owner approved 16,994 for Nazareth and 4,016 for Acre on 24 Oct 2026 ("Approve both", https://github.com/eyalgolan/statecraft-israel/issues/799#issuecomment-6379785979).+The `mvp-annex-nazareth` golden pins the approved Nazareth count.diff --git a/sim/Statecraft.Sim.Tests/CaptureTests.cs b/sim/Statecraft.Sim.Tests/CaptureTests.csindex 918bf09c9..fe74b476d 100644--- a/sim/Statecraft.Sim.Tests/CaptureTests.cs+++ b/sim/Statecraft.Sim.Tests/CaptureTests.cs@@ -22,8 +22,14 @@ public class CaptureTests("town_d", "arab_town", 1, 2), ("town_e", "arab_town", 4, 2),};- static string Target(string id, int q, int r) => FormattableString.Invariant(- $" - {{ id: {id}, q: {q}, r: {r}, operation: fixture_operation, sources: [{{ url: \"https://example.org/{id}\", checked: 2026-10-18 }}], status: sensitivity-reviewed }}\n");+ /// <summary>A target row. Stayed by default, so every Raid, Occupy and Deport test keeps its behaviour (#799 plan, Task 1);+ /// the annexation values are fixture values (people 60, employed_share 0.5), not history.</summary>+ static string Target(string id, int q, int r, bool fled = false) => FormattableString.Invariant(+ $" - {{ id: {id}, q: {q}, r: {r}, operation: fixture_operation, sources: [{{ url: \"https://example.org/{id}\", checked: 2026-10-18 }}], ")+ + (fled ? "residents: fled, " : "residents: stayed, ")+ + FormattableString.Invariant($"residents_sources: [{{ url: \"https://example.org/{id}/residents\", checked: 2026-10-18 }}], ")+ + (fled ? "" : FormattableString.Invariant($"annexation: {{ people: {{ value: 60, status: sourced, date: 1948-11-08, sources: [{{ url: \"https://example.org/{id}/people\", checked: 2026-10-18 }}] }}, employed_share: {{ value: 0.5, status: design }} }}, "))+ + "status: sensitivity-reviewed }\n";/// <summary>MovementTests' 6 x 3 coastal plain with the four places; <paramref name="targets"/> lists the targets in/// file order.</summary>@@ -31,7 +37,13 @@ public class CaptureTests/// <summary>As <see cref="Load(string[])"/>, with <paramref name="edit"/> run on the files before they load (DeportTests/// turns Deport on with it, Q-TECH-3).</summary>- internal static Content Load(Action<Dictionary<string, string>>? edit, params string[] targets)+ internal static Content Load(Action<Dictionary<string, string>>? edit, params string[] targets) => Load(edit, Array.Empty<string>(), targets);++ /// <summary>As <see cref="Load(string[])"/>, with the rows in <paramref name="fled"/> written as <c>residents: fled</c>+ /// and no annexation block (Q-ANNEX-1; OWNER QUESTION 2 (b) on #799).</summary>+ internal static Content LoadFled(string[] fled, params string[] targets) => Load(null, fled, targets);++ internal static Content Load(Action<Dictionary<string, string>>? edit, string[] fled, string[] targets){var files = Fixture.Gdd(new Dictionary<string, string>{@@ -39,7 +51,7 @@ public class CaptureTests["map/settlement_hexes.yaml"] = "settlements:\n" + string.Concat(Places.Select(p => FormattableString.Invariant($" - {{ id: {p.Id}, q: {p.Q}, r: {p.R} }}\n"))),["map/settlements_1948.yaml"] = "settlements:\n" + string.Concat(Places.Select(p => FormattableString.Invariant($" - {{ id: {p.Id}, name: {p.Id.Replace("town_", "Town ").ToUpperInvariant()}, lon: 34.29, lat: 33.35, type: {p.Type}, founded: 1900, pre_modern: false }}\n"))),- ["settlement_targets.yaml"] = targets.Length == 0 ? "targets: []\n" : "targets:\n" + string.Concat(targets.Select(id => { var p = Places.Single(x => x.Id == id); return Target(p.Id, p.Q, p.R); })),+ ["settlement_targets.yaml"] = targets.Length == 0 ? "targets: []\n" : "targets:\n" + string.Concat(targets.Select(id => { var p = Places.Single(x => x.Id == id); return Target(p.Id, p.Q, p.R, fled.Contains(p.Id)); })),});files["rules.yaml"] = files["rules.yaml"].Replace("enemy_held_localities: []", "enemy_held_localities: [town_a, town_c, town_e]");edit?.Invoke(files);diff --git a/sim/Statecraft.Sim.Tests/CommandGuardTests.cs b/sim/Statecraft.Sim.Tests/CommandGuardTests.csindex 14e161e5d..8adb7f1a9 100644--- a/sim/Statecraft.Sim.Tests/CommandGuardTests.cs+++ b/sim/Statecraft.Sim.Tests/CommandGuardTests.cs@@ -33,6 +33,7 @@ public class CommandGuardTests[typeof(Move)] = new Move(1, 2, 0),[typeof(BuyArms)] = new BuyArms(0), // refused (fewer than one unit), as GovernmentTests.ARefusedGddOrderRefundsItsAttention needs[typeof(ResolveCapture)] = new ResolveCapture("town_a", "raid"), // refused (nothing awaits a decision), like BuyArms(0)+ [typeof(EndOccupation)] = new EndOccupation("town_a", "annex"), // refused (nothing awaits the end of an occupation)};static IEnumerable<Type> CommandTypes() =>diff --git a/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs b/sim/Statecraft.Sim.Tests/ContentLoaderTests.csindex 27f8eac2c..1f349643c 100644--- a/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs+++ b/sim/Statecraft.Sim.Tests/ContentLoaderTests.cs@@ -12,6 +12,11 @@ targets:r: 0operation: fixture_operationsources: [{ url: ""https://example.org/operation"", checked: 2026-10-18 }]+ residents: stayed+ residents_sources: [{ url: ""https://example.org/residents"", checked: 2026-10-18 }]+ annexation:+ people: { value: 60, status: sourced, date: 1948-11-08, sources: [{ url: ""https://example.org/people"", checked: 2026-10-18 }] }+ employed_share: { value: 0.5, status: design }status: sensitivity-reviewed";@@ -50,6 +55,39 @@ targets:Assert.Contains(message, ex.Message);}+ // R-CTRL-016 (Q-ANNEX-1; OWNER QUESTION 1 (a) on #799): a stayed row loads with its annexation values.+ [Fact]+ public void AStayedTargetLoadsWithItsAnnexationValues()+ {+ var target = Assert.Single(ContentLoader.Load(Fixture.Write(WithTargets(Target))).SettlementTargets);+ Assert.Equal("stayed", target.Residents);+ Assert.Equal("https://example.org/residents", Assert.Single(target.ResidentsSources).Url);+ Assert.Equal((60m, "sourced", 0.5m), (target.Annexation!.People!.Value, target.Annexation.People.Status, target.Annexation.EmployedShare!.Value));+ }++ const string Annexation = " annexation:\n people: { value: 60, status: sourced, date: 1948-11-08, sources: [{ url: \"https://example.org/people\", checked: 2026-10-18 }] }\n employed_share: { value: 0.5, status: design }\n";++ // R-CTRL-016: residents are fled or stayed, sourced; only a stayed row has an annexation block, with a sourced count.+ [Theory]+ [InlineData(" residents: stayed\n", "", ".residents", "must be fled or stayed")]+ [InlineData(" residents: stayed\n", " residents: puppet\n", ".residents", "must be fled or stayed")]+ [InlineData(" residents: stayed\n", " residents: unknown\n", ".residents", "must be fled or stayed")]+ [InlineData(" residents_sources: [{ url: \"https://example.org/residents\", checked: 2026-10-18 }]\n", "", ".residents_sources", "needs at least one source")]+ [InlineData("\"https://example.org/residents\", checked: 2026-10-18", "\"http://example.org/residents\", checked: 2026-10-18", ".residents_sources[0]", "needs an https url")]+ [InlineData(" residents: stayed\n", " residents: fled\n", ".annexation", "has no annexation block")]+ [InlineData(Annexation, "", ".annexation", "required for a stayed place")]+ [InlineData("value: 60, status: sourced", "value: 60, status: design", ".annexation.people.status", "must be sourced")]+ [InlineData("value: 60, status: sourced", "value: 60.5, status: sourced", ".annexation.people.value", "whole number")]+ [InlineData("value: 0.5, status: design", "value: 1.5, status: design", ".annexation.employed_share.value", "from 0 to 1")]+ public void SettlementTargetResidentsAreFledOrStayedAndSourced(string before, string after, string field, string message)+ {+ Assert.Contains(before, Target);+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(WithTargets(Target.Replace(before, after)))));+ Assert.Equal(ContentLoader.SettlementTargetsFileName, ex.File);+ Assert.Contains(field, ex.Field);+ Assert.Contains(message, ex.Message);+ }+// R-CTRL-001: Q-TGT-1 (a) admits only arab_town rows, so a settlement of another type is refused.[Fact]public void ASettlementThatIsNotAnArabTownIsNotATarget()diff --git a/sim/Statecraft.Sim.Tests/DeportTests.cs b/sim/Statecraft.Sim.Tests/DeportTests.csindex 437bb4d4e..c506f53ea 100644--- a/sim/Statecraft.Sim.Tests/DeportTests.cs+++ b/sim/Statecraft.Sim.Tests/DeportTests.cs@@ -13,13 +13,14 @@ using Statecraft.Sim;public class DeportTests{/// <summary>CaptureTests' fixture with Deport in play and International Support in the model (the fixture's model has- /// none; the real one has it, model.yaml). <paramref name="edit"/> changes the files further.</summary>- internal static Content Load(Action<Dictionary<string, string>>? edit = null) => CaptureTests.Load(files =>+ /// none; the real one has it, model.yaml). <paramref name="edit"/> changes the files further; the rows in+ /// <paramref name="fled"/> are written as <c>residents: fled</c> (CaptureTests.LoadFled).</summary>+ internal static Content Load(Action<Dictionary<string, string>>? edit = null, string[]? fled = null) => CaptureTests.Load(files =>{files["rules.yaml"] = files["rules.yaml"].Replace("enemy_held_localities:", "deport_in_play: true\n enemy_held_localities:");files["model.yaml"] = Fixture.Files["model.yaml"].Replace("indicators:\n", "indicators:\n - id: intl_standing\n base: 0.5\n name: International support\n");edit?.Invoke(files);- }, CaptureTests.AllTargets);+ }, fled ?? Array.Empty<string>(), CaptureTests.AllTargets);internal static Unit Soldier(int id, int q, int r) => CaptureTests.Soldier(id, q, r);@@ -44,6 +45,29 @@ public class DeportTestsreturn t;}+ // R-CTRL-018, OWNER QUESTION 4 (a) on #799 ("Hide it, button explains"): for a town whose residents fled at capture,+ // Deport stays listed third but is refused with its reason, and resolving it changes nothing. A soldier on its hex captures+ // town_a at the turn's capture step, so the record's fled comes from the row, as in play.+ [Fact]+ public void DeportOfAFledTownIsRefusedWithItsReason()+ {+ var c = Load(fled: new[] { "town_a" });+ var s = Step(c, CombatTests.With(c, Soldier(1, 1, 0))).State;+ Assert.True(s.Settlements["town_a"].Fled);+ var options = SettlementControl.CaptureOptions(c, s, "town_a");+ Assert.Equal(new[] { SettlementControl.Raid, SettlementControl.Occupy, SettlementControl.Deport }, options.Select(x => x.Outcome).ToArray());+ Assert.Equal("Its residents fled when it was captured, so there is no one to deport", options[2].Refusal);+ Assert.Null(options[2].Preview);+ var before = s.Describe();+ var why = new List<Cause>();+ Assert.Equal(options[2].Refusal, SettlementControl.Resolve(c, s, "town_a", SettlementControl.Deport, why));+ Assert.Empty(why);+ Assert.Equal(before, s.Describe());+ var stepped = Step(c, s, Answer(SettlementControl.Deport));+ Assert.Equal(options[2].Refusal, Assert.Single(stepped.Rejected).Reason);+ Assert.Equal(0, stepped.State.DisplacedByPlayer);+ }+// R-CTRL-018 (Q-DEP-5 (c)): Social cohesion and International Support fall at once by the labelled costs, the place is// counted in DisplacedByPlayer, and the options helper shows exactly that as Deport's preview (spec section 2.6).[Fact]@@ -184,6 +208,8 @@ public class DeportTests[typeof(Move)] = new Command[] { new Move(1, 1, 0), new Move(2, 1, 0) },[typeof(UnitOrder)] = new Command[] { new UnitOrder(1, Combat.Attack, 1, 0) },[typeof(ResolveCapture)] = new Command[] { Answer(SettlementControl.Raid), Answer(SettlementControl.Occupy), Answer(SettlementControl.Deport) },+ // R-CTRL-017 (Q-ANNEX-2 (a)): a depopulated place is never annexed nor withdrawn from.+ [typeof(EndOccupation)] = new Command[] { new EndOccupation("town_a", SettlementControl.Annex), new EndOccupation("town_a", SettlementControl.WithdrawOutcome) },// These name no place or hex: a city, a cohort, a unit's own work, a policy, a budget, an event, an office or a count.[typeof(SetPolicy)] = null, [typeof(AllocateBudget)] = null, [typeof(ChooseEventOption)] = null, [typeof(SetMobilization)] = null,[typeof(SecurityOrder)] = null, [typeof(Appoint)] = null, [typeof(AssignWorkers)] = null, [typeof(Train)] = null,diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.csindex 02a8670d6..a277dae49 100644--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs@@ -185,6 +185,7 @@ public class DesignValuesTests// The national Arms pool (Phase 2 PR 3b; #781, owner 18 October 2026: "Approve as drafted").("rules.yaml", "attention_cost.buy_arms"),("rules.yaml", "attention_cost.resolve_capture"), // #797 (Q-TECH-3): proposed, for owner override+ ("rules.yaml", "attention_cost.end_occupation"), // #799 (R-CTRL-014): proposed, for owner override("rules.yaml", "mvp.arms_start"),("rules.yaml", "mvp.arms_price"),("rules.yaml", "mvp.arms_per_recruit_group"),diff --git a/sim/Statecraft.Sim.Tests/EndOccupationTests.cs b/sim/Statecraft.Sim.Tests/EndOccupationTests.csnew file mode 100644index 000000000..9e78cf921--- /dev/null+++ b/sim/Statecraft.Sim.Tests/EndOccupationTests.cs@@ -0,0 +1,220 @@+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++/// <summary>R-CTRL-014 to R-CTRL-017 (#799): annex or withdraw when the occupation timer ends; no puppet regime (Q-PUP-1+/// (c)). The owner's answers of 24 October 2026 on #799: 1 (a) a stayed place becomes one city by the starting-city rule,+/// 3 (a) an annexed place stays Israeli for good with no upkeep. The places are CaptureTests' fixture values, not history:+/// town_a on hex 1,0, stayed rows with people 60 and employed_share 0.5, people_per_unit 10.</summary>+public class EndOccupationTests+{+ internal static GameState AwaitingEnd(Content c, bool fled, params Unit[] units) => AwaitingEnd(c, "town_a", fled, units);++ /// <summary>A new game with <paramref name="units"/> and <paramref name="id"/> awaiting the end of its occupation. The+ /// fixture's cities.yaml already has a town_a city, so the stayed annexation tests use town_c (hex 4,0).</summary>+ static GameState AwaitingEnd(Content c, string id, bool fled, params Unit[] units)+ {+ var s = CombatTests.With(c, units);+ s.Settlements[id] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingEnd, s.Date, fled: fled);+ return s;+ }++ static Unit Soldier(int id, int q, int r) => CaptureTests.Soldier(id, q, r);++ // R-CTRL-014: only a place whose timer has ended can be answered; a refusal changes nothing.+ [Theory]+ [InlineData(SettlementControl.AwaitingChoice, 0)]+ [InlineData(SettlementControl.Occupied, 3)]+ public void OnlyAnEndedOccupationCanBeAnswered(string state, int turns)+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, state, s.Date, turns: turns);+ var before = s.Describe();+ var why = new List<Cause>();+ Assert.NotNull(SettlementControl.End(c, s, "town_a", SettlementControl.Annex, why));+ Assert.Empty(why);+ Assert.Equal(before, s.Describe());+ Assert.Empty(SettlementControl.EndOptions(c, s, "town_a"));+ }++ // R-CTRL-014: a refused EndOccupation is rejected with its reason and its Attention refunded.+ [Fact]+ public void ARefusedEndIsRejectedWithItsReason()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ var result = Simulation.Step(c, s, new Command[] { new EndOccupation("town_a", SettlementControl.Annex) });+ Assert.Contains("not awaiting the end of its occupation", Assert.Single(result.Rejected).Reason);+ }++ // R-CTRL-015: Annex then Withdraw, nothing else, no puppet.+ [Fact]+ public void TheOptionsAreAnnexThenWithdraw()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = AwaitingEnd(c, "town_c", false, Soldier(1, 4, 0)); // town_a is a fixture city+ var before = s.Describe();+ var options = SettlementControl.EndOptions(c, s, "town_c");+ Assert.Equal(new[] { SettlementControl.Annex, SettlementControl.WithdrawOutcome }, options.Select(x => x.Outcome).ToArray());+ Assert.All(options, x => Assert.Null(x.Refusal));+ Assert.Equal(before, s.Describe()); // the options leave the state as they found it+ Assert.NotNull(SettlementControl.End(c, s, "town_c", "puppet", new List<Cause>()));+ Assert.Equal(before, s.Describe());+ }++ // R-CTRL-014: annexing needs the unit that holds the place (R-CTRL-011's garrison).+ [Fact]+ public void AnnexNeedsAnIsraeliUnitOnThePlace()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = AwaitingEnd(c, false, Soldier(1, 2, 0));+ var before = s.Describe();+ Assert.Contains("needs an Israeli military unit", SettlementControl.End(c, s, "town_a", SettlementControl.Annex, new List<Cause>()));+ Assert.Equal(before, s.Describe());+ }++ // R-CTRL-014: withdrawing needs the unit that holds the place too; with none there it is refused, the state unchanged.+ [Fact]+ public void WithdrawNeedsAnIsraeliUnitOnThePlace()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = AwaitingEnd(c, false, Soldier(1, 2, 0));+ var before = s.Describe();+ var why = new List<Cause>();+ Assert.Equal("Withdraw needs an Israeli military unit on TOWN A", SettlementControl.End(c, s, "town_a", SettlementControl.WithdrawOutcome, why));+ Assert.Empty(why);+ Assert.Equal(before, s.Describe());+ }++ // R-CTRL-017 (Q-ANNEX-2 (a)): a depopulated place (no state) is never answered.+ [Fact]+ public void ADepopulatedPlaceIsNeverAnnexed()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ s.Settlements["town_a"] = new SettlementControl(since: s.Date, depopulated: true);+ Assert.Empty(SettlementControl.EndOptions(c, s, "town_a"));+ Assert.NotNull(SettlementControl.End(c, s, "town_a", SettlementControl.Annex, new List<Cause>()));+ Assert.True(s.Settlements["town_a"].Depopulated);+ }++ // R-CTRL-015: withdrawing at the end is the Raid withdrawal: the units leave, the record goes.+ [Fact]+ public void WithdrawAtTheEndIsTheRaidWithdrawal()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets); // stayed rows+ var s = AwaitingEnd(c, false, Soldier(2, 1, 0));+ var after = Simulation.Step(c, s, new Command[] { new EndOccupation("town_a", SettlementControl.WithdrawOutcome) });+ Assert.Empty(after.Rejected);+ Assert.False(after.State.Settlements.ContainsKey("town_a"));+ Assert.NotEqual((1, 0), (after.State.Units[2].Q, after.State.Units[2].R));+ Assert.Contains(after.Why, x => x.Target == "town_a" && x.Message.Contains("Its residents are unchanged"));+ }++ // R-CTRL-015 with OWNER QUESTION 2 (b): withdrawing from a fled place keeps the ownerless fled record.+ [Fact]+ public void WithdrawFromAFledPlaceKeepsTheFlight()+ {+ var c = CaptureTests.LoadFled(new[] { "town_a" }, CaptureTests.AllTargets);+ var s = AwaitingEnd(c, true, Soldier(2, 1, 0));+ var since = s.Date;+ Assert.Null(SettlementControl.End(c, s, "town_a", SettlementControl.WithdrawOutcome, new List<Cause>()));+ var x = s.Settlements["town_a"];+ Assert.Equal(("", "", since, true), (x.Owner, x.State, x.Since, x.Fled));+ }++ // R-CTRL-016: a place emptied by flight is territory only, no gain ("Territory only, no gain", owner, 18 October 2026).+ [Fact]+ public void AnnexingAFledPlaceChangesOnlyItsRecord()+ {+ var c = CaptureTests.LoadFled(new[] { "town_a" }, CaptureTests.AllTargets);+ var s = AwaitingEnd(c, true, Soldier(1, 1, 0));+ var before = s.Clone();+ var why = new List<Cause>();+ Assert.Null(SettlementControl.End(c, s, "town_a", SettlementControl.Annex, why));+ var x = s.Settlements["town_a"];+ Assert.Equal((Movement.PlayerSide, SettlementControl.Annexed, before.Settlements["town_a"].Since, 0, true),+ (x.Owner, x.State, x.Since, x.Turns, x.Fled));+ Assert.Contains(why, w => w.Target == "town_a" && w.Message.Contains("no people, homes or jobs are added"));+ s.Settlements["town_a"] = before.Settlements["town_a"];+ Assert.Equal(before.Describe(), s.Describe()); // nothing else moved: resources, cities, units, score, objectives+ Assert.Equal(before.RngState, s.RngState);+ }++ // R-CTRL-016, OWNER QUESTION 3 (a): an annexed place pays no upkeep and needs no unit.+ [Fact]+ public void AnAnnexedPlaceCostsNothingAndStaysWithoutAUnit()+ {+ var c = CaptureTests.LoadFled(new[] { "town_a" }, CaptureTests.AllTargets);+ var s = AwaitingEnd(c, true, Soldier(1, 1, 0));+ var first = Simulation.Step(c, s, new Command[] { new EndOccupation("town_a", SettlementControl.Annex) });+ Assert.Empty(first.Rejected);+ Assert.DoesNotContain(first.Why, x => x.Message.Contains("for the occupation of", StringComparison.Ordinal));+ s = first.State;+ s.Units.Remove(1);+ var next = Simulation.Step(c, s, Array.Empty<Command>());+ Assert.Equal((Movement.PlayerSide, SettlementControl.Annexed), (next.State.Settlements["town_a"].Owner, next.State.Settlements["town_a"].State));+ Assert.DoesNotContain(next.Why, x => (x.System == "map" && x.Target == "town_a") || x.Message.Contains("occupation of", StringComparison.Ordinal));+ Assert.Empty(SettlementControl.EndOptions(c, next.State, "town_a")); // answered for good+ }++ // R-CTRL-016, OWNER QUESTION 1 (a): a stayed place becomes one city by the starting-city rule (people_per_unit 10):+ // 60 people are 6 units, homes equal the residents, jobs the employed (60 x 0.5 = 3 units), the usual condition.+ [Fact]+ public void AnnexingAStayedPlaceAddsExactlyOneCity()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets); // fixture rows are stayed, people 60+ var s = AwaitingEnd(c, "town_c", false, Soldier(1, 4, 0));+ var cities = s.Cities.Count;+ var why = new List<Cause>();+ Assert.Null(SettlementControl.End(c, s, "town_c", SettlementControl.Annex, why));+ var city = s.Cities["town_c"];+ Assert.Equal((6, 6, 3, 3, 0), (city.Civilians, city.HousingCapacity, city.Employed, city.JobSlots, city.Refugees));+ Assert.Equal(c.RulesAt(s.Date).Mvp!.HousingStartCondition, city.Condition);+ Assert.Equal(cities + 1, s.Cities.Count);+ Assert.Contains(why, w => w.Target == "town_c" && w.Message.Contains("Its residents join the population"));+ Assert.NotNull(SettlementControl.End(c, s, "town_c", SettlementControl.Annex, new List<Cause>())); // no second city+ Assert.Equal(cities + 1, s.Cities.Count);+ }++ // R-CTRL-016: an id that is already a city is refused, the state unchanged (Cities.Annex adds one city, never two).+ [Fact]+ public void AnnexingOntoAnExistingCityIsRefused()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = AwaitingEnd(c, false, Soldier(1, 1, 0)); // the fixture already has a town_a city+ var before = s.Describe();+ Assert.NotNull(SettlementControl.End(c, s, "town_a", SettlementControl.Annex, new List<Cause>()));+ Assert.Equal(before, s.Describe());+ }++ // R-CTRL-016: a city that exists only in state runs a turn, and a Train order there is refused with a reason (it has+ // no training facility), with no exception.+ [Fact]+ public void AnAnnexedCityRunsATurnAndRefusesTraining()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var s = AwaitingEnd(c, "town_c", false, Soldier(1, 4, 0));+ s = Simulation.Step(c, s, new Command[] { new EndOccupation("town_c", SettlementControl.Annex) }).State;+ Assert.True(s.Cities.ContainsKey("town_c"));+ var next = Simulation.Step(c, s, new Command[] { new Train("town_c", "halutz", 1) });+ Assert.NotEmpty(Assert.Single(next.Rejected).Reason);+ Assert.True(next.State.Cities.ContainsKey("town_c"));+ }++ // R-CTRL-016, R-MOVE-005, R-ENEMY-001 (OWNER QUESTION 3 (a) on #799): an annexed target is an Israeli town for movement:+ // no longer an enemy-held locality the player's withdrawal must avoid, and closed to enemy units.+ [Fact]+ public void AnAnnexedTargetIsAnIsraeliTownForMovement()+ {+ var c = CaptureTests.LoadFled(new[] { "town_a" }, CaptureTests.AllTargets);+ var s = AwaitingEnd(c, true, Soldier(1, 1, 0));+ Assert.Contains((1, 0), Movement.NoEntry(c, s));+ Assert.DoesNotContain((1, 0), Movement.NoEntry(c, s, true));+ Assert.Null(SettlementControl.End(c, s, "town_a", SettlementControl.Annex, new List<Cause>()));+ Assert.DoesNotContain((1, 0), Movement.NoEntry(c, s));+ Assert.Contains((1, 0), Movement.NoEntry(c, s, true));+ }+}diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.csindex c43c7e16d..2a8e35344 100644--- a/sim/Statecraft.Sim.Tests/Fixture.cs+++ b/sim/Statecraft.Sim.Tests/Fixture.cs@@ -243,7 +243,7 @@ series:}/// <summary>The fixture's attention_cost line with the GDD command kinds added (replaces "map_action: 1 }").</summary>- public const string GddCosts = "map_action: 1, assign_workers: 1, train: 1, cancel_training: 1, reinforce: 1, return_craftsmen: 0.5, reassign_craftsmen: 0.5, reassign_pioneers: 0, pioneer_work: 0, stop_work: 0, start_project: 1, cancel_project: 0.5, buy_arms: 1, move: 0, unit_order: 0, resolve_capture: 0 }";+ public const string GddCosts = "map_action: 1, assign_workers: 1, train: 1, cancel_training: 1, reinforce: 1, return_craftsmen: 0.5, reassign_craftsmen: 0.5, reassign_pioneers: 0, pioneer_work: 0, stop_work: 0, start_project: 1, cancel_project: 0.5, buy_arms: 1, move: 0, unit_order: 0, resolve_capture: 0, end_occupation: 0 }";public const string GddRules = @"mvp:diff --git a/sim/Statecraft.Sim.Tests/FledAtCaptureTests.cs b/sim/Statecraft.Sim.Tests/FledAtCaptureTests.csnew file mode 100644index 000000000..d7cb304f0--- /dev/null+++ b/sim/Statecraft.Sim.Tests/FledAtCaptureTests.cs@@ -0,0 +1,134 @@+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++/// <summary>Residents flee at capture (#799; OWNER QUESTION 2 (b), owner, 24 October 2026: "2.b"). Capturing a target whose+/// row says <c>residents: fled</c> records the flight at once, the record of it outlasts every return to enemy control, and+/// the place can be captured again. A stayed target is captured as before. Flight is not Deport: it changes nothing but the+/// record. The places are CaptureTests' fixture values, not history; town_a is on hex 1,0.</summary>+public class FledAtCaptureTests+{+ static Content Fled() => CaptureTests.LoadFled(new[] { "town_a" }, CaptureTests.AllTargets);+ static Unit Soldier(int id, int q, int r) => CaptureTests.Soldier(id, q, r);++ /// <summary>The state with only the settlement record and the cause lines left out, to compare what else moved.</summary>+ static string WithoutRecord(GameState s)+ {+ var x = s.Clone();+ x.Settlements.Clear();+ return x.Describe();+ }++ // R-CTRL-005 (OWNER QUESTION 2 (b)): a fled target's capture writes fled=1 at once and changes nothing else: no+ // displaced count, indicator, Money, city, score or RNG draw.+ [Fact]+ public void AFledTownIsRecordedAsFledAtCapture()+ {+ var c = Fled();+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ var twin = CaptureTests.Load(CaptureTests.AllTargets); // the same board with town_a stayed+ var result = Simulation.Step(c, s, Array.Empty<Command>());+ var stayed = Simulation.Step(twin, CombatTests.With(twin, Soldier(1, 1, 0)), Array.Empty<Command>());+ var ctrl = result.State.Settlements["town_a"];+ Assert.Equal((Movement.PlayerSide, SettlementControl.AwaitingChoice, result.State.Date, true), (ctrl.Owner, ctrl.State, ctrl.Since, ctrl.Fled));+ Assert.Contains("town_a=owner=israel,state=awaiting_choice,since=" + result.State.Date.ToString("yyyy-MM-dd") + ",fled=1", result.State.Describe());+ Assert.Equal(0, result.State.DisplacedByPlayer);+ Assert.Equal(WithoutRecord(stayed.State), WithoutRecord(result.State));+ Assert.Equal(stayed.State.RngState, result.State.RngState);+ Assert.Contains(result.Why, x => x.Target == "town_a" && x.Message.Contains("Its residents fled"));+ }++ // R-CTRL-005: a stayed target is captured as before, with no fled field and no line about residents.+ [Fact]+ public void AStayedTownIsCapturedAsToday()+ {+ var c = CaptureTests.Load(CaptureTests.AllTargets);+ var result = Simulation.Step(c, CombatTests.With(c, Soldier(1, 1, 0)), Array.Empty<Command>());+ Assert.False(result.State.Settlements["town_a"].Fled);+ Assert.DoesNotContain("fled", result.State.Describe());+ Assert.DoesNotContain(result.Why, x => x.Message.Contains("fled"));+ }++ // R-CTRL-010 (OWNER QUESTION 2 (b): "the record of the flight stays after a Raid"): a capture answered with Raid in the+ // same turn leaves an ownerless fled record with the turn's date (Stamp dates it), the units gone, and the line does+ // not say the residents are unchanged.+ [Fact]+ public void RaidOfAFledTownKeepsTheFlight()+ {+ var c = Fled();+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ var result = Simulation.Step(c, s, new Command[] { new ResolveCapture("town_a", SettlementControl.Raid) });+ Assert.Empty(result.Rejected);+ Assert.Contains("town_a=since=" + result.State.Date.ToString("yyyy-MM-dd") + ",fled=1\n", result.State.Describe());+ Assert.NotEqual((1, 0), (result.State.Units[1].Q, result.State.Units[1].R));+ Assert.DoesNotContain(result.Why, x => x.Message.Contains("unchanged"));+ Assert.Contains(result.Why, x => x.Target == "town_a" && x.Message.Contains("Its residents fled when it was captured"));+ }++ public static IEnumerable<object[]> Returns() => new[] { new object[] { "timer" }, new object[] { "end" }, new object[] { "enemy" } };++ // R-CTRL-008, R-CTRL-013, R-CTRL-004: the timer's raid with no unit left, the end-of-game raid and enemy units retaking+ // an awaiting capture each leave the ownerless fled record with its capture date.+ [Theory]+ [MemberData(nameof(Returns))]+ public void TheFlightOutlastsEveryReturnToEnemyControl(string how)+ {+ var c = Fled();+ var s = CombatTests.With(c, how == "enemy" ? CaptureTests.Enemy(1, 1, 0) : Soldier(1, 2, 0));+ var since = s.Date;+ var why = new List<Cause>();+ if (how == "timer")+ {+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.Occupied, since, turns: 2, fled: true);+ s = Simulation.Step(c, s, Array.Empty<Command>()).State;+ }+ else if (how == "end")+ {+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, since, fled: true);+ s.Date = c.End.AddDays(-10); // the next turn ends on the game's end+ since = s.Settlements["town_a"].Since;+ s = Simulation.Step(c, s, Array.Empty<Command>()).State;+ Assert.NotNull(s.GameOver);+ }+ else+ {+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, since, fled: true);+ SettlementControl.Capture(c, s, s.Date.AddDays(7), why);+ Assert.Contains(why, x => x.Target == "town_a" && x.Message.Contains("Its residents fled when it was captured"));+ }+ var x = s.Settlements["town_a"];+ Assert.Equal(("", "", since, true, false), (x.Owner, x.State, x.Since, x.Fled, x.Depopulated));+ }++ // R-CTRL-004: an ownerless fled record is no record for the capture check, so the town can be captured again; the new+ // record keeps fled=1 and takes the new turn's date.+ [Fact]+ public void AFledTownCanBeCapturedAgain()+ {+ var c = Fled();+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ s.Settlements["town_a"] = new SettlementControl(since: s.Date.AddDays(-30), fled: true);+ var next = Simulation.Step(c, s, Array.Empty<Command>()).State;+ var x = next.Settlements["town_a"];+ Assert.Equal((Movement.PlayerSide, SettlementControl.AwaitingChoice, next.Date, true), (x.Owner, x.State, x.Since, x.Fled));+ }++ // R-CTRL-011, R-CTRL-012: Occupy and the timer carry the flight on every record, and Occupy's line says so.+ [Fact]+ public void OccupyAndTheTimerCarryTheFlight()+ {+ var c = Fled();+ var s = CombatTests.With(c, Soldier(1, 1, 0));+ s.Settlements["town_a"] = new SettlementControl(Movement.PlayerSide, SettlementControl.AwaitingChoice, s.Date, fled: true);+ var first = Simulation.Step(c, s, new Command[] { new ResolveCapture("town_a", SettlementControl.Occupy) });+ Assert.Contains(first.Why, x => x.Target == "town_a" && x.Message.Contains("is occupied") && x.Message.Contains("Its residents fled when it was captured"));+ s = first.State;+ for (int i = 0; i < 4; i++)+ {+ Assert.True(s.Settlements["town_a"].Fled);+ s = Simulation.Step(c, s, Array.Empty<Command>()).State;+ }+ Assert.Equal((SettlementControl.AwaitingEnd, true), (s.Settlements["town_a"].State, s.Settlements["town_a"].Fled));+ }+}diff --git a/sim/Statecraft.Sim.Tests/RealContentTests.cs b/sim/Statecraft.Sim.Tests/RealContentTests.csindex 1c5f2d2ef..b1f53f9c5 100644--- a/sim/Statecraft.Sim.Tests/RealContentTests.cs+++ b/sim/Statecraft.Sim.Tests/RealContentTests.cs@@ -60,14 +60,28 @@ public class RealContentTests}// R-CTRL-001: the six rows the owner approved on 19 October 2026 and filled on 21 October 2026 (#793), Gaza excluded.- // The owner sensitivity-reviewed them (Q-TGT-3 (b); #793, https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840), so the release gate passes them.+ // The owner sensitivity-reviewed them (Q-TGT-3 (b); #793, https://github.com/eyalgolan/statecraft-israel/issues/793#issuecomment-6338280840);+ // #799 adds the residents fields, so every row is draft again and the release gate holds all six until the owner's review.[Fact]- public void SettlementTargetsAreTheSixApprovedReviewedRows()+ public void SettlementTargetsAreTheSixApprovedRowsAwaitingReview(){- Assert.Equal(new[] { "acre", "beersheba", "jaffa", "lod", "nazareth", "ramla" },- C.SettlementTargets.Select(t => t.Id).OrderBy(x => x, StringComparer.Ordinal));- Assert.All(C.SettlementTargets, target => Assert.Equal(ReleaseGate.ReviewedStatus, target.Status));- Assert.Empty(ReleaseGate.SettlementTargetsUnchecked(C));+ var ids = new[] { "acre", "beersheba", "jaffa", "lod", "nazareth", "ramla" };+ Assert.Equal(ids, C.SettlementTargets.Select(t => t.Id).OrderBy(x => x, StringComparer.Ordinal));+ Assert.All(C.SettlementTargets, target => Assert.Equal("draft", target.Status));+ Assert.Equal(ids, ReleaseGate.SettlementTargetsUnchecked(C).OrderBy(x => x, StringComparer.Ordinal));+ }++ // R-CTRL-016: the owner's per-place outcomes (#793): stayed only where the ruling says so, and only a stayed row has the+ // census-day count that joins the player's population (OWNER QUESTION 1 (a) on #799; CBS Statistical Abstract No. 3).+ [Fact]+ public void SettlementTargetResidentOutcomesAreTheOwnersRulings()+ {+ Assert.Equal(new[] { ("acre", "stayed"), ("beersheba", "fled"), ("jaffa", "fled"),+ ("lod", "fled"), ("nazareth", "stayed"), ("ramla", "fled") },+ C.SettlementTargets.OrderBy(x => x.Id, StringComparer.Ordinal).Select(x => (x.Id, x.Residents)).ToArray());+ Assert.Equal(new[] { ("acre", 4016m), ("nazareth", 16994m) },+ C.SettlementTargets.Where(x => x.Annexation != null).OrderBy(x => x.Id, StringComparer.Ordinal)+ .Select(x => (x.Id, x.Annexation!.People!.Value)).ToArray());}// R-CTRL-001 with #796: capture applies only to a target on mvp.enemy_held_localities. The five Arab-held targets arediff --git a/sim/Statecraft.Sim.Tests/SaveGameTests.cs b/sim/Statecraft.Sim.Tests/SaveGameTests.csindex e27df184d..31ba9162c 100644--- a/sim/Statecraft.Sim.Tests/SaveGameTests.cs+++ b/sim/Statecraft.Sim.Tests/SaveGameTests.cs@@ -29,13 +29,28 @@ public class SaveGameTestsnew Command[] { new SetPolicy("odd id with spaces%", 0.5), new MapAction("transit_camp", 4, 0) },new Command[] { new AssignWorkers("town_a", "job", 1), new UnitOrder(1, "hold") }, // GDD orders: the legacy fixture refuses themnew Command[] { new Train("town_a", "halutz", 1), new CancelTraining(1), new ReturnCraftsmen("town_a", 1), new ReassignCraftsmen("town_a", 1), new ReassignPioneers("town_a", "halutz", 1), new Reinforce(1, "town_a", 1) }, // GDD orders too- new Command[] { new PioneerWork(1, "build_yishuv", "site_a"), new StopWork(1), new StartProject("housing", "town_a", 1, 1), new CancelProject(1), new BuyArms(2), new Move(1, -2, 3), new ResolveCapture("town_a", "raid") },+ new Command[] { new PioneerWork(1, "build_yishuv", "site_a"), new StopWork(1), new StartProject("housing", "town_a", 1, 1), new CancelProject(1), new BuyArms(2), new Move(1, -2, 3), new ResolveCapture("town_a", "raid"), new EndOccupation("town_a", "annex") },new Command[] { new SecurityOrder(1) }, new Command[0],};foreach (var o in orders) g.Step(o);return g;}+ // R-CTRL-014: EndOccupation is saved as `endocc <settlement> <outcome>` and built from a scenario step.+ [Fact]+ public void EndOccupationRoundTripsThroughTheSaveAndTheScenario()+ {+ var save = new SaveGame(new string('a', 64), 1, Mode.Historical, SaveGame.GddRuleset, new string('b', 64));+ save.Record(new Command[] { new EndOccupation("town a", "annex") }, new GameState());+ var text = save.Write();+ Assert.Contains("endocc town%20a annex", text);+ var back = Assert.IsType<EndOccupation>(SaveGame.Parse(text).Turns.Single().Single());+ Assert.Equal(("town a", "annex"), (back.Settlement, back.Outcome));+ var built = Assert.IsType<EndOccupation>(Scenario.Build(new Dictionary<string, object>+ { ["kind"] = "end_occupation", ["settlement"] = "town_a", ["outcome"] = "annex" }));+ Assert.Equal(("town_a", "annex"), (built.Settlement, built.Outcome));+ }+// R-SAVE-003: the open turn's committed orders are written after the turns and read back in order.[Fact]public void TheOpenTurnRoundTrips()diff --git a/sim/Statecraft.Sim.Tests/TurnPreviewTests.cs b/sim/Statecraft.Sim.Tests/TurnPreviewTests.csindex 6c2eed84a..9ec727733 100644--- a/sim/Statecraft.Sim.Tests/TurnPreviewTests.cs+++ b/sim/Statecraft.Sim.Tests/TurnPreviewTests.cs@@ -72,6 +72,7 @@ public class TurnPreviewTestsAssert.False(Simulation.IsInstant(new ReturnCraftsmen("town_a", 1)));Assert.False(Simulation.IsInstant(new BuyArms(1)));Assert.False(Simulation.IsInstant(new ResolveCapture("lod", SettlementControl.Raid)));+ Assert.False(Simulation.IsInstant(new EndOccupation("nazareth", SettlementControl.Annex))); // R-CTRL-014: deferredAssert.False(Simulation.IsInstant(new SetPolicy("rationing", 0.5)));}diff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txtindex f67669a66..ebcc5699a 100644--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt@@ -12,3 +12,4 @@ scenario-mvp-absorb-first 6aa49f62b0c9bce24393a98d8aac1b4da9f7aed58dbee6bf3eae69mvp-end 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0bscenario-mvp-defeat 584a828a24355f522b8717646a7173b4567d2c202c111c048461d435fd66ccb1scenario-mvp-occupy-cost a767bb6641b6c42cc3dada27c9bcb806c7e4405610e70c70c61502cdd590d719+scenario-mvp-annex-nazareth d37e6db45e0b2cd20855ca5abb86a74aba791fbb52cc93eb3ae5218314abdc3adiff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-annex-nazareth.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-annex-nazareth.txtnew file mode 100644index 000000000..ae8162d2c--- /dev/null+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-annex-nazareth.txt@@ -0,0 +1,119 @@+1949-01-15;4354685564936847302;Historical;8;+ind{+ food_supply=0.4 [3FD999999999999A]+ housing=0.4192222056096913 [3FDAD4895FB6706D]+ intl_standing=0.5 [3FE0000000000000]+ morale=0.6701455495192676 [3FE571D51457D8B4]+ security=0.5086917724609377 [3FE04733F7CED918]+pol{+ border_settlement=0.2 [3FC999999999999A]+ housing_construction=0.3 [3FD3333333333333]+ maabarot=0 [0000000000000000]+eff{+ border_villages_secure=0.033691772460937505 [3FA1400C49BA5E36]+ building_houses=0.0722834300994873 [3FB2812AB851EB85]+ food_lifts_cohesion=0.03984375000000001 [3FA4666666666668]+ homes_lift_morale=0.06197826633453369 [3FAFBB9D85F06F69]+ safety_lifts_morale=0.04761640136718752 [3FA8612D4D4024B6]+ work_lifts_cohesion=0.04070713181754645 [3FA4D790AFBD9AFB]+shift{+ food_supply=0 [0000000000000000]+ housing=0 [0000000000000000]+ intl_standing=0 [0000000000000000]+ morale=-0.07000000000000006 [BFB1EB851EB851F0]+ security=0.17500000000000016 [3FC666666666666C]+bud{+ agriculture_minister=0.07 [3FB1EB851EB851EC]+ defense_minister=0.45 [3FDCCCCCCCCCCCCD]+ education_minister=0.06 [3FAEB851EB851EB8]+ finance_minister=0.05 [3FA999999999999A]+ health_minister=0.07 [3FB1EB851EB851EC]+ interior_minister=0.05 [3FA999999999999A]+ labour_minister=0.1 [3FB999999999999A]+ prime_minister=0.15 [3FC3333333333333]+pop{+ africa=9739.110001692712 [40C3058E1489145A]+ america_oceania=535.0499244151753 [4080B8663EC59399]+ asia=7512.155402122331 [40BD5827C86EF924]+ europe=81633.61444656934 [40F3EE19D4C5ED07]+ unknown=12145.947428858311 [40C7B8F945594CDE]+ veterans=656752.739703733 [41240AE17ABA729C]+sit[+treasury=0 [0000000000000000]+debt=24.3555919260477 [40385B08128D18B6]+fx=80.85238326859616 [4054368D728D91CC]+rung=5;cf=0;+mob=0.8 [3FE999999999999A]+stab=0.6370784604804298 [3FE462F25E17FBB2]+att=4 [4010000000000000]+fired[+ altalena+ bernadotte_assassination+ elections_1949+ first_truce+ idf_founding+ jerusalem_ceasefire+ jerusalem_military_government+ latrun_proposal+ operation_hiram+ operation_horev+ operation_yoav+ rhodes_talks+ second_truce+ sinai_withdrawal+ ten_days+pending[+ sinai_withdrawal+ rhodes_talks+ elections_1949+chosen{+ altalena=enforce+ bernadotte_assassination=outlaw+ first_truce=accept+ idf_founding=one_army+ jerusalem_ceasefire=keep+ jerusalem_military_government=military_government+ latrun_proposal=accept_vote+ operation_hiram=stop_at_ceasefire+ operation_horev=launch+ operation_yoav=stop_at_ceasefire+ second_truce=comply+ ten_days=central_front+appt{+under=;+map[+mapturn=0001-01-01:0;+over=+city{+ hadera=12,5,12,5,1,c0.35 [3FD6666666666666]+ haifa=99,42,101,42,4,c0.347029702970297 [3FD635BC123FDF8E]+ jerusalem=84,29,86,29,4,c0.3465116279069767 [3FD62D3F1B62D3F1]+ nazareth=17,7,17,7,0,c0.35 [3FD6666666666666]+ netanya=12,5,12,5,1,c0.35 [3FD6666666666666]+ petah_tikva=22,10,22,10,1,c0.35 [3FD6666666666666]+ rehovot=13,5,13,5,1,c0.35 [3FD6666666666666]+ rishon_lezion=10,5,10,5,1,c0.35 [3FD6666666666666]+ rosh_pinna=1,0,1,0,0,c0.35 [3FD6666666666666]+ safed=2,1,2,1,0,c0.35 [3FD6666666666666]+ tel_aviv=248,106,255,106,9,c0.3458823529411765 [3FD622EFBC895623]+ tiberias=6,2,6,2,0,c0.35 [3FD6666666666666]+ zikhron_yaakov=2,1,2,1,0,c0.35 [3FD6666666666666]+units[+ 0:veteran_soldier@7,10|side=israel|strength=4+ 1:veteran_soldier@5,8|side=israel|strength=2+ 2:veteran_soldier@0,15|side=israel|strength=4+ 3:veteran_soldier@-3,19|side=israel|strength=3+ 4:veteran_soldier@-5,23|side=israel|strength=3+ 5:veteran_soldier@0,23|side=israel|strength=3+ 7:veteran_soldier@-9,27|side=israel|strength=1+ 8:egyptian_army@-8,25|side=egypt|strength=10|order=fortify|target=-8,25+ 9:arab_legion@-2,22|side=jordan|strength=4|order=fortify|target=-2,22+ 10:syrian_army@13,6|side=syria|strength=3|order=fortify|target=13,6+ 11:iraqi_army@6,13|side=iraq|strength=3|order=fortify|target=6,13+ 12:arab_liberation_army@12,4|side=ala|strength=4|order=fortify|target=12,4+ 13:veteran_soldier@-4,23|side=israel|strength=2+next=14+ctrl{+ nazareth=owner=israel,state=annexed,since=1948-06-15+food=2253,751,0+arms=12\ No newline at end of filediff --git a/sim/Statecraft.Sim.Tests/scenarios/mvp-annex-nazareth.yaml b/sim/Statecraft.Sim.Tests/scenarios/mvp-annex-nazareth.yamlnew file mode 100644index 000000000..639ae5ab9--- /dev/null+++ b/sim/Statecraft.Sim.Tests/scenarios/mvp-annex-nazareth.yaml@@ -0,0 +1,19 @@+# Annexing a stayed town (#799): mvp-occupy-cost's two steps, then the answer to the end of the occupation. Golani's unit+# (id 0) moves onto Nazareth's hex on the first turn and captures it (R-CTRL-004); the scenario answers with Occupy on+# 15 June 1948 (R-CTRL-011), the timer runs out after six turn resolutions (R-CTRL-012), and on 15 December 1948 the+# scenario annexes Nazareth (R-CTRL-016). Nazareth's residents stayed (#793), so it becomes one city by the starting-city+# rule from its census-day count (OWNER QUESTION 1 (a) on #799; the count is proposed, awaiting the owner's approval), the+# upkeep stops and the unit may leave (OWNER QUESTION 3 (a)). It plays the real content, so it moves whenever a rule or+# value it reaches changes, Nazareth's approved count included.+name: mvp-annex-nazareth+until: 1949-01-15+steps:+ - on: 1948-05-15+ commands:+ - { kind: move, unit: 0, q: 7, r: 10 }+ - on: 1948-06-15+ commands:+ - { kind: resolve_capture, settlement: nazareth, outcome: occupy }+ - on: 1948-12-15+ commands:+ - { kind: end_occupation, settlement: nazareth, outcome: annex }diff --git a/sim/Statecraft.Sim/AttentionSystem.cs b/sim/Statecraft.Sim/AttentionSystem.csindex 2357f4528..129688732 100644--- a/sim/Statecraft.Sim/AttentionSystem.cs+++ b/sim/Statecraft.Sim/AttentionSystem.cs@@ -8,11 +8,11 @@ namespace Statecraft.Simpublic static class AttentionSystem{static readonly HashSet<string> Kinds = new HashSet<string>- { "set_policy", "allocate_budget", "choose_event_option", "set_mobilization", "security_order", "appoint", "map_action", "assign_workers", "train", "cancel_training", "reinforce", "return_craftsmen", "reassign_craftsmen", "reassign_pioneers", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms", "move", "unit_order", "resolve_capture" };+ { "set_policy", "allocate_budget", "choose_event_option", "set_mobilization", "security_order", "appoint", "map_action", "assign_workers", "train", "cancel_training", "reinforce", "return_craftsmen", "reassign_craftsmen", "reassign_pioneers", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms", "move", "unit_order", "resolve_capture", "end_occupation" };/// <summary>The kinds only the GDD v0.1 loop runs. Rules price them only when systems.loop is gdd, and the legacy loop/// refuses them before charging Attention.</summary>- static readonly HashSet<string> GddKinds = new HashSet<string> { "assign_workers", "train", "cancel_training", "reinforce", "return_craftsmen", "reassign_craftsmen", "reassign_pioneers", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms", "move", "unit_order", "resolve_capture" };+ static readonly HashSet<string> GddKinds = new HashSet<string> { "assign_workers", "train", "cancel_training", "reinforce", "return_craftsmen", "reassign_craftsmen", "reassign_pioneers", "pioneer_work", "stop_work", "start_project", "cancel_project", "buy_arms", "move", "unit_order", "resolve_capture", "end_occupation" };public static IReadOnlyCollection<string> CommandKinds => Kinds;diff --git a/sim/Statecraft.Sim/Cities.cs b/sim/Statecraft.Sim/Cities.csindex 064cbf3cd..ea3fb57b5 100644--- a/sim/Statecraft.Sim/Cities.cs+++ b/sim/Statecraft.Sim/Cities.cs@@ -32,6 +32,21 @@ namespace Statecraft.Simpublic static int NearestUnit(decimal people, int peoplePerUnit) =>(int)Math.Round(people / peoplePerUnit, MidpointRounding.AwayFromZero);+ /// <summary>R-CTRL-016 (OWNER QUESTION 1 (a) on #799, the starting-city rule): a stayed target joins the player's+ /// population as one new city: its approved people in units (R-CITY-007), homes equal to them, jobs equal to the+ /// employed (people times employed_share to the nearest unit), the usual start condition, and no refugees, recruits or+ /// craftsmen. Null when added, else the reason with the state unchanged (the id is already a city).</summary>+ internal static string? Annex(Content c, GameState s, SettlementTarget t)+ {+ if (s.Cities.ContainsKey(t.Id)) return $"{c.SettlementNames[t.Id]} is already a city";+ var r = c.RulesAt(s.Date).Mvp!;+ var people = t.Annexation!.People!.Value; // the loader requires both values on a stayed row+ var units = StartUnits(people, r.PeoplePerUnit);+ var employed = NearestUnit(people * t.Annexation.EmployedShare!.Value, r.PeoplePerUnit);+ s.Cities[t.Id] = new City(t.Id, units, employed, units, employed, 0, 0, r.HousingStartCondition!.Value);+ return null;+ }+/// <summary>Fills the state's cities from cities.yaml, with no refugees yet and the start housing condition (R-HOUSE-001). Does nothing in the legacy loop.</summary>public static void Init(Content c, GameState s){diff --git a/sim/Statecraft.Sim/Commands.cs b/sim/Statecraft.Sim/Commands.csindex 5194e2c6b..fed829f94 100644--- a/sim/Statecraft.Sim/Commands.cs+++ b/sim/Statecraft.Sim/Commands.cs@@ -198,6 +198,15 @@ namespace Statecraft.Simpublic ResolveCapture(string settlement, string outcome) { Settlement = settlement; Outcome = outcome; }}+ /// <summary>Answers the end of <see cref="Settlement"/>'s occupation with <see cref="Outcome"/>: annex or withdraw+ /// (SettlementControl.End, R-CTRL-014 to R-CTRL-017; no puppet regime, Q-PUP-1 (c)). GDD v0.1 loop only.</summary>+ public sealed class EndOccupation : Command+ {+ public override string Kind => SettlementControl.EndKind;+ public string Settlement { get; } public string Outcome { get; }+ public EndOccupation(string settlement, string outcome) { Settlement = settlement; Outcome = outcome; }+ }+public sealed class Rejection{public Command Command { get; } public string Reason { get; }@@ -255,6 +264,7 @@ namespace Statecraft.Simcase Move _: break;case BuyArms _: break;case ResolveCapture r: Text(r.Settlement, "Settlement"); Text(r.Outcome, "Outcome"); break;+ case EndOccupation e: Text(e.Settlement, "Settlement"); Text(e.Outcome, "Outcome"); break;case SetMobilization _: case SecurityOrder _: break;default: throw new ArgumentException("unknown command type " + cmd.GetType().Name, "commands");}diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 0571a07c8..00b5d40b6 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -1188,10 +1188,26 @@ namespace Statecraft.Simpublic int R { get; set; }public string Operation { get; set; } = "";public List<Source> Sources { get; set; } = new List<Source>();+ /// <summary>The residents' outcome at capture, fled or stayed (Q-ANNEX-1, owner, 18 October 2026, #783; per place on+ /// #793). Required; empty means the key was missing and is rejected by the loader.</summary>+ public string Residents { get; set; } = "";+ /// <summary>The sources for <see cref="Residents"/>, at least one (the per-place sourcing the ruling asks for).</summary>+ [YamlMember(Alias = "residents_sources")] public List<Source> ResidentsSources { get; set; } = new List<Source>();+ /// <summary>What joins the player's population when a stayed place is annexed (OWNER QUESTION 1 (a) on #799, the+ /// starting-city rule); required for stayed, refused for fled.</summary>+ public TargetAnnexation? Annexation { get; set; }/// <summary>Required on every row; empty means the key was missing and is rejected by the loader.</summary>public string Status { get; set; } = "";}+ /// <summary>A stayed target's annexation values (R-CTRL-016): the residents and their share in work, each a cities.yaml+ /// value (R-CITY-006). Housing, jobs and condition follow the starting-city rule (Q-START-1), so they are not stored.</summary>+ public sealed class TargetAnnexation+ {+ public CityValue? People { get; set; }+ [YamlMember(Alias = "employed_share")] public CityValue? EmployedShare { get; set; }+ }+public sealed class Content{public List<Office> Offices = new List<Office>();diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 27c83fb04..42c0b0f1f 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -59,6 +59,8 @@ namespace Statecraft.Simpublic const string SettlementsFileName = "map/settlements_1948.yaml";public const string MapLocationsFileName = "map/locations_1948.yaml";public const string SettlementTargetsFileName = "settlement_targets.yaml";+ /// <summary>The two values of a target row's <c>residents</c> (R-CTRL-016).</summary>+ public const string Fled = "fled", Stayed = "stayed";/// <summary>The settlements_1948.yaml row type a settlement target must have (Q-TGT-1 (a)).</summary>public const string ArabTown = "arab_town";@@ -1662,8 +1664,37 @@ namespace Statecraft.Simif (!Uri.TryCreate(source.Url, UriKind.Absolute, out var uri) || uri.Scheme != "https" || source.Checked == default)throw new ContentException(SettlementTargetsFileName, at + $".sources[{i}]", "needs an https url and a checked date");}+ ValidateResidents(x, at);Status(SettlementTargetsFileName, at + ".status", x.Status);}}++ /// <summary>R-CTRL-016 (Q-ANNEX-1; OWNER QUESTION 1 (a) on #799): a target's residents are fled or stayed, with at least+ /// one source; only a stayed row has an annexation block, whose people are a sourced whole number and whose employed+ /// share is from 0 to 1, each checked as a cities.yaml value.</summary>+ static void ValidateResidents(SettlementTarget x, string at)+ {+ const string f = SettlementTargetsFileName;+ if (x.Residents != Fled && x.Residents != Stayed)+ throw new ContentException(f, at + ".residents", $"must be {Fled} or {Stayed}, not '{x.Residents}'");+ if (x.ResidentsSources.Count == 0) throw new ContentException(f, at + ".residents_sources", "needs at least one source");+ for (int i = 0; i < x.ResidentsSources.Count; i++)+ {+ var source = x.ResidentsSources[i];+ if (source == null || !Uri.TryCreate(source.Url, UriKind.Absolute, out var uri) || uri.Scheme != "https" || source.Checked == default)+ throw new ContentException(f, at + $".residents_sources[{i}]", "needs an https url and a checked date");+ }+ if (x.Residents == Fled)+ {+ if (x.Annexation != null) throw new ContentException(f, at + ".annexation", "a fled place adds nothing on annexation, so it has no annexation block");+ return;+ }+ if (x.Annexation == null) throw new ContentException(f, at + ".annexation", "required for a stayed place");+ var people = CityValueOf(f, at + ".annexation.people", x.Annexation.People);+ Whole(f, at + ".annexation.people", people);+ if (people.Status != "sourced") throw new ContentException(f, at + ".annexation.people.status", "must be sourced: a resident count is a fact the owner approves");+ var share = CityValueOf(f, at + ".annexation.employed_share", x.Annexation.EmployedShare);+ if (share.Value < 0 || share.Value > 1) throw new ContentException(f, at + ".annexation.employed_share.value", "must be a number from 0 to 1");+ }}}diff --git a/sim/Statecraft.Sim/GddState.cs b/sim/Statecraft.Sim/GddState.csindex 72334ac97..c2191f715 100644--- a/sim/Statecraft.Sim/GddState.cs+++ b/sim/Statecraft.Sim/GddState.cs@@ -19,10 +19,13 @@ namespace Statecraft.Sim/// <summary>The occupation's turns left (R-CTRL-012): X when Occupy is given, counted down in resolver step 10; 0 when/// the place is not occupied or its timer has ended.</summary>public int Turns { get; }+ /// <summary>The residents fled when the place was captured (R-CTRL-003, R-CTRL-005; OWNER QUESTION 2 (b) on #799). Set+ /// at capture from the target row and never cleared, so it outlasts every return to enemy control.</summary>+ public bool Fled { get; }- public SettlementControl(string owner = "", string state = "", DateTime since = default, bool depopulated = false, int combatants = 0, string buildings = "", int turns = 0)+ public SettlementControl(string owner = "", string state = "", DateTime since = default, bool depopulated = false, int combatants = 0, string buildings = "", int turns = 0, bool fled = false){- Owner = owner; State = state; Since = since; Depopulated = depopulated; Combatants = combatants; Buildings = buildings; Turns = turns;+ Owner = owner; State = state; Since = since; Depopulated = depopulated; Combatants = combatants; Buildings = buildings; Turns = turns; Fled = fled;}public string Canonical()@@ -35,6 +38,7 @@ namespace Statecraft.Simif (Combatants != 0) fields.Add("combatants=" + Combatants.ToString(CultureInfo.InvariantCulture));if (Buildings != "") fields.Add("buildings=" + Buildings);if (Turns != 0) fields.Add("turns=" + Turns.ToString(CultureInfo.InvariantCulture));+ if (Fled) fields.Add("fled=1");return string.Join(",", fields);}}diff --git a/sim/Statecraft.Sim/Movement.cs b/sim/Statecraft.Sim/Movement.csindex 4da0e8620..a093f8288 100644--- a/sim/Statecraft.Sim/Movement.cs+++ b/sim/Statecraft.Sim/Movement.cs@@ -231,7 +231,9 @@ namespace Statecraft.Sim/// other locality's hex, so no enemy move ends on a player's locality while enemy capture (Q-TGT-2 (c)) is unbuilt.</summary>internal static HashSet<(int Q, int R)> NoEntry(Content c, GameState s, bool enemy = false){- var ids = c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities;+ // An annexed target is Israeli for good (R-CTRL-016, OWNER QUESTION 3 (a) on #799): not enemy-held.+ var ids = c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities+ .Where(id => !(s.Settlements.TryGetValue(id, out var x) && x.State == SettlementControl.Annexed)).ToList();var held = new HashSet<(int Q, int R)>(c.SettlementHexes.Where(h => ids.Contains(h.Id)).Select(h => (h.Q, h.R)));return enemy ? new HashSet<(int Q, int R)>(c.SettlementHexes.Select(h => (h.Q, h.R)).Where(h => !held.Contains(h))) : held;}diff --git a/sim/Statecraft.Sim/SaveGame.cs b/sim/Statecraft.Sim/SaveGame.csindex eff0d0cb9..8de4e76db 100644--- a/sim/Statecraft.Sim/SaveGame.cs+++ b/sim/Statecraft.Sim/SaveGame.cs@@ -155,6 +155,7 @@ namespace Statecraft.SimMove m => $"move {Int(m.Unit)} {Int(m.Q)} {Int(m.R)}",BuyArms a => $"arms {Int(a.Count)}",ResolveCapture r => $"capture {Esc(r.Settlement)} {Esc(r.Outcome)}",+ EndOccupation e => $"endocc {Esc(e.Settlement)} {Esc(e.Outcome)}",_ => throw new ArgumentException($"Cannot save command kind '{cmd.Kind}'", nameof(cmd)),};@@ -275,6 +276,7 @@ namespace Statecraft.Simcase "move": Arity(4); return new Move(I(f[1]), I(f[2]), I(f[3]));case "arms": Arity(2); return new BuyArms(I(f[1]));case "capture": Arity(3); return new ResolveCapture(Str(f[1]), Str(f[2]));+ case "endocc": Arity(3); return new EndOccupation(Str(f[1]), Str(f[2]));default: throw new SaveException(line, $"unknown command '{f[0]}'");}}diff --git a/sim/Statecraft.Sim/Scenario.cs b/sim/Statecraft.Sim/Scenario.csindex 076329b52..92ca5251c 100644--- a/sim/Statecraft.Sim/Scenario.cs+++ b/sim/Statecraft.Sim/Scenario.cs@@ -71,6 +71,7 @@ namespace Statecraft.Sim["start_project"] = new[] { "project", "city", "q", "r" }, ["cancel_project"] = new[] { "project" },["move"] = new[] { "unit", "q", "r" },["buy_arms"] = new[] { "count" }, ["resolve_capture"] = new[] { "settlement", "outcome" },+ ["end_occupation"] = new[] { "settlement", "outcome" },};public static IReadOnlyCollection<string> Kinds => Allowed.Keys;@@ -110,6 +111,7 @@ namespace Statecraft.Simcase "move": return new Move(Whole(c, "unit"), Whole(c, "q"), Whole(c, "r"));case "buy_arms": return new BuyArms(Whole(c, "count"));case "resolve_capture": return new ResolveCapture(Str(c, "settlement"), Str(c, "outcome"));+ case "end_occupation": return new EndOccupation(Str(c, "settlement"), Str(c, "outcome"));default: throw new InvalidDataException($"command kind '{kind}' has no builder");}}@@ -155,6 +157,7 @@ namespace Statecraft.SimStartProject p => FormattableString.Invariant($"{p.ProjectKind} {p.City} {p.Q},{p.R}"), CancelProject p => p.Project.ToString(CultureInfo.InvariantCulture),Move m => FormattableString.Invariant($"{m.Unit} {m.Q},{m.R}"),BuyArms a => a.Count.ToString(CultureInfo.InvariantCulture), ResolveCapture r => $"{r.Settlement} {r.Outcome}",+ EndOccupation e => $"{e.Settlement} {e.Outcome}",_ => c.Kind,};}diff --git a/sim/Statecraft.Sim/SettlementControl.cs b/sim/Statecraft.Sim/SettlementControl.csindex 69efaf356..94ca4f8bd 100644--- a/sim/Statecraft.Sim/SettlementControl.cs+++ b/sim/Statecraft.Sim/SettlementControl.cs@@ -24,9 +24,13 @@ namespace Statecraft.Simvar enemyHeld = new HashSet<string>(c.RulesAt(s.Date).Mvp!.EnemyHeldLocalities, StringComparer.Ordinal);foreach (var t in c.SettlementTargets.Where(x => enemyHeld.Contains(x.Id)).OrderBy(x => x.Id, StringComparer.Ordinal)){- if (Holder(s, t.Q, t.R) != Movement.PlayerSide || s.Settlements.ContainsKey(t.Id)) continue;- s.Settlements[t.Id] = new SettlementControl(Movement.PlayerSide, AwaitingChoice);- why.Add(new Cause("map", t.Id, 0, $"{c.SettlementNames[t.Id]} is captured: Israeli units hold it and no enemy unit is there. It awaits a decision"));+ // An ownerless fled record (the place returned to enemy control) is no record here, so it can be taken again.+ if (Holder(s, t.Q, t.R) != Movement.PlayerSide+ || (s.Settlements.TryGetValue(t.Id, out var old) && !(old.Owner == "" && old.Fled && !old.Depopulated))) continue;+ var fled = t.Residents == ContentLoader.Fled;+ s.Settlements[t.Id] = new SettlementControl(Movement.PlayerSide, AwaitingChoice, fled: fled);+ why.Add(new Cause("map", t.Id, 0, $"{c.SettlementNames[t.Id]} is captured: Israeli units hold it and no enemy unit is there. "+ + (fled ? "Its residents fled. " : "") + "It awaits a decision"));}}@@ -35,10 +39,10 @@ namespace Statecraft.Siminternal static void Stamp(GameState s, DateTime next){foreach (var id in s.Settlements.Where(x => x.Value.Since == default- && (x.Value.Owner == Movement.PlayerSide || x.Value.Depopulated)).Select(x => x.Key).ToList())+ && (x.Value.Owner == Movement.PlayerSide || x.Value.Depopulated || x.Value.Fled)).Select(x => x.Key).ToList()){var x = s.Settlements[id];- s.Settlements[id] = new SettlementControl(x.Owner, x.State, next, x.Depopulated, x.Combatants, x.Buildings, x.Turns);+ s.Settlements[id] = new SettlementControl(x.Owner, x.State, next, x.Depopulated, x.Combatants, x.Buildings, x.Turns, x.Fled);}}@@ -52,8 +56,9 @@ namespace Statecraft.Simforeach (var t in c.SettlementTargets.Where(x => enemyHeld.Contains(x.Id)).OrderBy(x => x.Id, StringComparer.Ordinal)){if (Holder(s, t.Q, t.R) != Enemy || !s.Settlements.TryGetValue(t.Id, out var record) || record.State != AwaitingChoice) continue;- s.Settlements.Remove(t.Id);- why.Add(new Cause("map", t.Id, 0, $"{c.SettlementNames[t.Id]} is under enemy control again: enemy units hold it and no Israeli unit is there"));+ Release(s, t.Id);+ why.Add(new Cause("map", t.Id, 0, $"{c.SettlementNames[t.Id]} is under enemy control again: enemy units hold it and no Israeli unit is there"+ + (record.Fled ? ". " + FledLine : "")));}}@@ -99,19 +104,91 @@ namespace Statecraft.Sim{case Raid: return Withdraw(c, s, id, why, false);case Occupy: return StartOccupation(c, s, id, why);- case Deport: return c.RulesAt(s.Date).Mvp!.DeportInPlay ? Depopulate(c, s, id, why) : "Deport is not built yet";+ case Deport:+ if (!c.RulesAt(s.Date).Mvp!.DeportInPlay) return "Deport is not built yet";+ // R-CTRL-018, OWNER QUESTION 4 (a) on #799: a fled town has no one left to deport, so Deport stays listed+ // third but is refused with this reason, which the options helper shows on its button.+ return s.Settlements[id].Fled ? NoOneToDeport : Depopulate(c, s, id, why);default: return "That outcome is not known";}}+ /// <summary>Deport's refusal for a fled town (OWNER QUESTION 4 (a) on #799; in the owner's sensitivity packet).</summary>+ const string NoOneToDeport = "Its residents fled when it was captured, so there is no one to deport";++ /// <summary>The kind of <see cref="EndOccupation"/>, with one attention_cost key (R-CTRL-014).</summary>+ public const string EndKind = "end_occupation";+ /// <summary>The outcomes of EndOccupation (R-CTRL-015; Q-PUP-1 (c): no puppet regime).</summary>+ public const string Annex = "annex";+ public const string WithdrawOutcome = "withdraw";+ /// <summary>The <see cref="State"/> of an annexed place: Israeli for good, no timer, upkeep or garrison (R-CTRL-016).</summary>+ public const string Annexed = "annexed";++ /// <summary>R-CTRL-015: the end outcomes in their one fixed order, the ruling's words "annex or withdraw".</summary>+ static readonly string[] EndOutcomes = { Annex, WithdrawOutcome };++ /// <summary>R-CTRL-015: what the end of <paramref name="id"/>'s occupation offers, Annex then Withdraw, each with its+ /// refusal or preview, as <see cref="CaptureOptions"/> does; empty when the place is not awaiting the end. Leaves+ /// <paramref name="s"/> as it found it.</summary>+ public static IReadOnlyList<CaptureOption> EndOptions(Content c, GameState s, string id)+ {+ if (NotEnding(s, id) != null) return Array.Empty<CaptureOption>();+ var options = new List<CaptureOption>();+ foreach (var outcome in EndOutcomes)+ {+ var after = s.Clone();+ var refusal = AttentionSystem.TrySpend(c, after, EndKind) ?? End(c, after, id, outcome, new List<Cause>());+ options.Add(new CaptureOption(outcome, refusal, refusal == null ? Preview(s, after) : null));+ }+ return options;+ }++ /// <summary>R-CTRL-014 to R-CTRL-017: carries out EndOccupation. Null when done, else the reason, with the state+ /// unchanged: the place is not awaiting the end (a depopulated place never is, R-CTRL-017), the outcome is not known,+ /// or no Israeli military unit is on the place, for either outcome. Withdraw is the Raid withdrawal (R-CTRL-010).</summary>+ internal static string? End(Content c, GameState s, string id, string outcome, List<Cause> why)+ {+ if (NotEnding(s, id) is string no) return no;+ switch (outcome)+ {+ case Annex: return AnnexPlace(c, s, id, why);+ case WithdrawOutcome:+ // R-CTRL-014: withdrawing needs the unit that holds the place too, as annexing does.+ if (!Garrisoned(s, c.SettlementTargets.First(x => x.Id == id))) return $"Withdraw needs an Israeli military unit on {c.SettlementNames[id]}";+ return Withdraw(c, s, id, why, false);+ default: return "That outcome is not known";+ }+ }++ static string? NotEnding(GameState s, string id) =>+ s.Settlements.TryGetValue(id, out var x) && x.State == AwaitingEnd ? null : "That place is not awaiting the end of its occupation";++ /// <summary>R-CTRL-016 (Q-ANNEX-1; OWNER QUESTIONS 1 (a) and 3 (a) on #799): the record becomes owner=israel,+ /// state=annexed, keeping its capture date and fled, with no timer. A fled place adds nothing else ("Territory only, no+ /// gain"). A stayed place adds one city by the starting-city rule (<see cref="Cities.Annex"/>). Step 10 ignores an+ /// annexed record, so its upkeep stops and no unit has to stay. Needs the garrison, as Occupy does (R-CTRL-011).</summary>+ static string? AnnexPlace(Content c, GameState s, string id, List<Cause> why)+ {+ var t = c.SettlementTargets.First(x => x.Id == id); // only a target gets a record (R-CTRL-004)+ var name = c.SettlementNames[id];+ if (!Garrisoned(s, t)) return $"Annex needs an Israeli military unit on {name}";+ var x = s.Settlements[id];+ if (!x.Fled && Cities.Annex(c, s, t) is string refused) return refused;+ s.Settlements[id] = new SettlementControl(Movement.PlayerSide, Annexed, x.Since, x.Depopulated, x.Combatants, x.Buildings, 0, x.Fled);+ why.Add(new Cause("map", id, 0, x.Fled+ ? $"{name} is annexed. Its residents fled when it was captured, so no people, homes or jobs are added"+ : $"{name} is annexed. Its residents join the population"));+ return null;+ }+static string? NotAwaiting(GameState s, string id) =>s.Settlements.TryGetValue(id, out var x) && x.State == AwaitingChoice ? null : "That place is not awaiting a decision on its capture";/// <summary>R-CTRL-010, Raid and withdraw (Q-RAID-1 (a)): the player's units on the place's hex, soldiers and halutzim/// alike, leave in id order, each to the first neighbouring hex in the fixed <see cref="Movement.Neighbours"/> order/// that is land, holds no enemy unit, is no enemy-held locality (R-MOVE-005) and has room for it (R-MOVE-003). Leaving- /// costs no movement points (the default proposed on #797). The record goes, so the place is under enemy control again- /// at once, and its residents are unchanged. Refused, the state untouched, when a unit has nowhere to go, unless+ /// costs no movement points (the default proposed on #797). The record goes (a fled one stays ownerless, <see cref="Release"/>),+ /// so the place is under enemy control again at once, and its residents are unchanged (or fled at capture). Refused, the state untouched, when a unit has nowhere to go, unless/// <paramref name="atTheEnd"/>: then that unit stays, the others leave and the record still goes.</summary>static string? Withdraw(Content c, GameState s, string id, List<Cause> why, bool atTheEnd){@@ -119,14 +196,31 @@ namespace Statecraft.Simvar name = c.SettlementNames[id];var moved = new List<(Unit From, Unit To)>();if (MoveOut(c, s, t, name, atTheEnd, moved) is string no) return no;- s.Settlements.Remove(id);+ var residents = Residents(s.Settlements[id]);+ Release(s, id);Withdrew(id, name, moved, why);why.Add(new Cause("map", id, 0, moved.Count > 0- ? $"{name}: Israeli units withdrew and it is under enemy control again. Its residents are unchanged"- : $"{name} is under enemy control again. Its residents are unchanged"));+ ? $"{name}: Israeli units withdrew and it is under enemy control again. {residents}"+ : $"{name} is under enemy control again. {residents}"));return null;}+ /// <summary>The line about a fled place's residents after its capture (OWNER QUESTION 2 (b) on #799; in the owner's+ /// sensitivity packet).</summary>+ const string FledLine = "Its residents fled when it was captured";++ /// <summary>What the player-facing lines say about the residents: unchanged for a stayed place, fled for a fled one.</summary>+ static string Residents(SettlementControl x) => x.Fled ? FledLine : "Its residents are unchanged";++ /// <summary>R-CTRL-004, R-CTRL-010 (OWNER QUESTION 2 (b) on #799): a place returns to enemy control. A fled record stays+ /// as an ownerless record with its capture date, the flight remembered; any other record goes.</summary>+ static void Release(GameState s, string id)+ {+ var x = s.Settlements[id];+ if (x.Fled) s.Settlements[id] = new SettlementControl(since: x.Since, fled: true);+ else s.Settlements.Remove(id);+ }+/// <summary>R-CTRL-010's move: the units leave <paramref name="t"/>'s hex as <see cref="Withdraw"/> says, into/// <paramref name="moved"/>. Raid and Deport share it (R-CTRL-018). The reason, with every unit back where it was, when/// one has nowhere to go, unless <paramref name="atTheEnd"/>.</summary>@@ -199,8 +293,8 @@ namespace Statecraft.Simif (!Garrisoned(s, t)) return $"Occupy needs an Israeli military unit on {name}";var x = s.Settlements[id];var turns = c.RulesAt(s.Date).Mvp!.OccupationTurns!.Value;- s.Settlements[id] = new SettlementControl(x.Owner, Occupied, x.Since, x.Depopulated, x.Combatants, x.Buildings, turns);- why.Add(new Cause("map", id, turns, FormattableString.Invariant($"{name} is occupied for {turns} turns: an Israeli unit stays there. Its residents are unchanged")));+ s.Settlements[id] = new SettlementControl(x.Owner, Occupied, x.Since, x.Depopulated, x.Combatants, x.Buildings, turns, x.Fled);+ why.Add(new Cause("map", id, turns, FormattableString.Invariant($"{name} is occupied for {turns} turns: an Israeli unit stays there. ") + Residents(x)));return null;}@@ -240,14 +334,14 @@ namespace Statecraft.Simvar name = c.SettlementNames[id];if (!Garrisoned(s, c.SettlementTargets.First(t => t.Id == id))){- s.Settlements.Remove(id);- why.Add(new Cause("map", id, 0, $"{name}: no Israeli unit holds it any more, so the occupation ended as a raid. It is under enemy control again. Its residents are unchanged"));+ Release(s, id);+ why.Add(new Cause("map", id, 0, $"{name}: no Israeli unit holds it any more, so the occupation ended as a raid. It is under enemy control again. {Residents(x)}"));continue;}EconomySystem.PayOrBorrow(c, s, r.OccupationUpkeepPerTurn!.Value, $"for the occupation of {name}", why);if (x.State == AwaitingEnd) continue;var left = x.Turns - 1;- s.Settlements[id] = new SettlementControl(x.Owner, left == 0 ? AwaitingEnd : Occupied, x.Since, x.Depopulated, x.Combatants, x.Buildings, left);+ s.Settlements[id] = new SettlementControl(x.Owner, left == 0 ? AwaitingEnd : Occupied, x.Since, x.Depopulated, x.Combatants, x.Buildings, left, x.Fled);why.Add(new Cause("map", id, left, left == 0? $"{name}: the occupation period has ended. It awaits a decision": FormattableString.Invariant($"{name}: {left} turns of occupation left")));diff --git a/sim/Statecraft.Sim/Simulation.cs b/sim/Statecraft.Sim/Simulation.csindex f4404be7e..2e460ef4a 100644--- a/sim/Statecraft.Sim/Simulation.cs+++ b/sim/Statecraft.Sim/Simulation.cs@@ -239,6 +239,8 @@ namespace Statecraft.Simreturn Pools.BuyArms(c, s, a.Count, why);case ResolveCapture x:return SettlementControl.Resolve(c, s, x.Settlement, x.Outcome, why);+ case EndOccupation x:+ return SettlementControl.End(c, s, x.Settlement, x.Outcome, why);case SecurityOrder o:// long arithmetic: an extreme delta clamps to the ladder's end instead of wrapping around.SecuritySystem.SetRung(c, s, (int)Math.Max(1L, Math.Min(5L, (long)s.Rung + o.Delta)), why);diff --git a/sim/Statecraft.Sim/Training.cs b/sim/Statecraft.Sim/Training.csindex 960a50dc9..6df5672bb 100644--- a/sim/Statecraft.Sim/Training.cs+++ b/sim/Statecraft.Sim/Training.cs@@ -44,7 +44,7 @@ namespace Statecraft.Sim/// starts with (cities.yaml, D-D5), a camp site of that kind built for it (sites.yaml city), or, for industry, a/// completed industry project in it (R-PROJ-003). A camp or a project being built does not count.</summary>public static bool HasFacility(Content c, GameState s, string city, string facility) =>- c.Cities.First(k => k.Id == city).Facilities.Contains(facility)+ c.Cities.FirstOrDefault(k => k.Id == city)?.Facilities.Contains(facility) == true // an annexed city (R-CTRL-016) has none|| (facility == Industry && s.CityProjects.Values.Any(p => p.City == city && p.Kind == Industry && p.BuiltOn != null))|| c.Sites.Any(x => x.City == city && x.Kinds.Contains(facility) && s.Sites.TryGetValue(x.Id, out var w) && w.BuiltOn != null);diff --git a/unity/Assets/Scripts/Map/Collection/CivilianPeople.cs b/unity/Assets/Scripts/Map/Collection/CivilianPeople.csindex d601299fb..6b184fdf2 100644--- a/unity/Assets/Scripts/Map/Collection/CivilianPeople.cs+++ b/unity/Assets/Scripts/Map/Collection/CivilianPeople.cs@@ -207,10 +207,11 @@ namespace Statecraft.Game.Map.CollectionInhabited(control, id) && !(VillagerUntil.TryGetValue(id, out var until) && date > until);/// <summary>Whether the sim has residents at place <paramref name="id"/>: inhabited unless its control record says- /// depopulated (SettlementControl.Depopulated; docs/gdd/settlement-control.md: residents are a state, inhabited by- /// default; a capture whose residents fled records them as gone). A place with no record is inhabited.</summary>+ /// depopulated (SettlementControl.Depopulated, Deport) or fled (SettlementControl.Fled, a capture whose residents fled,+ /// owned or not; OWNER QUESTION 2 (b) on #799; docs/gdd/settlement-control.md: residents are a state, inhabited by+ /// default). A place with no record is inhabited.</summary>public static bool Inhabited(IReadOnlyDictionary<string, SettlementControl>? control, string id) =>- control == null || !control.TryGetValue(id, out var record) || !record.Depopulated;+ control == null || !control.TryGetValue(id, out var record) || !(record.Depopulated || record.Fled);/// <summary>The anchors RuralLife's scenes of <paramref name="models"/> take: each model's first/// <see cref="RuralLife.MaxAnchorsPerModel"/> in its fixed hash order, each anchor once.</summary>diff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.csindex 26d76886d..5d1c2880b 100644--- a/unity/Assets/Scripts/UI/SimBridge.cs+++ b/unity/Assets/Scripts/UI/SimBridge.cs@@ -68,6 +68,7 @@ namespace Statecraft.Game.UICancelProject x => FormattableString.Invariant($"unproject:{x.Project}"),Move m => FormattableString.Invariant($"move:{m.Unit}"),ResolveCapture r => "capture:" + r.Settlement,+ EndOccupation e => "endocc:" + e.Settlement,_ => c.Kind,};@@ -165,6 +166,8 @@ namespace Statecraft.Game.UI// Answering a capture (#797): the sim refuses a place not awaiting the choice, or an outcome not built yet, with// its own reason and never throws on the id. The capture dialog is PR 10.case ResolveCapture _: return null;+ // Answering the end of an occupation (#799): the sim refuses a place not awaiting the end with its own reason.+ case EndOccupation _: return null;default: return text["order.invalid"];}}diff --git a/unity/Assets/Tests/EditMode/CaptureDialogTests.cs b/unity/Assets/Tests/EditMode/CaptureDialogTests.csindex 7e7655fb5..669f74525 100644--- a/unity/Assets/Tests/EditMode/CaptureDialogTests.cs+++ b/unity/Assets/Tests/EditMode/CaptureDialogTests.cs@@ -29,7 +29,7 @@ public class CaptureDialogTests{var dir = Paths.Content;var events = Directory.GetFiles(Path.Combine(dir, "events"), "*.yaml").Select(f => "events/" + Path.GetFileName(f)).ToList();- string Row(string id) => $" - {{ id: {id}, q: -3, r: 21, operation: \"{Operation}\", sources: [{{ url: \"https://example.org/{id}\", checked: 2026-10-21 }}], status: draft }}\n";+ string Row(string id) => $" - {{ id: {id}, q: -3, r: 21, operation: \"{Operation}\", sources: [{{ url: \"https://example.org/{id}\", checked: 2026-10-21 }}], residents: stayed, residents_sources: [{{ url: \"https://example.org/{id}/residents\", checked: 2026-10-21 }}], annexation: {{ people: {{ value: 60, status: sourced, date: 1948-11-08, sources: [{{ url: \"https://example.org/{id}/people\", checked: 2026-10-21 }}] }}, employed_share: {{ value: 0.5, status: design }} }}, status: draft }}\n"; // stayed, so the dialog's lines are the ones it tests (#799)return ContentLoader.Load(rel =>{var path = Path.Combine(dir, rel);diff --git a/unity/Assets/Tests/EditMode/CivilianPeopleTests.cs b/unity/Assets/Tests/EditMode/CivilianPeopleTests.csindex d19f3c444..a5961f479 100644--- a/unity/Assets/Tests/EditMode/CivilianPeopleTests.cs+++ b/unity/Assets/Tests/EditMode/CivilianPeopleTests.cs@@ -316,6 +316,20 @@ public sealed class CivilianPeopleTests"nobody stands in for them");}+ /// <summary>OWNER QUESTION 2 (b) on #799: a town whose residents fled at capture has no villager, whether the player+ /// holds it or it is under enemy control again (the ownerless fled record); a stayed capture keeps him.</summary>+ [Test]+ public void AFledTownIsNotInhabited()+ {+ var d = new DateTime(1948, 7, 10);+ IReadOnlyDictionary<string, SettlementControl> Record(SettlementControl x) =>+ new Dictionary<string, SettlementControl>(StringComparer.Ordinal) { ["lod"] = x };+ Assert.IsFalse(CivilianPeople.Inhabited(Record(new SettlementControl(since: d, fled: true)), "lod"), "ownerless fled record");+ Assert.IsFalse(CivilianPeople.Inhabited(Record(new SettlementControl("israel", SettlementControl.AwaitingChoice, d, fled: true)), "lod"), "owned fled record");+ Assert.IsTrue(CivilianPeople.Inhabited(Record(new SettlementControl("israel", SettlementControl.AwaitingChoice, d)), "lod"), "stayed capture");+ Assert.IsFalse(CivilianPeople.VillagerAt(Record(new SettlementControl("israel", SettlementControl.Occupied, d, fled: true)), "lod", d), "before Lod's sourced date");+ }+/// <summary>The owner, 21 October 2026, on #708: "hide each town's villager after its sourced date", from the #793/// packet's sources only (CivilianPeople.VillagerUntil quotes each). Jaffa's source puts its surrender in May, in a section/// that ends on 14 May 1948, so he never stands there in the game; Lod's is the last day of Operation Dani's range in thediff --git a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.csindex 1ad18f74f..199ba468b 100644--- a/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs+++ b/unity/Assets/Tests/EditMode/SimBridgeGuardTests.cs@@ -41,6 +41,7 @@ public class SimBridgeGuardTests[typeof(Move)] = new Move(1, 2, 0),[typeof(BuyArms)] = new BuyArms(0),[typeof(ResolveCapture)] = new ResolveCapture("town_a", "raid"),+ [typeof(EndOccupation)] = new EndOccupation("town_a", "annex"),};static IEnumerable<Type> CommandTypes() =>