A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: GDD Phase 1 PR 6, the first new yishuv objective card and the score (refs #379) (#653)
Beni Keyserman21af89e013fa
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2db3ee73b..0d15662d9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -133,6 +133,15 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBbuild; the tent/hut share is a parameter for a staged look later. The camp looks worn: tents sag between their poles,crease and lean, with dusty skirts, bleached roofs, patches and open door flaps; the tin huts are loose, rusting sheets,some lifted or missing; washing lines and bundles stand between the tents. Presentation only (refs #32).+- GDD v0.1 Phase 1, the first new yishuv objective and the score (refs #379): `content/objectives.yaml` holds `first_new_yishuv`, completed when Mefalsim is built, with Mefalsim's founding date+ (12 June 1949) as its reference date, and `content/events/first_new_yishuv.yaml` is its card. At the end of the turn the+ site is built, the objective is recorded once and scores 100 points plus 5 a calendar month before history, capped at 60+ (the owner's D-B6 and D-B2), and the card fires once; it never fires in the legacy loop (R-OBJ-001 to R-OBJ-003). An+ event's new `objective` key names its objective; an unanswered card resolves without an RNG draw. The point values are+ `rules.yaml` design values (`mvp.objective_points`, `objective_bonus_per_month`, `objective_bonus_cap`), read at the+ turn's start date. `hash1950` (`ad806776`), `hash1952` and `mvp-end` (`0f54dc51`) move: the reference player builds+ Mefalsim on 15 June 1949, so the objective completes on time for 100 points and its card fires and is answered;+ `smoke5` and the three scenarios do not move.- GDD v0.1 Phase 1, training (refs #377), behind the `systems.loop` switch: `Train` sends a city's civilians without workto basic training in a military camp (recruits, a count) or pioneer training in a Hakhshara (halutzim, movable units atthe city's hex), paid from the Treasury, with any shortfall borrowed as debt (owner decision, 15 October 2026);diff --git a/README.he.md b/README.he.mdindex 2d696a9f4..ac11c2d6d 100644--- a/README.he.md+++ b/README.he.md@@ -85,7 +85,7 @@ flowchart RL| שלב | מה הוא מוסיף | מצב | Issue ||---|---|---|---|| 0 | החלטות הבעלים בסעיפים הפתוחים ב־GDD | בתהליך: ההחלטות של שלב 1 התקבלו | [#375](https://github.com/eyalgolan/statecraft-israel/issues/375) |-| 1 | פרוסה ראשונה מאחורי מתג: עיר אחת (תל אביב), אימון, יישוב חדש אחד וכרטיס יעד אחד | בתהליך: 2 מתוך 8 PRs מוזגו | [#374](https://github.com/eyalgolan/statecraft-israel/issues/374) |+| 1 | פרוסה ראשונה מאחורי מתג: עיר אחת (תל אביב), אימון, יישוב חדש אחד וכרטיס יעד אחד | בתהליך: 6 מתוך 8 PRs מוזגו | [#374](https://github.com/eyalgolan/statecraft-israel/issues/374) || 2 | תורות חודשיים במשחק האמיתי, וחמשת המשאבים | הבא | [#382](https://github.com/eyalgolan/statecraft-israel/issues/382) || 3 | כל הערים, עם דיור, תעסוקה וקליטת עלייה | בהמשך | [#383](https://github.com/eyalgolan/statecraft-israel/issues/383) || 4 | חלוצים, אתרי בנייה, כבישים ומסילות ברזל | בהמשך | [#384](https://github.com/eyalgolan/statecraft-israel/issues/384) |diff --git a/README.md b/README.mdindex 5634ac7dc..96cca5dbb 100644--- a/README.md+++ b/README.md@@ -104,7 +104,7 @@ flowchart LR| Phase | What it adds | Status | Issue ||---|---|---|---|| 0 | Owner decisions on the open GDD items | In progress: the Phase 1 decisions are made | [#375](https://github.com/eyalgolan/statecraft-israel/issues/375) |-| 1 | A first slice behind a switch: one city (Tel Aviv), training, one new settlement and one objective card | In progress: 2 of 8 PRs merged | [#374](https://github.com/eyalgolan/statecraft-israel/issues/374) |+| 1 | A first slice behind a switch: one city (Tel Aviv), training, one new settlement and one objective card | In progress: 6 of 8 PRs merged | [#374](https://github.com/eyalgolan/statecraft-israel/issues/374) || 2 | Monthly turns for the real game, and the five resources | Next | [#382](https://github.com/eyalgolan/statecraft-israel/issues/382) || 3 | Every city, with housing, jobs and immigrant absorption | Later | [#383](https://github.com/eyalgolan/statecraft-israel/issues/383) || 4 | Pioneers, building sites, roads and railways | Later | [#384](https://github.com/eyalgolan/statecraft-israel/issues/384) |diff --git a/content/events/first_new_yishuv.yaml b/content/events/first_new_yishuv.yamlnew file mode 100644index 000000000..d02727dc6--- /dev/null+++ b/content/events/first_new_yishuv.yaml@@ -0,0 +1,35 @@+# yaml-language-server: $schema=../schema/event.schema.json+# The first new yishuv's completion card (objectives.yaml first_new_yishuv; docs/gdd/objective-card.md). It fires only once+# the objective is completed, in the GDD loop, and never in the legacy loop (R-OBJ-003). The facts are the site's (sites.yaml+# mefalsim, #378, research_notes/GDD objectives/designated-site-1.md). Claims and their sources:+# - 12 June 1949, the ceremony of going onto Jewish National Fund land: Yad Ben-Zvi; Gvati's list gives 12.6.49.+# - A garin of graduates of the Dror youth movement, from Uruguay and Argentina: Yad Ben-Zvi.+# - HaKibbutz HaMeuhad: Yad Ben-Zvi (the kibbutz counted itself in it); Gvati: a Mefalsim garin of HaKibbutz HaMeuhad set up+# a kibbutz in the Negev in Sivan 5709. Gvati's list puts "האיחוד" (Ihud HaKvutzot VeHaKibbutzim) in its movement column:+# that is the kibbutz's affiliation after the 1951 split that Yad Ben-Zvi records, not its movement in 1949.+# - First set up facing the Gaza Strip, moved to its present site a year later (1950) because of direct fire from Gaza:+# Yad Ben-Zvi.+# Left out on purpose: the advance party of 8 June 1949 (one source), the Speaker's attendance and the 64 founders (one+# source each), and 7 October 2023, which is outside the MVP's years (#378, question 4). The gazetteer check (#378, question+# 7): no 1948 locality in map/localities_1948.yaml (places of 1,000 or more) lies on the Israeli side within 9 km. The+# nearest depopulated villages, by en.wiki/Wikidata coordinates against Mefalsim's 31.5019 N, 34.5644 E, are Huj (about+# 5.6 km; counted with Dorot in Village Statistics 1945, so not in the file), al-Muharraqa (about 5.9 km; its article names+# Yakhini, 1950, on village land), Najd (about 6.3 km; names Sderot and Or HaNer) and Dimra (about 6.3 km; names Erez).+# None of the four articles names Mefalsim. Places under 1,000 people were not checked against a gazetteer (#654).+id: first_new_yishuv+title: Mefalsim founded+text: 'On 12 June 1949 a garin of graduates of the Dror youth movement from Argentina and Uruguay went onto Jewish National Fund land in the Negev, facing the Gaza Strip, and founded Kibbutz Mefalsim of HaKibbutz HaMeuhad. Because of direct fire from Gaza, the kibbutz moved to its present site a year later, in 1950.'+anchor: soft+objective: first_new_yishuv+# The window is the founding era; the card fires only once the objective is completed (R-OBJ-003), whatever the date.+from: 1948-05-15+to: 1957-01-01+options:+ - id: continue+ text: Continue+ historical: true+tags: []+sources:+ - { url: "https://israelalbum.org.il/mercazim/%D7%A7%D7%99%D7%91%D7%95%D7%A5-%D7%9E%D7%A4%D7%9C%D7%A1%D7%99%D7%9D/", checked: 2026-10-15 }+ - { url: "https://benyehuda.org/read/14684", checked: 2026-10-15 }+status: fact-checkeddiff --git a/content/objectives.yaml b/content/objectives.yamlnew file mode 100644index 000000000..b58805142--- /dev/null+++ b/content/objectives.yaml@@ -0,0 +1,11 @@+# GDD v0.1 objectives (docs/GDD.md "Objectives" and "Historical events on objective completion"; docs/gdd/objective-card.md).+# Completing an objective records it, scores it and fires its card (R-OBJ-001 to R-OBJ-003); only the GDD loop completes one.+# Sourced facts and links only: the points and the timing bonus are design values in rules.yaml's mvp: block (D-B6 and D-B2,+# #456). Phase 1 has one objective, the first new yishuv (D-A4).+objectives:+ - id: first_new_yishuv+ name: First new yishuv+ completes_when: { site_built: mefalsim } # sites.yaml; built by a halutz group's Build yishuv (R-SITE-001 to R-SITE-003)+ # Mefalsim's founding, the ceremony of 12 June 1949 (sites.yaml has the sources). The loader refuses any other date.+ reference_date: 1949-06-12+ card: first_new_yishuv # content/events/first_new_yishuv.yamldiff --git a/content/rules.yaml b/content/rules.yamlindex a47c01e7e..84c8587ec 100644--- a/content/rules.yaml+++ b/content/rules.yaml@@ -34,6 +34,9 @@ mvp:arrivals_city: tel_aviv # the MVP has one city so far: every arrival lands there (R-CITY-003)build_yishuv_turns: 6 # DESIGN VALUE: owner-set balance, not a historical figure (D-D6: turns a pioneer build takes)build_yishuv_cost: 2 # DESIGN VALUE: owner-set balance, not a historical figure (D-D6: IL millions, paid at the start)+ objective_points: 100 # DESIGN VALUE: owner-set balance, not a historical figure (D-B6: points per objective)+ objective_bonus_per_month: 5 # DESIGN VALUE: owner-set balance, not a historical figure (D-B2: points per month early)+ objective_bonus_cap: 60 # DESIGN VALUE: owner-set balance, not a historical figure (D-B2: the most bonus points)# Coalition stability lost by replacing a minister (Cabinet.Appoint): a seat taken from the minister's party, or a# reshuffle within it.appoint_stability_cost_other_party: 0.06diff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex e278e0e50..d0b28790e 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -16,6 +16,7 @@"tags": { "type": "array", "items": { "type": "string" }, "description": "holocaust, terror, massacre and war-casualties are sensitive." },"anchor": { "enum": ["hard", "soft"], "description": "Default soft. A hard anchor needs a historical option." },"office": { "$ref": "#/definitions/id", "description": "The office the event goes to when the player does not answer." },+ "objective": { "$ref": "#/definitions/id", "description": "The objective (objectives.yaml) whose completion card this is. It fires only once that objective is completed, and has exactly one option." },"from": { "$ref": "#/definitions/date", "description": "First day of the window." },"to": { "$ref": "#/definitions/date", "description": "End of the window (exclusive). Leave out for an open window." },"conditions": {diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex cad17ff5d..a4487e6d7 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -19,8 +19,8 @@ GitHub Releases page (and, from M4, on itch.io). Steps 1–3 are a normal pull r"$UNITY" -batchmode -CI false -GITHUB_ACTIONS false -TF_BUILD false -quit -projectPath unity -buildTarget WebGL -executeMethod Statecraft.Game.EditorTools.Build.Web -compression brotli -shareable -logFile "$PWD/unity-build-web-br.log"git checkout -- unity/Assets/Settings unity/ProjectSettings/ProjectSettings.assetuv run tools/web_check.py unity/Builds/Web-brotli --query "golden&smoke=5" \- --expect "GOLDEN OK 1950 f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2" \- --expect "GOLDEN OK 1952 75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31" \+ --expect "GOLDEN OK 1950 ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504" \+ --expect "GOLDEN OK 1952 0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2" \--expect "SMOKE OK 5 turns 1948-10-15 85191d48688be4595726b17778ecdda0175eff8f6f0fa1d976dbe3b48b42823b"bash scripts/oss/package_web.sh unity/Builds/Web-brotli unity/Builds/statecraft-israel-vX.Y.Z-web.zip```diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex 1f52557c2..1d4c8832f 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -38,6 +38,7 @@ schema too, or that test fails. Keep the comment when you copy a file.| `to` | no | Day the window ends (exclusive). Must be after `from`. Leave it out for an open window. || `conditions` | no | Indicator bounds that must hold when it fires. See below. || `requires` | no | Fires only after another event was resolved with a given option. See below. |+| `objective` | no | Makes the event the completion card of an objective in `objectives.yaml`, which must name this event as its `card`. It fires only once the objective is completed (GDD loop only), and has exactly one option. See `docs/gdd/objective-card.md`. || `options` | yes | One or more options. See below. || `sources` | no by the loader, yes by the rules | A list of `{ url, checked }`. See below. || `status` | no (default `draft`) | The review status. See below. |@@ -213,6 +214,9 @@ Errors are printed as `file: field: message`. These are the messages you are mos| `sensitive events cannot reward` | A sensitive-tagged event with a positive `treasury`, `fx_reserves`, `food_supply`, `morale` or `intl_standing` delta. || `must be 1-5` | `set_rung` outside 1 to 5. || `unknown policy` | `set_policy` names a policy that does not exist. |+| `unknown objective` | `objective` names an objective that is not in `objectives.yaml`. |+| `has another card` | `objective` names an objective whose `card` is a different event. |+| `an objective's card has exactly one option` | An objective's card has more than one option. || `must be a list` | A list field (such as `tags:`) written with no value. || `an event cannot require itself` | `requires.event` is the event's own id. || `requirements form a cycle` | Event A needs B and B needs A, directly or through others. |diff --git a/docs/determinism.md b/docs/determinism.mdindex bffd7565b..d725115c3 100644--- a/docs/determinism.md+++ b/docs/determinism.md@@ -28,9 +28,9 @@ final `GameState.Hash()` is pinned:| Run | Ends | Hash ||---|---|---|-| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2` |-| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31` |-| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31` |+| to 1950-01-01 (`Hash1950`) | 1950-01-15, turn 20 | `ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504` |+| to 1952-01-01 (`Hash1952`) | 1952-01-15, turn 44 (the game's end) | `0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2` |+| to the game's end (`mvp-end`) | 1952-01-15, turn 44 | `0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2` |`hash1952` stops at the first turn on or after 1 January 1952, which is the game's last turn, so it is the same run as`mvp-end` (`DeterminismTests.TheWholeGameToItsEndIsFixed`). Both names are kept (spec 2026-10-12 section 3 step 6): a@@ -45,8 +45,8 @@ Check every build with:```uv run tools/web_check.py unity/Builds/Web-<compression> --query "golden&smoke=5" \- --expect "GOLDEN OK 1950 f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2" \- --expect "GOLDEN OK 1952 75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31" \+ --expect "GOLDEN OK 1950 ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504" \+ --expect "GOLDEN OK 1952 0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2" \--expect "SMOKE OK 5 turns 1948-10-15 85191d48688be4595726b17778ecdda0175eff8f6f0fa1d976dbe3b48b42823b"```@@ -221,3 +221,6 @@ The hash reads the state keys, so it never sees a record outside its window. An| GDD Phase 2 PR 1 | scenario-cautious | `58eb01db` | monthly turns: ends 1949-01-15, turn 8 (was 1949-01-02, turn 23); rhodes_talks and elections_1949 now fire inside the run; the GDD sections appear; #577's rewritten cards and costs (was `1d5b8d71`) || GDD Phase 2 PR 1 | scenario-reckless | `e2f409a5` | same (was `c0bd12bc`) || GDD Phase 2 PR 1 | scenario-mvp-absorb-first | `f8858f6e` | plays the real content (the overlay is retired, `content: mvp` dropped); the Horev window edit makes rhodes_talks and sinai_withdrawal fire; #577's rewritten cards and costs (was `59ea3181`) |+| GDD Phase 1 PR 6 | 1950 | `ad806776` | the first new yishuv objective (R-OBJ-001 to R-OBJ-003), rebased onto the cutover: the reference player builds Mefalsim on 15 June 1949, the month of its 12 June 1949 founding, so the objective completes on time for 100 points (`obj{first_new_yishuv=1949-06-15}`, `score=100`) and its card fires and is answered (`first_new_yishuv=continue`); no other event moves, so the card displaces nothing under the soft-event cap; `objective_points`, `objective_bonus_per_month` and `objective_bonus_cap` enter `rules.yaml` as design values (D-B6, D-B2) (was `f97e9f81`) |+| GDD Phase 1 PR 6 | 1952 | `0f54dc51` | same (was `75d38299`) |+| GDD Phase 1 PR 6 | mvp-end | `0f54dc51` | same; the same run as hash1952 (was `75d38299`); `smoke5` and the three scenarios do not move |diff --git a/docs/event-images.md b/docs/event-images.mdindex f5ef72594..fd66198a8 100644--- a/docs/event-images.md+++ b/docs/event-images.md@@ -1,10 +1,12 @@# Event-card photographsThe event card's header picture, as in the promo (`promo/final/03-gameplay-1936.png`, `05-event-transit-camps.png`), is a-real archival photograph of the event, never an AI image. 24 of the 31 events in `content/events/` have one. The other-seven show the responsible minister's portrait in the card's head, as before: `rhodes_talks`, `armistice_lebanon`,+real archival photograph of the event, never an AI image. 24 of the 32 events in `content/events/` have one. Seven+others show the responsible minister's portrait in the card's head, as before: `rhodes_talks`, `armistice_lebanon`,`armistice_syria`, `sinai_withdrawal`, `education_registration_1951`, `reparations_claim` and `forex_crisis_1951`. No-free photograph that fits them was found (for `sinai_withdrawal`, see the decisions below).+free photograph that fits them was found (for `sinai_withdrawal`, see the decisions below). The eighth, the GDD objective+card `first_new_yishuv`, has no `office`, so it shows no picture at all until its photograph (Boris Carmi, June 1949, CC BY+4.0) comes in GDD Phase 1 PR 7 (#380).Owner ruling 2026-10-11 (summarised; recorded in `docs/CONTENT_POLICY.md` section 4):- Images of real people stay public domain or CC0, with one narrow exception: archival event photographs (notdiff --git a/docs/gdd/objective-card.md b/docs/gdd/objective-card.mdnew file mode 100644index 000000000..2d09443df--- /dev/null+++ b/docs/gdd/objective-card.md@@ -0,0 +1,49 @@+# Objectives: the completion card and the score++## Player story++As a player of the MVP, I want completing an objective to show me the real event it stands for and score me for finishing it, with more points the earlier I finish than history did, so that racing the historical record is worth it (GDD "Historical events on objective completion" [S1]; decisions D-B2, D-B6 [S2]).++## Rules++- The first objective, the first new yishuv, completes when Mefalsim is built (Build yishuv, R-SITE-001 to R-SITE-003). Its reference date is Mefalsim's founding, 12 June 1949 [S4][S5], and the loader refuses any other (R-OBJ-001).+- An objective is recorded once, in the last step of the GDD turn, with the turn's end date, and only in the GDD loop (R-OBJ-001).+- Completing an objective scores 100 points (unitless) once (D-B6 [S2], R-OBJ-002).+- Each calendar month (unitless) between the completion's month and the reference date's month adds 5 points (unitless), up to 60 points (unitless) (D-B2 [S2], R-OBJ-002). The same month is on time and earns no bonus; finishing late costs nothing. Calendar months match the owner's card wording [S6], and the owner confirmed them on 15 October 2026 [S7].+- The card's line, in a later Unity PR, reads "n months early", "Completed on time, as in history." in the same month, or "Completed n months later than in history." when late, in English and Hebrew (owner, 14 October 2026 [S6]). `Objectives.MonthsFromHistory` gives n in months: positive early, zero on time, negative late.+- The objective's card fires once, at the end of the turn the objective is completed in, so the player sees it at the start of the next turn. It never fires in the legacy loop (R-OBJ-003).+- A card has exactly one option. If the player leaves it unanswered, it resolves to that option without drawing from the RNG (R-OBJ-003).+- Objectives and score are the last step of the GDD turn, in the order the owner approved (D-A6 [S2][S3]).++## Data touched++- `content/objectives.yaml` (`id`, `name`, `completes_when.site_built`, `reference_date`, `card`), read in both loops when present: `first_new_yishuv` on Mefalsim.+- `content/events/first_new_yishuv.yaml`, the card: two sentences from the site's sources [S4][S5], `status: fact-checked`.+- An event's `objective` key (`content/schema/event.schema.json`, `docs/WRITING_EVENTS.md`).+- `rules.yaml` `mvp.objective_points`, `objective_bonus_per_month`, `objective_bonus_cap`, required in the GDD loop, as design values (R-LOOP-005). The score reads the rules of the date the turn starts from.+- `GameState`: `Objectives` (hashed as `obj{...}`) and `Score` (hashed as `score=`), both only when set (R-LOOP-002).++## Done when++- `dotnet test sim/Statecraft.sln` passes, including `ObjectivesTests`.+- `hash1950` moves to `ad806776`, `hash1952` and `mvp-end` to `0f54dc51`: the reference player builds Mefalsim in the month of its founding, so the objective completes on time for 100 points and its card fires and is answered (docs/determinism.md). `smoke5`, `scenario-cautious`, `scenario-reckless` and `scenario-mvp-absorb-first` do not move.++## Out of scope++- The war, absorption and railway objectives (Phase 2 and later); the card's photograph and its "completed on, historically" line in English and Hebrew (PR 7); the score on the HUD is already in (#598).++## Sources++- [S1] The game design of record, docs/GDD.md+- [S2] GDD v0.1 impact analysis and phased plan, section 5, docs/superpowers/specs/2026-10-12-gdd-v0.1-impact-and-plan.md+- [S3] GDD Phase 1 implementation plan, PR 6, docs/superpowers/plans/2026-10-12-gdd-phase-1.md+- [S4] Yad Ben-Zvi, "Israel Revealed to the Eye", Kibbutz Mefalsim, <https://israelalbum.org.il/mercazim/%D7%A7%D7%99%D7%91%D7%95%D7%A5-%D7%9E%D7%A4%D7%9C%D7%A1%D7%99%D7%9D/>, checked 2026-10-15+- [S5] Haim Gvati, 100 Years of Settlement, vol. 2, Ben-Yehuda Project edition, <https://benyehuda.org/read/14684>, checked 2026-10-15+- [S6] Owner decision on the card wording, <https://github.com/eyalgolan/statecraft-israel/issues/379>, checked 2026-10-15+- [S7] Owner decision on calendar months, <https://github.com/eyalgolan/statecraft-israel/pull/653#issuecomment-6197448493>, checked 2026-10-15++## Open questions++- At most 3 soft events fire in a turn. In a busy month a soft card could wait a turn. Should a card be exempt from that cap? (The card's `from: 1948-05-15` sorts it ahead of every later-dated soft event, and in the golden run it fires on its own turn; the reviewer suggests leaving the cap alone for now.)+- Whether the card should show at the start of the turn after completion (built here) or one turn later.+- Whether the bonus is the same for every objective (built here, as the decisions read) or set per objective.diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 1b7854916..eec1737dd 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -67,3 +67,11 @@ R-SITE-001: `PioneerWork(unit, build_yishuv, site)` starts building a yishuv atR-SITE-002: `StopWork(unit)` ends the unit's build: the site is available again, the unit is idle, and the progress and the Money paid are lost (D-A3). A unit that does not exist or is not building is refused with the state unchanged. Its Attention cost is 0.R-SITE-003: Each turn, in ordinal site id order, every site being built has one turn less to go. A site that reaches 0 is built, on the turn's end date, and its unit is idle again. The unit stays a halutz unit, and no city, housing, job, population or Social cohesion changes. Sites being built or built are written into the state hash only when there are some.++## Objectives++R-OBJ-001: An objective (`objectives.yaml`) names its condition, `completes_when: { site_built: <site> }`, a designated site of kind yishuv whose `founded` date must equal the objective's `reference_date`. In the last step of each GDD turn (spec §2.3, step 11; D-A6), in id order, an objective whose site is built and that is not yet recorded is recorded once, with the turn's end date (the site's `BuiltOn`). Recording it again, or in the legacy loop, changes nothing; a stopped build completes nothing.++R-OBJ-002: Recording an objective adds `objective_points + min(objective_bonus_cap, objective_bonus_per_month * monthsEarly)` to the score, once. `monthsEarly` is `max(0, monthsFromHistory)`, and `monthsFromHistory` counts calendar months from the completion's month to the reference date's month, `(y2 - y1) * 12 + (m2 - m1)`: 0 in the same month ("on time, as in history"), negative when late (owner's card wording, #379, 14 October 2026). Late costs nothing. The owner set 100 points (D-B6) and +5 a month capped at +60 (D-B2) on 14 October 2026 (#456); they are balance values and stay tunable, as `rules.yaml` design values (R-LOOP-005). The rules are those of the date the turn starts from (docs/determinism.md, "Rules per era"), so a turn that ends on the next era's first day scores with the era it started in.++R-OBJ-003: An event with `objective:` is that objective's card. It is eligible only once its objective is recorded, so it fires once, at the end of the turn the objective is completed in, and never in the legacy loop. A card has exactly one option, and an objective and its card name each other (the loader checks both). An unanswered card resolves to its option without drawing from the RNG.diff --git a/docs/superpowers/plans/2026-10-12-gdd-phase-1.md b/docs/superpowers/plans/2026-10-12-gdd-phase-1.mdindex c4dc7f498..e38e68757 100644--- a/docs/superpowers/plans/2026-10-12-gdd-phase-1.md+++ b/docs/superpowers/plans/2026-10-12-gdd-phase-1.md@@ -1021,11 +1021,10 @@ objectives:completes_when: { site_built: <site_id> }reference_date: <the site's founded date> # must equal sites.yaml founded (the loader checks)card: first_new_yishuv # content/events/first_new_yishuv.yaml- points: 100 # PLACEHOLDER: owner sets (D-B6)- bonus_per_month_early: 10 # PLACEHOLDER: owner sets (D-B2)- bonus_cap: 120 # PLACEHOLDER: owner sets (D-B2)```+**As built (15 October 2026, refs #379):** the point values are global, as D-B6 and D-B2 read: `mvp.objective_points: 100`, `objective_bonus_per_month: 5`, `objective_bonus_cap: 60`, as `rules.yaml` design values (the PR was rebased onto the cutover, #600, which retired the overlay), not per objective. The objective also has a `name`. Months are calendar months (`Objectives.MonthsFromHistory`, signed), to match the owner's card wording of 14 October 2026 on #379 ("on time" in the same month as history, "n months later" when late), not the whole-months formula of Task 6.2; the owner confirmed calendar months on 15 October 2026 (#653).+`content/events/first_new_yishuv.yaml`: `objective: first_new_yishuv`, `anchor: soft`, a window from 1948-05-15 to 1957-01-01, one option (`id: continue`, `historical: true`, no effects), a title naming the place, text of two or three sourced sentences in the house tone (what was founded, by whom, on what date, from the Task 5.0 sources; no quotes), tags `[]`, `sources` and `status: fact-checked`. The English says "War of Independence" if the war is named (D-E3). `content/schema/event.schema.json` gains `objective` (string). The loader checks the event's `objective` names an objective whose `card` is this event, and that an objective's `card` event has exactly one option.### Task 6.2: completion and score (R-OBJ-001, R-OBJ-002)diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.csindex 28bd52680..0fa1eff6f 100644--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs@@ -28,6 +28,9 @@ public class DesignValuesTests("rules.yaml", "mvp.cohesion_jobs_weight"),("rules.yaml", "mvp.build_yishuv_turns"),("rules.yaml", "mvp.build_yishuv_cost"),+ ("rules.yaml", "mvp.objective_points"),+ ("rules.yaml", "mvp.objective_bonus_per_month"),+ ("rules.yaml", "mvp.objective_bonus_cap"),("cities.yaml", "cities[tel_aviv].housing_capacity"),("cities.yaml", "cities[tel_aviv].job_slots"),("cities.yaml", "cities[tel_aviv].civilians"),@@ -111,6 +114,7 @@ public class DesignValuesTestsAssert.Equal((0.5, 1.0, 0.5), (c.Rules.AttentionCost["assign_workers"], c.Rules.AttentionCost["train"], c.Rules.AttentionCost["cancel_training"]));Assert.Equal((0.0, 0.0), (c.Rules.AttentionCost["pioneer_work"], c.Rules.AttentionCost["stop_work"])); // D-A6: unit orders are freeAssert.Equal((6, 2.0), (m.BuildYishuvTurns, m.BuildYishuvCost));+ Assert.Equal((100, 5, 60), (m.ObjectivePoints, m.ObjectiveBonusPerMonth, m.ObjectiveBonusCap)); // D-B6, D-B2var city = Assert.Single(c.Cities);Assert.Equal(("tel_aviv", 120, 90, 100, 80), (city.Id, city.HousingCapacity, city.JobSlots, city.Civilians, city.Employed));Assert.Equal(new[] { ("recruit", 3, 0.5), ("halutz", 4, 0.5) },diff --git a/sim/Statecraft.Sim.Tests/EventRetimingTests.cs b/sim/Statecraft.Sim.Tests/EventRetimingTests.csindex 490804f6b..c202a8c46 100644--- a/sim/Statecraft.Sim.Tests/EventRetimingTests.cs+++ b/sim/Statecraft.Sim.Tests/EventRetimingTests.cs@@ -25,15 +25,16 @@ public class EventRetimingTests/// (a card raised at the new game comes on 15 May 1948), or null.</summary>static DateTime? CardDate(string id) => Run.FirstOrDefault(s => s.FiredEvents.Contains(id))?.Date;- /// <summary>#567 section 4 item 8: all 31 events fire in the historical monthly run. Before the re-timing, sinai_withdrawal and- /// rhodes_talks never fired (Horev's card came after both windows had closed).</summary>+ /// <summary>#567 section 4 item 8: all 32 events fire in the historical monthly run (#567's 31 and the first new yishuv+ /// card, R-OBJ-003). Before the re-timing, sinai_withdrawal and rhodes_talks never fired (Horev's card came after both+ /// windows had closed).</summary>[Fact]public void EveryEventFiresInTheHistoricalMonthlyRun(){Assert.Equal(GameOverCodes.MvpEnded, Run[Run.Count - 1].GameOver);var missing = C.Events.Select(e => e.Id).Where(id => CardDate(id) == null).ToList();Assert.True(missing.Count == 0, "never fired: " + string.Join(", ", missing));- Assert.Equal(31, C.Events.Count);+ Assert.Equal(32, C.Events.Count);}/// <summary>The card date of every event, from #567's tables (the "Proposed" column in the war period, "Monthly" after@@ -61,6 +62,7 @@ public class EventRetimingTests[InlineData("armistice_lebanon", "1949-04-15")][InlineData("armistice_jordan", "1949-04-15")][InlineData("austerity_1949", "1949-05-15")]+ [InlineData("first_new_yishuv", "1949-06-15")] // R-OBJ-003: the turn the reference player builds Mefalsim[InlineData("armistice_syria", "1949-08-15")][InlineData("frumkin_commission", "1950-01-15")][InlineData("maabarot_policy", "1950-04-15")]diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.csindex e67a00189..076853ab6 100644--- a/sim/Statecraft.Sim.Tests/Fixture.cs+++ b/sim/Statecraft.Sim.Tests/Fixture.cs@@ -224,6 +224,9 @@ mvp:arrivals_city: town_abuild_yishuv_turns: 3build_yishuv_cost: 1.5+ objective_points: 100+ objective_bonus_per_month: 5+ objective_bonus_cap: 60";public const string GddCities = @"diff --git a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs b/sim/Statecraft.Sim.Tests/ObjectivesTests.csnew file mode 100644index 000000000..7529efce7--- /dev/null+++ b/sim/Statecraft.Sim.Tests/ObjectivesTests.cs@@ -0,0 +1,341 @@+using System;+using System.Collections.Generic;+using System.Linq;+using Statecraft.Sim;++/// <summary>The GDD slice's objectives (Phase 1 PR 6): an objective is recorded once, at the end of the turn its site is built,+/// and scores once (R-OBJ-001), with the owner's points and timing bonus (R-OBJ-002; D-B6 and D-B2, #456), and its card fires+/// only once it is recorded, never in the legacy loop (R-OBJ-003). The first objective is the first new yishuv, Mefalsim (#378).</summary>+public class ObjectivesTests+{+ static readonly Content Real = ContentLoader.Load(RealContentTests.ContentRoot());++ /// <summary>One objective on the fixture's site_a (founded 1949-06-12, built in 3 turns).</summary>+ const string ObjectivesYaml = "objectives:\n - { id: first_goal, name: First goal, completes_when: { site_built: site_a }, reference_date: 1949-06-12, card: first_card }\n";++ const string Card = @"+id: first_card+title: A new yishuv+text: The first new yishuv is founded.+from: 1948-05-15+to: 1957-01-01+objective: first_goal+options:+ - id: continue+ text: Continue+ historical: true+";++ static readonly MvpRules Rules = new MvpRules { ObjectivePoints = 100, ObjectiveBonusPerMonth = 5, ObjectiveBonusCap = 60 };++ static Content Load(bool gdd, Dictionary<string, string>? files = null, string card = Card)+ {+ var o = gdd ? Fixture.Gdd() : new Dictionary<string, string>();+ o["objectives.yaml"] = ObjectivesYaml;+ if (files != null) foreach (var kv in files) o[kv.Key] = kv.Value;+ return ContentLoader.Load(Fixture.Write(o, new Dictionary<string, string> { ["first_card.yaml"] = card }));+ }++ static DateTime D(string iso) => DateTime.Parse(iso, System.Globalization.CultureInfo.InvariantCulture);++ static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);++ /// <summary>A new game with one idle halutz group at town_a's hex, ordered on the first turn to build site_a.</summary>+ static StepResult StartBuilding(Content c)+ {+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ var id = s.NextId++;+ s.Units.Add(id, new Unit(id, "halutz", 1, 0));+ var r = Step(c, s, new PioneerWork(id, Projects.BuildYishuv, "site_a"));+ Assert.Empty(r.Rejected);+ return r;+ }++ // R-OBJ-002: calendar months, so the same month is "on time, as in history" (owner's card wording, #379).+ [Theory]+ [InlineData("1949-06-12", "1949-06-12", 0)] // the same day+ [InlineData("1949-06-11", "1949-06-12", 0)] // one day early, the same month: on time+ [InlineData("1949-06-30", "1949-06-12", 0)] // later in the same month: on time+ [InlineData("1949-05-31", "1949-06-12", 1)] // one day early, the month before: a month early+ [InlineData("1949-05-12", "1949-06-12", 1)] // one month early, to the day+ [InlineData("1949-03-15", "1949-06-12", 3)] // the slice's build date+ [InlineData("1948-05-15", "1949-06-12", 13)]+ [InlineData("1949-07-01", "1949-06-12", -1)] // a month late+ [InlineData("1950-06-12", "1949-06-12", -12)]+ public void MonthsFromHistoryCountsCalendarMonths(string done, string reference, int months)+ {+ Assert.Equal(months, Objectives.MonthsFromHistory(D(done), D(reference)));+ Assert.Equal(Math.Max(0, months), Objectives.MonthsEarly(D(done), D(reference)));+ }++ // R-OBJ-002: 100 points, +5 a month early, the bonus capped at +60 (D-B6, D-B2); late costs nothing.+ [Theory]+ [InlineData("1949-06-12", 100)]+ [InlineData("1949-06-01", 100)]+ [InlineData("1949-09-15", 100)] // late+ [InlineData("1949-05-31", 105)]+ [InlineData("1948-07-15", 155)] // 11 months early+ [InlineData("1948-06-15", 160)] // 12 months early: the cap+ [InlineData("1948-05-15", 160)] // 13 months early: still the cap+ [InlineData("0001-01-01", 160)] // a gap whose bonus would overflow an int is still the cap+ public void PointsAreTheBaseAndTheCappedBonus(string done, int points) =>+ Assert.Equal(points, Objectives.Points(Rules, D(done), D("1949-06-12")));++ // R-OBJ-001, R-OBJ-002+ [Fact]+ public void AnObjectiveIsRecordedOnceAndScoredOnce()+ {+ var c = Load(gdd: true);+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ var why = new List<Cause>();+ Assert.True(Objectives.Record(c, s, c.Rules.Mvp!, "first_goal", D("1949-04-15"), why));+ Assert.Equal(D("1949-04-15"), Assert.Single(s.Objectives).Value);+ Assert.Equal(110, s.Score); // 2 months early (April to June)+ Assert.Contains(why, x => x.System == "events" && x.Message == "First goal: completed, 110 points");++ var hash = s.Hash();+ Assert.False(Objectives.Record(c, s, c.Rules.Mvp!, "first_goal", D("1949-05-15"), why));+ Assert.Equal(hash, s.Hash());+ }++ // R-OBJ-001: the legacy loop records nothing.+ [Fact]+ public void TheLegacyLoopRecordsNoObjective()+ {+ var c = Load(gdd: false);+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ var hash = s.Hash();+ Assert.False(Objectives.Record(c, s, c.Rules.Mvp!, "first_goal", D("1949-04-15"), new List<Cause>()));+ Assert.Equal(hash, s.Hash());+ }++ // R-OBJ-001, R-OBJ-002, R-OBJ-003: the objective completes on the turn its site is built, with that turn's end date, and+ // its card fires at the end of the same turn, so the player sees it at the start of the next one.+ [Fact]+ public void TheSiteBuiltCompletesTheObjectiveAndFiresTheCardOnce()+ {+ var c = Load(gdd: true);+ var r = StartBuilding(c);+ var turns = 1;+ while (r.State.Sites["site_a"].BuiltOn == null)+ {+ Assert.Empty(r.State.Objectives);+ Assert.Equal(0, r.State.Score);+ Assert.DoesNotContain("first_card", r.State.FiredEvents);+ r = Step(c, r.State);+ Assert.True(++turns <= 3, "the fixture builds in 3 turns");+ }+ var built = r.State.Sites["site_a"].BuiltOn!.Value;+ Assert.Equal(r.State.Date, built);+ Assert.Equal(built, Assert.Single(r.State.Objectives).Value);+ Assert.Equal(Objectives.Points(c.Rules.Mvp!, built, D("1949-06-12")), r.State.Score);+ Assert.Contains("first_card", r.State.PendingEvents);+ Assert.Contains(r.Why, x => x.System == "events" && x.Target == "first_goal");++ var score = r.State.Score;+ var s = Step(c, r.State, new ChooseEventOption("first_card", "continue")).State;+ for (int i = 0; i < 4; i++)+ {+ var next = Step(c, s);+ Assert.DoesNotContain("first_card", next.State.PendingEvents);+ Assert.DoesNotContain(next.Why, x => x.Target == "first_card" || x.Target == "first_goal");+ s = next.State;+ }+ Assert.Equal(score, s.Score);+ }++ // R-OBJ-002: a turn that crosses an era boundary scores with the rules of the date it starts from (docs/determinism.md,+ // "Rules per era"), not those of its end date. A turn that reaches the next era's start ends on that day, so its end+ // date is in the next era. The fixture's build ends on the turn 29 May to 12 June 1948, and a later era from 12 June 1948+ // sets objective_points to 1.+ [Fact]+ public void ATurnAcrossAnEraBoundaryScoresWithTheRulesItStartedIn()+ {+ const string eras = @"+eras:+ - id: founding+ name: The Founding+ from: 1948-05-15+ to: 1948-06-12+ systems: { loop: gdd }+ - id: later+ name: A Later Chapter+ from: 1948-06-12+ to: 1957-01-01+ systems: { loop: gdd }+";+ var o = Fixture.Gdd(new Dictionary<string, string> { ["eras.yaml"] = eras, ["objectives.yaml"] = ObjectivesYaml });+ var card = Card.Replace("from: 1948-05-15", "from: 1948-06-12"); // an event may not span an era boundary+ var dir = Fixture.Write(o, new Dictionary<string, string> { ["first_card.yaml"] = card });+ System.IO.Directory.CreateDirectory(System.IO.Path.Combine(dir, "rules"));+ System.IO.File.WriteAllText(System.IO.Path.Combine(dir, "rules", "later.yaml"), "mvp: { objective_points: 1 }\n");+ var c = ContentLoader.Load(dir);+ Assert.Equal(1, c.RulesAt(D("1948-06-12")).Mvp!.ObjectivePoints);++ var r = StartBuilding(c);+ var from = r.State.Date;+ while (r.State.Sites["site_a"].BuiltOn == null) { from = r.State.Date; r = Step(c, r.State); }+ var built = r.State.Sites["site_a"].BuiltOn!.Value;+ Assert.Equal((D("1948-05-29"), D("1948-06-12")), (from, built)); // the turn that reaches an era's start ends on it+ Assert.Equal(160, r.State.Score); // 100 and the capped bonus; the later era would give 1 + 60+ }++ // R-OBJ-001: a build that is stopped completes nothing.+ [Fact]+ public void AStoppedBuildCompletesNothing()+ {+ var c = Load(gdd: true);+ var r = StartBuilding(c);+ var unit = r.State.Units.Keys.Single();+ var s = Step(c, r.State, new StopWork(unit)).State;+ for (int i = 0; i < 6; i++) s = Step(c, s).State;+ Assert.Empty(s.Objectives);+ Assert.Equal(0, s.Score);+ Assert.DoesNotContain("first_card", s.FiredEvents);+ }++ // R-OBJ-003: in the legacy loop no objective is recorded, so the card never fires, however long the game runs.+ [Fact]+ public void TheCardNeverFiresInTheLegacyLoop()+ {+ var c = Load(gdd: false);+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ for (int i = 0; i < 20 && s.GameOver == null; i++)+ {+ s = Step(c, s).State;+ Assert.DoesNotContain("first_card", s.FiredEvents);+ }+ }++ // R-OBJ-003: an unanswered card resolves to its one option without drawing from the RNG (Phase 1 adds no draw).+ [Fact]+ public void AnUnansweredCardIsDelegatedWithoutADraw()+ {+ var c = Load(gdd: true);+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ Objectives.Record(c, s, c.Rules.Mvp!, "first_goal", s.Date, new List<Cause>());+ s = Step(c, s).State;+ Assert.Contains("first_card", s.PendingEvents);++ var delegated = Step(c, s).State;+ var answered = Step(c, s, new ChooseEventOption("first_card", "continue")).State;+ Assert.Equal("continue", delegated.ChosenOptions["first_card"]);+ Assert.Empty(delegated.PendingEvents);+ Assert.Equal(answered.RngState, delegated.RngState);+ }++ // R-OBJ-001: a save holds the orders only, so the objective and the score come back by replay.+ [Fact]+ public void TheObjectiveAndScoreSurviveASave()+ {+ var c = Load(gdd: true);+ var g = GameSession.New(c, 1, Mode.Historical);+ Assert.Empty(g.Step(new Command[] { new Train("town_a", "halutz", 1) }).Rejected);+ for (int i = 0; i < 10 && g.State.Units.Count == 0; i++) g.Step(new Command[0]);+ var id = Assert.Single(g.State.Units.Keys); // the cohort took an id first; the unit takes the next+ Assert.Empty(g.Step(new Command[] { new PioneerWork(id, Projects.BuildYishuv, "site_a") }).Rejected);+ for (int i = 0; i < 10 && g.State.Objectives.Count == 0; i++) g.Step(new Command[0]);+ Assert.Single(g.State.Objectives);++ var loaded = GameSession.Load(c, g.Save.Write(), out _).State;+ Assert.Equal(g.State.Hash(), loaded.Hash());+ Assert.Equal(g.State.Objectives, loaded.Objectives);+ Assert.Equal(g.State.Score, loaded.Score);+ }++ // The real content: the first new yishuv is Mefalsim, and its reference date is the site's founding date (#378).+ [Fact]+ public void TheObjectiveIsTheFirstNewYishuvAtMefalsim()+ {+ var o = Assert.Single(Real.Objectives);+ Assert.Equal(("first_new_yishuv", "mefalsim", "first_new_yishuv"), (o.Id, o.CompletesWhen!.SiteBuilt, o.Card));+ Assert.Equal(Real.Sites.Single(x => x.Id == "mefalsim").Founded, o.ReferenceDate);+ Assert.Equal(new DateTime(1949, 6, 12), o.ReferenceDate);+ var card = Real.Events.Single(e => e.Id == o.Card);+ Assert.Equal(("first_new_yishuv", "soft"), (card.Objective, card.Anchor));+ Assert.True(Assert.Single(card.Options).Historical);+ Assert.Empty(card.Tags);+ }++ // R-OBJ-001 to R-OBJ-003 in the golden run: the reference player builds Mefalsim on 15 June 1949 (#566), the month of its+ // 12 June 1949 founding, so the first new yishuv is on time and scores 100, and its card fires and is answered.+ [Fact]+ public void TheGoldenRunCompletesTheFirstNewYishuvOnTheBuildDate()+ {+ var s = GoldenRun.Play(Real, GoldenRun.Until1950);+ var built = s.Sites["mefalsim"].BuiltOn!.Value;+ Assert.Equal(new DateTime(1949, 6, 15), built);+ Assert.Equal(built, s.Objectives["first_new_yishuv"]);+ Assert.Equal(100, s.Score);+ Assert.Equal("continue", s.ChosenOptions["first_new_yishuv"]);+ }++ // The legacy loop (a fixture since the cutover) loads the real objective and its card (they are content), and never+ // fires the card.+ [Fact]+ public void TheRealCardNeverFiresInTheLegacyLoop()+ {+ var root = RealContentTests.ContentRoot();+ var legacy = ContentLoader.Load(Fixture.Write(+ new Dictionary<string, string> { ["objectives.yaml"] = System.IO.File.ReadAllText(System.IO.Path.Combine(root, "objectives.yaml")) },+ new Dictionary<string, string> { ["first_new_yishuv.yaml"] = System.IO.File.ReadAllText(System.IO.Path.Combine(root, "events", "first_new_yishuv.yaml")) }));+ Assert.False(legacy.IsGdd);+ Assert.Single(legacy.Objectives);+ var s = Simulation.NewGame(legacy, GoldenRun.Seed, Mode.Historical);+ for (int i = 0; i < 40 && s.GameOver == null; i++)+ {+ s = Step(legacy, s).State;+ Assert.DoesNotContain("first_new_yishuv", s.FiredEvents);+ }+ Assert.Empty(s.Objectives);+ Assert.Equal(0, s.Score);+ }++ // R-OBJ-002: the point values are rules.yaml design values (DesignValuesTests), never in objectives.yaml.+ [Fact]+ public void NoPointValueIsInObjectivesYaml()+ {+ var objectives = System.IO.File.ReadAllText(System.IO.Path.Combine(RealContentTests.ContentRoot(), "objectives.yaml"));+ Assert.DoesNotMatch(@"(?m)^[^#\n]*\b\w*(points|bonus)\w*\s*:", objectives); // no such key outside a comment+ }++ [Fact]+ public void ContentWithoutObjectivesHasNone() => Assert.Empty(ContentLoader.Load(Fixture.Write()).Objectives);++ static string GddRules(string from, string to) => Fixture.Gdd()["rules.yaml"].Replace(from, to);++ static string TwoOptions => Card + " - id: refuse\n text: Refuse\n";++ static string Objective(string from, string to) => ObjectivesYaml.Replace(from, to);++ public static IEnumerable<object[]> BadContent() => new List<object[]>+ {+ new object[] { "objectives.yaml", Objective("id: first_goal", "id: First"), Card, "objectives.yaml", "objectives[First].id", "must be lowercase" },+ new object[] { "objectives.yaml", ObjectivesYaml + ObjectivesYaml.Replace("objectives:\n", ""), Card, "objectives.yaml", "objectives[first_goal].id", "duplicate id" },+ new object[] { "objectives.yaml", Objective("name: First goal, ", ""), Card, "objectives.yaml", "objectives[first_goal].name", "required" },+ new object[] { "objectives.yaml", Objective("completes_when: { site_built: site_a }, ", ""), Card, "objectives.yaml", "objectives[first_goal].completes_when", "required" },+ new object[] { "objectives.yaml", Objective("reference_date: 1949-06-12, ", ""), Card, "objectives.yaml", "objectives[first_goal].reference_date", "required" },+ new object[] { "objectives.yaml", Objective("card: first_card", "card: no_card"), Card, "objectives.yaml", "objectives[first_goal].card", "unknown event 'no_card'" },+ new object[] { "objectives.yaml", ObjectivesYaml, Card.Replace("objective: first_goal\n", ""), "events/first_card.yaml", "events[first_card].objective", "must be 'first_goal'" },+ new object[] { "objectives.yaml", ObjectivesYaml, TwoOptions, "events/first_card.yaml", "events[first_card].options", "exactly one option" },+ new object[] { "objectives.yaml", "objectives: []\n", Card, "events/first_card.yaml", "events[first_card].objective", "unknown objective 'first_goal'" },+ new object[] { "objectives.yaml", Objective("site_built: site_a", "site_built: nowhere"), Card, "objectives.yaml", "objectives[first_goal].completes_when.site_built", "unknown site 'nowhere'" },+ new object[] { "objectives.yaml", Objective("reference_date: 1949-06-12", "reference_date: 1949-06-08"), Card, "objectives.yaml", "objectives[first_goal].reference_date", "must be 1949-06-12, the founding date of site 'site_a'" },+ new object[] { "sites.yaml", Fixture.GddSites.Replace("kinds: [yishuv]", "kinds: []"), Card, "objectives.yaml", "objectives[first_goal].completes_when.site_built", "cannot be built as a yishuv" },+ new object[] { "rules.yaml", GddRules(" objective_points: 100\n", ""), Card, "rules.yaml", "mvp.objective_points", "required when eras.yaml systems.loop is gdd" },+ new object[] { "rules.yaml", GddRules("objective_bonus_per_month: 5", "objective_bonus_per_month: -5"), Card, "rules.yaml", "mvp.objective_bonus_per_month", "must be >= 0" },+ new object[] { "rules.yaml", GddRules("objective_bonus_cap: 60", "objective_bonus_cap: -1"), Card, "rules.yaml", "mvp.objective_bonus_cap", "must be >= 0" },+ };++ // R-OBJ-001: an objective names a site whose founding date is its reference date; R-OBJ-003: an objective and its card+ // name each other; R-OBJ-002: the point values are required in the GDD loop.+ [Theory]+ [MemberData(nameof(BadContent))]+ public void BadObjectiveContentFailsNamingTheFileAndField(string file, string text, string card, string errorFile, string field, string message)+ {+ var ex = Assert.Throws<ContentException>(() => Load(gdd: true, new Dictionary<string, string> { [file] = text }, card));+ Assert.Equal(errorFile, ex.File);+ Assert.Equal(field, ex.Field);+ Assert.Contains(message, ex.Message);+ }+}diff --git a/sim/Statecraft.Sim.Tests/golden/hash1950.txt b/sim/Statecraft.Sim.Tests/golden/hash1950.txtindex 4ad2c2d6f..5b44796ab 100644--- a/sim/Statecraft.Sim.Tests/golden/hash1950.txt+++ b/sim/Statecraft.Sim.Tests/golden/hash1950.txt@@ -56,6 +56,7 @@ fired[austerity_1949bernadotte_assassinationelections_1949+ first_new_yishuvfirst_trucefrumkin_commissionidf_founding@@ -80,6 +81,7 @@ chosen{austerity_1949=imposebernadotte_assassination=outlawelections_1949=hold+ first_new_yishuv=continuefirst_truce=acceptidf_founding=one_armyjerusalem_ceasefire=keep@@ -104,4 +106,7 @@ units[1:halutz@-3,19site{mefalsim=done,1949-06-15-next=2\ No newline at end of file+next=2+obj{+ first_new_yishuv=1949-06-15+score=100\ No newline at end of filediff --git a/sim/Statecraft.Sim.Tests/golden/hash1952.txt b/sim/Statecraft.Sim.Tests/golden/hash1952.txtindex 0e9b0166f..5b732f5db 100644--- a/sim/Statecraft.Sim.Tests/golden/hash1952.txt+++ b/sim/Statecraft.Sim.Tests/golden/hash1952.txt@@ -59,6 +59,7 @@ fired[clothing_rationing_1950education_registration_1951elections_1949+ first_new_yishuvfirst_truceforex_crisis_1951frumkin_commission@@ -92,6 +93,7 @@ chosen{clothing_rationing_1950=extendeducation_registration_1951=press_planelections_1949=hold+ first_new_yishuv=continuefirst_truce=acceptforex_crisis_1951=request_aidfrumkin_commission=inquiry@@ -125,4 +127,7 @@ units[1:halutz@-3,19site{mefalsim=done,1949-06-15-next=2\ No newline at end of file+next=2+obj{+ first_new_yishuv=1949-06-15+score=100\ No newline at end of filediff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txtindex d41a7a45d..b4a495f67 100644--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt@@ -2,10 +2,10 @@# Tests read this file. To accept a deliberate change: STATECRAFT_UPDATE_GOLDEN=1 dotnet test sim/Statecraft.sln# rewrites this file, the snapshots and the GoldenRun.cs constants; then update docs/determinism.md and tools/web_check.py# (GoldenManifestTests names any place that is out of date) and add a row to the rebaseline history.-hash1950 f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2-hash1952 75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31+hash1950 ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504+hash1952 0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2smoke5 85191d48688be4595726b17778ecdda0175eff8f6f0fa1d976dbe3b48b42823bscenario-reckless e2f409a5382ea0ba01526123457a76ef3450ee242d1f7b7868b7a483abe149fascenario-cautious 58eb01db2e149f629bc298e9139441c5e9252d830f22908c7c888db55d167de0scenario-mvp-absorb-first f8858f6ec1c263c1e7bae1542439c9d7358bc4caa39bc45276c4c3b93d0c0bb1-mvp-end 75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31+mvp-end 0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2diff --git a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt b/sim/Statecraft.Sim.Tests/golden/mvp-end.txtindex 0e9b0166f..5b732f5db 100644--- a/sim/Statecraft.Sim.Tests/golden/mvp-end.txt+++ b/sim/Statecraft.Sim.Tests/golden/mvp-end.txt@@ -59,6 +59,7 @@ fired[clothing_rationing_1950education_registration_1951elections_1949+ first_new_yishuvfirst_truceforex_crisis_1951frumkin_commission@@ -92,6 +93,7 @@ chosen{clothing_rationing_1950=extendeducation_registration_1951=press_planelections_1949=hold+ first_new_yishuv=continuefirst_truce=acceptforex_crisis_1951=request_aidfrumkin_commission=inquiry@@ -125,4 +127,7 @@ units[1:halutz@-3,19site{mefalsim=done,1949-06-15-next=2\ No newline at end of file+next=2+obj{+ first_new_yishuv=1949-06-15+score=100\ No newline at end of filediff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex f819e6264..7f01bb651 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -473,6 +473,12 @@ namespace Statecraft.Simpublic int BuildYishuvTurns { get; set; }/// <summary>IL millions a "build yishuv" costs, paid in full when it starts (R-SITE-001).</summary>public double BuildYishuvCost { get; set; }+ /// <summary>Points for each completed objective (R-OBJ-002; D-B6, #456).</summary>+ public int? ObjectivePoints { get; set; }+ /// <summary>Bonus points for each calendar month an objective is completed before its reference date's month (R-OBJ-002; D-B2, #456).</summary>+ public int? ObjectiveBonusPerMonth { get; set; }+ /// <summary>The most bonus points one objective can earn (R-OBJ-002; D-B2, #456).</summary>+ public int? ObjectiveBonusCap { get; set; }}/// <summary>A designated site (sites.yaml; docs/GDD.md "Pioneer work": building is allowed only at designated spots, and a@@ -670,10 +676,36 @@ namespace Statecraft.Sim/// <summary>True when the file has the key at all, even blank.</summary>[YamlIgnore] public bool ReviewedOnGiven { get; private set; }string? reviewedOn;+ /// <summary>The objective (objectives.yaml) whose completion card this event is: it fires only once that objective is+ /// recorded (R-OBJ-003). Empty for every other event.</summary>+ public string Objective { get; set; } = "";/// <summary>Path relative to the content root, set by the loader (not read from YAML).</summary>[YamlIgnore] public string File { get; set; } = "";}+ /// <summary>An objective (objectives.yaml; docs/GDD.md "Historical events on objective completion"). Completing it records+ /// it, adds its points to the score and fires its card (R-OBJ-001 to R-OBJ-003). Its reference date is the sourced date of+ /// the real event the card shows.</summary>+ public sealed class Objective+ {+ public string Id { get; set; } = "";+ /// <summary>The name the player reads (in the Why list).</summary>+ public string Name { get; set; } = "";+ /// <summary>What completes it, checked at the end of every GDD turn (R-OBJ-001).</summary>+ public ObjectiveCondition? CompletesWhen { get; set; }+ /// <summary>The date the real event happened: completing earlier earns the timing bonus (R-OBJ-002).</summary>+ public DateTime ReferenceDate { get; set; }+ /// <summary>The id of the card event (content/events/), which names this objective back in its `objective` key.</summary>+ public string Card { get; set; } = "";+ }++ /// <summary>What completes an objective (objectives.yaml completes_when). Phase 1 has one kind.</summary>+ public sealed class ObjectiveCondition+ {+ /// <summary>A designated site (sites.yaml) of kind yishuv: complete once it is built (R-SITE-003).</summary>+ public string SiteBuilt { get; set; } = "";+ }+/// <summary>One hex of content/map/hexes.json (written by tools/hexgrid.py; axial q, r, pointy-top).</summary>public sealed class MapHex{@@ -800,6 +832,9 @@ namespace Statecraft.Simpublic List<UnitType> UnitTypes = new List<UnitType>();/// <summary>The GDD designated sites (sites.yaml), in file order. Empty in the legacy loop.</summary>public List<Site> Sites = new List<Site>();+ /// <summary>The objectives (objectives.yaml), ordered by id. Read in both loops, since their cards are events; only the+ /// GDD loop completes them. Empty when the content has no objectives.yaml.</summary>+ public List<Objective> Objectives = new List<Objective>();/// <summary>SHA-256 (lowercase hex) over every file the loader read, in read order, with CRLF read as LF. A save/// records it; loading a save made with other content shows a warning (spec section 7).</summary>public string Hash = "";diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex ae9581958..a7f5450db 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -48,6 +48,7 @@ namespace Statecraft.Simsealed class CitiesFile { public List<CityStart> Cities { get; set; } = new List<CityStart>(); }sealed class UnitTypesFile { public List<UnitType> Types { get; set; } = new List<UnitType>(); }sealed class SitesFile { public List<Site> Sites { get; set; } = new List<Site>(); }+ sealed class ObjectivesFile { public List<Objective> Objectives { get; set; } = new List<Objective>(); }public const string HexesFile = "map/hexes.json";public const string SettlementHexesFileName = "map/settlement_hexes.yaml";@@ -165,6 +166,18 @@ namespace Statecraft.Simelse into[kv.Key] = kv.Value;}+ internal const string ObjectivesFileName = "objectives.yaml";++ /// <summary>Like <see cref="Read{T}"/>, but a missing file is null, not an error. The file is read once.</summary>+ static T? ReadOptional<T>(Func<string, string?> readFile, string relPath) where T : class+ {+ string? text;+ try { text = readFile(relPath); }+ catch (IOException e) { throw new ContentException(relPath, "(file)", e.Message); }+ catch (UnauthorizedAccessException e) { throw new ContentException(relPath, "(file)", e.Message); }+ return text == null ? null : Read<T>(_ => text, relPath);+ }+static T Read<T>(Func<string, string?> readFile, string relPath){string? text;@@ -321,12 +334,18 @@ namespace Statecraft.Sim// requirements cannot form a cycle (EventRules)// options: [{ id, text, historical, recommended, effects: [{ target, delta }], set_rung, set_policy }]// sources: [{ url, checked }], status+ // objective the objective (objectives.yaml) whose completion card this is: it fires only once+ // that objective is recorded, and has exactly one optionforeach (var rel in eventFiles.OrderBy(p => p, StringComparer.Ordinal)){var e = Read<GameEvent>(readFile, rel);e.File = rel;c.Events.Add(e);}+ // Objectives (GDD v0.1, Phase 1 PR 6). Read in both loops, since their cards are events every loop loads; a content+ // set without objectives has no file.+ c.Objectives = ReadOptional<ObjectivesFile>(readFile, ObjectivesFileName)?.Objectives+ .OrderBy(o => o.Id, StringComparer.Ordinal).ToList() ?? new List<Objective>();Validate(c, settlementIds);if (c.IsGdd){@@ -393,7 +412,7 @@ namespace Statecraft.Simstatic readonly HashSet<string> Statuses = new HashSet<string> { "draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed" };/// <summary>A display name: required, and not blank.</summary>- static void Named(string file, string field, string name)+ internal static void Named(string file, string field, string name){if (string.IsNullOrWhiteSpace(name)) throw new ContentException(file, field, "required (the name shown to the player)");}@@ -1001,11 +1020,38 @@ namespace Statecraft.Simif (!(m.BuildYishuvCost >= 0 && IsFinite(m.BuildYishuvCost))) throw new ContentException(file, "mvp.build_yishuv_cost", "must be a finite number >= 0");// One game has one last day (R-LOOP-004): an era cannot move it.if (m.End != c.Rules.Mvp!.End) throw new ContentException(file, "mvp.end", "must be the same in every era (the game has one end)");+ // R-OBJ-002. Required, so a missing key is not read as 0. Zero is allowed (a balance choice); a negative value+ // would take points away for finishing.+ foreach (var (key, v) in new[] { ("objective_points", m.ObjectivePoints), ("objective_bonus_per_month", m.ObjectiveBonusPerMonth), ("objective_bonus_cap", m.ObjectiveBonusCap) })+ {+ if (v == null) throw new ContentException(file, "mvp." + key, "required when eras.yaml systems.loop is gdd");+ if (v < 0) throw new ContentException(file, "mvp." + key, "must be >= 0");+ }}// Strictly before the last era's end: an end on it is the era's own end, and the game would be over as era_ended.if (c.Rules.Mvp!.End is DateTime end && (end <= c.Rules.Start || end >= c.Eras[c.Eras.Count - 1].To))throw new ContentException("rules.yaml", "mvp.end", FormattableString.Invariant($"must be after start ({c.Rules.Start:yyyy-MM-dd}) and before the last era's end ({c.Eras[c.Eras.Count - 1].To:yyyy-MM-dd})"));ValidateSites(c);+ ValidateObjectiveSites(c);+ }++ /// <summary>An objective's site (R-OBJ-001): a designated site of kind yishuv, whose sourced founding date is the+ /// objective's reference date, so the card and the site cannot disagree. Only the GDD loop reads sites.yaml, so only+ /// it can check this; EventRules checks the rest of objectives.yaml in both loops.</summary>+ static void ValidateObjectiveSites(Content c)+ {+ foreach (var o in c.Objectives)+ {+ var at = $"objectives[{o.Id}]";+ var id = o.CompletesWhen!.SiteBuilt; // EventRules requires it+ var site = c.Sites.FirstOrDefault(x => x.Id == id)+ ?? throw new ContentException(ObjectivesFileName, at + ".completes_when.site_built", $"unknown site '{id}' (sites.yaml)");+ if (!site.Kinds.Contains(Projects.YishuvKind))+ throw new ContentException(ObjectivesFileName, at + ".completes_when.site_built", $"site '{id}' cannot be built as a yishuv");+ if (o.ReferenceDate != site.Founded)+ throw new ContentException(ObjectivesFileName, at + ".reference_date",+ FormattableString.Invariant($"must be {site.Founded:yyyy-MM-dd}, the founding date of site '{id}' in sites.yaml"));+ }}/// <summary>What a designated site may be built as (sites.yaml kinds). Phase 1 has "build yishuv" only.</summary>diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex 7317b7508..837defa23 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -92,6 +92,39 @@ namespace Statecraft.Sim}}CheckRequirementCycles(c);+ CheckObjectives(c);+ }++ /// <summary>Objectives and their cards name each other (R-OBJ-003): an event's `objective` names an objective whose+ /// `card` is that event, and an objective's card exists, names it back and has exactly one option (the card reports a+ /// result; there is nothing to choose).</summary>+ static void CheckObjectives(Content c)+ {+ const string file = ContentLoader.ObjectivesFileName;+ var seen = new HashSet<string>();+ foreach (var o in c.Objectives)+ {+ string F(string field) => $"objectives[{o.Id}].{field}";+ if (!Offices.OfficeId.IsMatch(o.Id)) throw new ContentException(file, F("id"), ContentLoader.IdRule);+ if (!seen.Add(o.Id)) throw new ContentException(file, F("id"), "duplicate id");+ ContentLoader.Named(file, F("name"), o.Name);+ if (o.CompletesWhen == null || o.CompletesWhen.SiteBuilt == "")+ throw new ContentException(file, F("completes_when"), "required: { site_built: <site id> }");+ if (o.ReferenceDate == default) throw new ContentException(file, F("reference_date"), "required (the sourced date of the real event)");+ var card = c.Events.FirstOrDefault(e => e.Id == o.Card)+ ?? throw new ContentException(file, F("card"), $"unknown event '{o.Card}'");+ if (card.Objective != o.Id)+ throw new ContentException(card.File, $"events[{card.Id}].objective", $"must be '{o.Id}': the event is that objective's card");+ if (card.Options.Count != 1)+ throw new ContentException(card.File, $"events[{card.Id}].options", "an objective's card has exactly one option");+ }+ foreach (var e in c.Events.Where(e => e.Objective != ""))+ {+ var o = c.Objectives.FirstOrDefault(x => x.Id == e.Objective)+ ?? throw new ContentException(e.File, $"events[{e.Id}].objective", $"unknown objective '{e.Objective}'");+ if (o.Card != e.Id)+ throw new ContentException(e.File, $"events[{e.Id}].objective", $"objective '{o.Id}' has another card, '{o.Card}'");+ }}/// <summary>Re-review N4: a cycle of `requires` (A needs B, B needs A, ...) could never fire. Called after everydiff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex a9059bf84..53074dd45 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -24,6 +24,8 @@ namespace Statecraft.Simvar eligible = c.Events.Where(e => !s.FiredEvents.Contains(e.Id) && e.From <= s.Date && (e.To == null || start < e.To.Value)).Where(e => e.Requires == null || (s.ChosenOptions.TryGetValue(e.Requires.Event, out var picked) && picked == e.Requires.Option))+ // R-OBJ-003: an objective's card waits for the objective. Only the GDD loop records one, so in the legacy loop it never fires.+ .Where(e => e.Objective == "" || s.Objectives.ContainsKey(e.Objective))// A late fire can come after a dated indicator's window has ended (chapters design 3.2): a condition on it is not met..Where(e => e.Conditions.All(k => s.Indicators.TryGetValue(k.Indicator, out var v)&& (!k.Min.HasValue || v >= k.Min.Value) && (!k.Max.HasValue || v <= k.Max.Value)))@@ -80,7 +82,8 @@ namespace Statecraft.Sim/// <summary>Unanswered events go to the responsible minister: with probability competence/10 they pick the/// recommended option (else the first), otherwise a random option. In Historical mode a hard-anchor event- /// resolves to its historical option without drawing from the RNG (major anchors happen).</summary>+ /// resolves to its historical option without drawing from the RNG (major anchors happen). An objective's card has one+ /// option and resolves to it without a draw (R-OBJ-003: GDD Phase 1 adds no RNG draw).</summary>public static void Delegate(Content c, GameState s, List<Cause> why){var rng = new Rng(s.RngState);@@ -88,6 +91,11 @@ namespace Statecraft.Sim{var e = Get(c, id);var minister = e.Office == "" ? null : Cabinet.Holder(c, s, e.Office);+ if (e.Objective != "")+ {+ Resolve(c, s, id, e.Options[0], $"delegated to {minister?.Name ?? "the cabinet"}", why);+ continue;+ }var competence = (minister?.Competence ?? 5) / 10.0;var anchored = s.Mode == Mode.Historical && e.Anchor == "hard" ? e.Options.FirstOrDefault(o => o.Historical) : null;var option = anchored ?? (rng.NextDouble() < competencediff --git a/sim/Statecraft.Sim/GoldenRun.cs b/sim/Statecraft.Sim/GoldenRun.csindex 7d58088a6..9f40ae3c3 100644--- a/sim/Statecraft.Sim/GoldenRun.cs+++ b/sim/Statecraft.Sim/GoldenRun.cs@@ -15,13 +15,13 @@ namespace Statecraft.Sim/// <summary>Final hash of Play(content, Until1950). Changing it is a deliberate rules or content change: the value/// is pinned in sim/Statecraft.Sim.Tests/golden/manifest.txt, and STATECRAFT_UPDATE_GOLDEN=1 dotnet test rewrites/// both (docs/determinism.md). Say why in the commit message.</summary>- public const string Hash1950 = "f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2";+ public const string Hash1950 = "ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504";public static readonly DateTime Until1950 = new DateTime(1950, 1, 1);/// <summary>Final hash of Play(content, Until1952): the M3 content range (to 31 December 1951). The GDD game ends on/// 15 January 1952 (R-LOOP-004), the first turn on or after Until1952, so this is also the mvp-end run.</summary>- public const string Hash1952 = "75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31";+ public const string Hash1952 = "0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2";public static readonly DateTime Until1952 = new DateTime(1952, 1, 1);diff --git a/sim/Statecraft.Sim/Objectives.cs b/sim/Statecraft.Sim/Objectives.csnew file mode 100644index 000000000..d706c82f7--- /dev/null+++ b/sim/Statecraft.Sim/Objectives.cs@@ -0,0 +1,62 @@+using System;+using System.Collections.Generic;+using System.Globalization;+using System.Linq;++namespace Statecraft.Sim+{+ /// <summary>The GDD v0.1 objectives (docs/GDD.md "Objectives" and "Historical events on objective completion"): at the end of+ /// each GDD turn an objective whose condition holds is recorded once, with the turn's end date, and scores once (R-OBJ-001,+ /// R-OBJ-002); its card fires once it is recorded (R-OBJ-003, in EventSystem). The point values are the owner's (D-B6 and+ /// D-B2, #456) and are read from the rules' mvp: block. Integers only, so the score is the same on every runtime.</summary>+ public static class Objectives+ {+ /// <summary>Calendar months from the month of <paramref name="done"/> to the month of <paramref name="reference"/>:+ /// (y2 − y1) × 12 + (m2 − m1). Positive when the objective was completed early, 0 in the same month ("on time, as in+ /// history"), negative when late (owner's card wording, #379, 14 October 2026). Public so the card can show it (spec+ /// 2026-10-12 §2.6).</summary>+ public static int MonthsFromHistory(DateTime done, DateTime reference) =>+ (reference.Year - done.Year) * 12 + (reference.Month - done.Month);++ /// <summary>The months early the bonus counts: <see cref="MonthsFromHistory"/>, or 0 when on time or late.</summary>+ public static int MonthsEarly(DateTime done, DateTime reference) => Math.Max(0, MonthsFromHistory(done, reference));++ /// <summary>The points an objective completed on <paramref name="done"/> earns (R-OBJ-002): objective_points plus+ /// objective_bonus_per_month for each month early, the bonus capped at objective_bonus_cap. Late costs nothing.</summary>+ public static int Points(MvpRules r, DateTime done, DateTime reference)+ {+ // The loader requires the three keys in the GDD loop. In long, so a large gap cannot overflow before the cap.+ var bonus = Math.Min((long)r.ObjectiveBonusCap!.Value, (long)r.ObjectiveBonusPerMonth!.Value * MonthsEarly(done, reference));+ return r.ObjectivePoints!.Value + (int)bonus;+ }++ /// <summary>Step 11 of the GDD turn (spec 2026-10-12 §2.3, D-A6): records, in id order, every objective whose condition+ /// holds, completed on <paramref name="next"/>, the turn's end date (R-OBJ-001). <paramref name="r"/> is the rules of+ /// the date the turn starts from (docs/determinism.md, "Rules per era").</summary>+ public static void Complete(Content c, GameState s, MvpRules r, DateTime next, List<Cause> why)+ {+ foreach (var o in c.Objectives) // ordered by id (the loader)+ if (Holds(s, o)) Record(c, s, r, o.Id, next, why);+ }++ /// <summary>Whether the objective's condition holds: its site is built (R-SITE-003).</summary>+ static bool Holds(GameState s, Objective o) =>+ s.Sites.TryGetValue(o.CompletesWhen!.SiteBuilt, out var w) && w.BuiltOn != null;++ /// <summary>Records objective <paramref name="id"/> as completed on <paramref name="date"/> and adds its points to the+ /// score (R-OBJ-001, R-OBJ-002). Returns false, and changes nothing, when it is already recorded or the loop is not+ /// gdd. <paramref name="r"/> is the rules of the date the turn starts from, not of <paramref name="date"/>, so a turn+ /// that crosses an era boundary scores with the era it started in.</summary>+ public static bool Record(Content c, GameState s, MvpRules r, string id, DateTime date, List<Cause> why)+ {+ if (!c.IsGdd || s.Objectives.ContainsKey(id)) return false;+ var o = c.Objectives.FirstOrDefault(x => x.Id == id) ?? throw new ArgumentException($"unknown objective '{id}'", nameof(id));+ var points = Points(r, date, o.ReferenceDate);+ s.Objectives[id] = date;+ s.Score += points;+ // In the Why list's "events" group: the card that follows is an event (Unity's WhyPresenter groups by system).+ why.Add(new Cause("events", id, points, string.Format(CultureInfo.InvariantCulture, "{0}: completed, {1} points", o.Name, points)));+ return true;+ }+ }+}diff --git a/sim/Statecraft.Sim/TurnResolver.cs b/sim/Statecraft.Sim/TurnResolver.csindex 0a6b96c62..79d1fec10 100644--- a/sim/Statecraft.Sim/TurnResolver.cs+++ b/sim/Statecraft.Sim/TurnResolver.cs@@ -22,7 +22,8 @@ namespace Statecraft.SimCities.House(c, s, why); // 8. housing, then Social cohesionCities.UpdateCohesion(s, r);Cities.Arrive(c, s, r, next, why); // 9. arrivals- // 10. Occupation timers: Phase 6. 11. Objectives and score: PR 6.+ // 10. Occupation timers: Phase 6.+ Objectives.Complete(c, s, r, next, why); // 11. objectives and score}}}diff --git a/tools/tests/test_release_build.py b/tools/tests/test_release_build.pyindex 5b924d211..76cd0cbb9 100644--- a/tools/tests/test_release_build.py+++ b/tools/tests/test_release_build.py@@ -8,8 +8,8 @@ import pytestimport release_build as rb-H1950 = "f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2"-H1952 = "75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31"+H1950 = "ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504"+H1952 = "0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2"SHA = "1b7a36cb" + "0" * 32LICENCE_TEXTS = ("CC-BY-4.0.txt", "CC-BY-SA-4.0.txt", "CC0-1.0.txt", "YamlDotNet-MIT.txt")NOTICES = ["LICENSE", "LICENSES/CC-BY-4.0.txt", "LICENSES/CC-BY-SA-4.0.txt", "LICENSES/CC0-1.0.txt",diff --git a/tools/web_check.py b/tools/web_check.pyindex faef226d0..e04990d35 100644--- a/tools/web_check.py+++ b/tools/web_check.py@@ -8,7 +8,7 @@ fail on a failure line or a timeout. Uses Chrome for Testing from the Playwright--enable-logging=stderr --v=1 as INFO:CONSOLE... "text", source: ...Usage (from the repo root):- uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 f97e9f81d1feaee78c55847e1fc42f8e60bd9f12c84d234f0d10002f9dae48f2" --expect "GOLDEN OK 1952 75d382995d0f12f0eed772dd851906831990b0ab830c10f3a0af310da0547f31"+ uv run tools/web_check.py unity/Builds/Web-disabled --query "golden" --expect "GOLDEN OK 1950 ad8067765007988a2ea52226a50622259b695cd72a5b735b298207e472b81504" --expect "GOLDEN OK 1952 0f54dc51a42575774b12a4b712d6d6ad69a45573232bd5b54b8527b24f4281f2"Options: --query Q (page URL query, without '?'), --expect TEXT (repeatable), --fail REGEX (default: GOLDEN FAIL|SMOKE FAIL|BOOT FAIL),--timeout SECONDS (default 300), --stall SECONDS (fail when no console message arrives for that long; 0 = off),--swiftshader (software WebGL when there is no GPU), --dpr N (default 1), --shots DIR (reassemble the player'sdiff --git a/unity/Assets/Tests/EditMode/EventImageMappingTests.cs b/unity/Assets/Tests/EditMode/EventImageMappingTests.csindex 584afc537..c4e048c3e 100644--- a/unity/Assets/Tests/EditMode/EventImageMappingTests.cs+++ b/unity/Assets/Tests/EditMode/EventImageMappingTests.cs@@ -20,7 +20,8 @@ public class EventImageMappingTestsstatic IReadOnlyList<EventImageMapping.Row> Rows => EventImageMapping.Parse(File.ReadAllText(EventImageMapping.Path));/// <summary>No free photograph was found for these (docs/event-images.md): they keep the minister's portrait plate.</summary>- static readonly string[] Fallback = { "armistice_lebanon", "armistice_syria", "education_registration_1951", "forex_crisis_1951", "reparations_claim", "sinai_withdrawal", "rhodes_talks" };+ static readonly string[] Fallback = { "armistice_lebanon", "armistice_syria", "education_registration_1951", "forex_crisis_1951", "reparations_claim", "sinai_withdrawal", "rhodes_talks",+ "first_new_yishuv" }; // GDD Phase 1 PR 6: its photograph (Boris Carmi, June 1949, CC BY 4.0) arrives with PR 7 (#380)static readonly string[] SensitivePhotos ={ "altalena", "bernadotte_assassination", "operation_hiram", "operation_horev", "operation_yoav", "ten_days" };@@ -30,7 +31,7 @@ public class EventImageMappingTestsvar rows = Rows;Assert.AreEqual(24, rows.Count);CollectionAssert.IsEmpty(EventImageMapping.Problems(rows, C));- CollectionAssert.AreEquivalent(C.Events.Select(e => e.Id).Except(Fallback), rows.Select(r => r.Event), "every event but the seven fallbacks has a picture");+ CollectionAssert.AreEquivalent(C.Events.Select(e => e.Id).Except(Fallback), rows.Select(r => r.Event), "every event but the fallbacks has a picture");CollectionAssert.AreEquivalent(SensitivePhotos, rows.Where(r => r.Sensitive).Select(r => r.Event), "the owner's sensitive list");CollectionAssert.AreEquivalent(SensitivePhotos, rows.Where(r => r.SensitivityReviewed).Select(r => r.Event), "the owner's sign-off of 2026-10-11, and nothing else");}