A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
Sim: the score's parts and the objective card order (Refs #809, slice 1) (#1325)
Berie3b4243bb2fa
diff --git a/changelog.d/809.md b/changelog.d/809.mdnew file mode 100644index 000000000..a086c8d5b--- /dev/null+++ b/changelog.d/809.md@@ -0,0 +1,5 @@+- The score's parts (R-SCORE-001; refs #809, slice 1): the sim keeps what the score is made of as it scores, objective+ points, timing bonuses and points for prisoners returned, and `ScoreParts.For` reads them; they always add up to the+ score. Two objectives completed on one turn record and fire their cards in `objectives.yaml`'s order (R-OBJ-007,+ Q-CARD-2), not by id, and the objective lists follow that order too. The `scenario-mvp-absorb-first` golden moves+ (a new `scoreparts=` line); no other golden moves.diff --git a/docs/determinism.md b/docs/determinism.mdindex 5b6a9b18c..e3f0c51ee 100644--- a/docs/determinism.md+++ b/docs/determinism.md@@ -404,3 +404,4 @@ The hash reads the state keys, so it never sees a record outside its window. An| GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-cautious | `95982cf8` | same as reckless (was `d6e7cea0`) || GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-mvp-absorb-first | `d6d47fd8` | same; debt alone rises by IL 8.2m (was `912504be`) || GDD Phase 5 PR 3: recruit formations and their upkeep (#742, #1130) | scenario-mvp-defeat | `584a828a` | same; debt alone rises by IL 17.8m; the defeat is unchanged (was `109b0a5e`) |+| GDD Phase 7 PR 6, slice 1: the score's parts (R-SCORE-001, #809) | scenario-mvp-absorb-first | `6aa49f62` | the state keeps the score's parts as they score, a new `scoreparts=` line (objective points, timing bonuses, prisoner points): `scoreparts=100,0,0` beside `score=100`. Nothing else moves; the other goldens score nothing, so they keep their hashes (was `d6d47fd8`) |diff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 5abab994c..544a78a9a 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -270,7 +270,7 @@ R-POW-005: A surrendered unit of the player's is added to `GameState.SoldiersHel## Objectives-R-OBJ-001: An objective (`objectives.yaml`) names its condition, `completes_when: { site_built: <site> }` (R-OBJ-004's `absorbed` has no site, so the site rules here apply only to `site_built`), 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-001: An objective (`objectives.yaml`) names its condition, `completes_when: { site_built: <site> }` (R-OBJ-004's `absorbed` has no site, so the site rules here apply only to `site_built`), 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 `objectives.yaml`'s order (R-OBJ-007), 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 a standalone 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). R-OBJ-006 says when a multipart objective receives the same base. 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.@@ -282,6 +282,10 @@ R-OBJ-005: An objective part (`part_of`) may name `completes_when: { corridor_coR-OBJ-006: Parts with the same `part_of` are one objective for `objective_points`: its base points are added exactly once, when the last part records. Earlier parts add only their R-OBJ-005 timing bonus. Rechecking any recorded part changes neither the records nor the score (Q-OBJ-1, owner, 17 October 2026, #782).+R-OBJ-007: Objectives keep `objectives.yaml`'s order: step 11 records them in it, and when two or more objectives' cards fire on the same turn they fire in it (Q-CARD-2, owner, 17 October 2026, #784). Among the events eligible that turn, an objective's card sorts with the others by `from` as R-EVT-001 orders them, after the other events of the same `from` (our tiebreak, not part of Q-CARD-2).++R-SCORE-001: The score is the sum of the parts Q-SCORE-1 names (owner, 17 October 2026, #784), and nothing else: objective base points (R-OBJ-002, R-OBJ-006), their timing bonuses (R-OBJ-002, R-OBJ-005) and points for prisoners returned (R-POW-004). The state keeps each part as it scores, so a later reading never rebuilds one from rules that may have changed since (a turn scores with the rules of the date it starts from); `ScoreParts.For` reads them, and they always sum to `GameState.Score`.+## MoneyR-MONEY-001: The GDD's Money is the Treasury (`model.yaml` money `treasury`, in IL millions): the player sees it as Money, כסף in Hebrew, on the top bar, the Budget screen and in the causes (spec §1.2, "Treasury becomes Money"; owner, 15 October 2026, Q-MONEY-4 and Q-HUD-3). Debt and foreign currency stay in the sim and the state hash, internal under Money, so the sourced 1951 currency crisis still happens (D-C3, Q-MONEY-1). The MVP keeps both abstractions approved on #884: the per-head tax represents ordinary revenue, while jobs pay the player-sensitive income in R-CITY-002. The rates remain `tax_per_capita_per_year` 0.0000545 IL million per person-year, `income_per_job_per_year` 0.06 IL million per employed 1,000-person unit-year, and `spending_per_capita_per_year` 0.0001036 IL million per person-year, all labelled design values in `rules.yaml` (owner, 18 October 2026, option 3 and the per-head-tax draft).diff --git a/sim/Statecraft.Sim.Tests/GddStateTests.cs b/sim/Statecraft.Sim.Tests/GddStateTests.csindex 168a7e29f..083358176 100644--- a/sim/Statecraft.Sim.Tests/GddStateTests.cs+++ b/sim/Statecraft.Sim.Tests/GddStateTests.cs@@ -43,6 +43,7 @@ public class GddStateTests("next=", x => x.NextId = 2),("obj{", x => x.Objectives["first_new_yishuv"] = new DateTime(1949, 3, 15)),("score=", x => x.Score = 5),+ ("scoreparts=", x => x.ScoreTimingBonuses = 5),};foreach (var (label, set) in steps){diff --git a/sim/Statecraft.Sim.Tests/ObjectiveCardsTests.cs b/sim/Statecraft.Sim.Tests/ObjectiveCardsTests.csnew file mode 100644index 000000000..74789cc39--- /dev/null+++ b/sim/Statecraft.Sim.Tests/ObjectiveCardsTests.cs@@ -0,0 +1,70 @@+using System;+using System.Collections.Generic;+using System.IO;+using System.Linq;+using Statecraft.Sim;++/// <summary>GDD Phase 7 PR 6 (#809), slice 1: the final score is the sum of the parts Q-SCORE-1 names (R-SCORE-001), and two+/// objective cards on one turn fire in objectives.yaml's order (Q-CARD-2, R-OBJ-007). The war objective's card waits for #752.</summary>+public class ObjectiveCardsTests+{+ static readonly Content Real = ContentLoader.Load(RealContentTests.ContentRoot());++ static void AssertSums(GameState s)+ {+ var p = ScoreParts.For(s);+ Assert.Equal(s.Score, p.ObjectivePoints + p.TimingBonuses + p.PrisonerPoints);+ }++ // R-SCORE-001: over the mvp-end run (which completes no objective) and over the one scenario that completes one, Score is+ // exactly its parts. A month early adds its bonus to the bonus part, not to the objective's base.+ [Fact]+ public void TheScoreIsItsParts()+ {+ AssertSums(GoldenRun.PlayToEnd(Real));++ var absorb = Scenario.Parse(File.ReadAllText(Path.Combine(ScenarioTests.Dir(), "mvp-absorb-first.yaml"))).Play(Real);+ Assert.True(absorb.Score > 0, "precondition: the scenario completes an objective");+ AssertSums(absorb);+ Assert.Equal(absorb.Score, ScoreParts.For(absorb).ObjectivePoints);++ var s = Simulation.NewGame(Real, GoldenRun.Seed, Mode.Historical);+ var o = Real.Objectives.Single(x => x.Id == "absorb_immigrants");+ var r = Real.RulesAt(s.Date).Mvp!;+ Assert.True(Objectives.Record(Real, s, r, o.Id, o.ReferenceDate.AddMonths(-1), new List<Cause>()));+ var parts = ScoreParts.For(s);+ Assert.Equal((r.ObjectivePoints!.Value, r.ObjectiveBonusPerMonth!.Value, 0),+ (parts.ObjectivePoints, parts.TimingBonuses, parts.PrisonerPoints));+ AssertSums(s);+ }++ // R-SCORE-001 (D-B2, D-B6): completing every objective on its historical date scores objective_points once per objective+ // (the infrastructure parts are one objective, R-OBJ-006) and no timing bonus.+ [Fact]+ public void HistoricalDatesScoreNoBonus()+ {+ var s = Simulation.NewGame(Real, GoldenRun.Seed, Mode.Historical);+ var r = Real.RulesAt(s.Date).Mvp!;+ foreach (var o in Real.Objectives)+ Assert.True(Objectives.Record(Real, s, r, o.Id, o.ReferenceDate, new List<Cause>()));+ var objectives = Real.Objectives.Select(o => o.PartOf == "" ? o.Id : o.PartOf).Distinct().Count();+ var parts = ScoreParts.For(s);+ Assert.Equal(objectives * r.ObjectivePoints!.Value, parts.ObjectivePoints);+ Assert.Equal(0, parts.TimingBonuses);+ AssertSums(s);+ }++ // R-OBJ-007 (Q-CARD-2): two objectives completed on one turn fire their cards in objectives.yaml's order, which is neither+ // the objectives' id order nor the cards' id order here.+ [Fact]+ public void TwoCardsInOneTurnFireInOrder()+ {+ Assert.Equal(new[] { "railway", "burma_road", "yishuvim", "absorb_immigrants" }, Real.Objectives.Select(o => o.Id));+ var s = Simulation.NewGame(Real, GoldenRun.Seed, Mode.Historical);+ s.Objectives["absorb_immigrants"] = s.Date;+ s.Objectives["railway"] = s.Date;+ EventSystem.Trigger(Real, s, new List<Cause>());+ var cards = s.PendingEvents.Where(e => e == "railway_complete" || e == "absorb_immigrants").ToList();+ Assert.Equal(new[] { "railway_complete", "absorb_immigrants" }, cards);+ }+}diff --git a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs b/sim/Statecraft.Sim.Tests/ObjectivesTests.csindex a44fad648..72bb6fe35 100644--- a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs+++ b/sim/Statecraft.Sim.Tests/ObjectivesTests.cs@@ -302,7 +302,7 @@ eras:public void TheInfrastructureObjectiveHasItsThreeParts(){var parts = Real.Objectives.Where(x => x.PartOf == "establish_key_infrastructure").ToList();- Assert.Equal(new[] { "burma_road", "railway", "yishuvim" }, parts.Select(x => x.Id));+ Assert.Equal(new[] { "railway", "burma_road", "yishuvim" }, parts.Select(x => x.Id)); // objectives.yaml's order (R-OBJ-007)Assert.Equal("burma_road", parts.Single(x => x.Id == "burma_road").CompletesWhen!.CorridorComplete);Assert.Equal("tlv_haifa_rail", parts.Single(x => x.Id == "railway").CompletesWhen!.CorridorComplete);Assert.Equal(new[] { "mefalsim", "beit_kama", "reim", "gilat", "kiryat_shmona", "beit_shemesh" },diff --git a/sim/Statecraft.Sim.Tests/PrisonersTests.cs b/sim/Statecraft.Sim.Tests/PrisonersTests.csindex 5f0f7ae64..e5fe36aec 100644--- a/sim/Statecraft.Sim.Tests/PrisonersTests.cs+++ b/sim/Statecraft.Sim.Tests/PrisonersTests.cs@@ -210,6 +210,7 @@ options:Assert.Equal(0, r.State.Score);r = Simulation.Step(c, r.State, new Command[] { new ChooseEventOption("pow_egypt", "continue") }); // pow_jordan is delegatedAssert.Equal(5 * points, r.State.Score);+ Assert.Equal(5 * points, ScoreParts.For(r.State).PrisonerPoints); // R-SCORE-001Assert.Equal(new[] { ("ala", 4) }, r.State.PrisonersHeld.Select(kv => (kv.Key, kv.Value)));Assert.Equal(new[] { ("egypt", 3), ("iraq", 2) }, r.State.PrisonersReturned.Select(kv => (kv.Key, kv.Value)));Assert.Contains(r.Why, x => x.Message == "Prisoners exchanged: 30 prisoners returned to Egypt");diff --git a/sim/Statecraft.Sim.Tests/golden/manifest.txt b/sim/Statecraft.Sim.Tests/golden/manifest.txtindex 04924fd51..26b7c72e1 100644--- a/sim/Statecraft.Sim.Tests/golden/manifest.txt+++ b/sim/Statecraft.Sim.Tests/golden/manifest.txt@@ -8,6 +8,6 @@ smoke5 d449bf194d94e882d36b899079ce573094ea710327db7ac6e84939632c46bf85smoke-orders ee6bfee561120532416c1aff2cd7cd741256aaafb443d19b414031356b680ae6scenario-reckless 6650ed3e18610fc3f53e7b8b815c0a1057d43cde08b47c0f1c6fb61ddb577fc1scenario-cautious 95982cf8d54e4040f40ecdceee5a53dc8c8f63df8a892c2d57496f66243cf120-scenario-mvp-absorb-first d6d47fd8eaed15787d6a92214752c4d672095b317fc0b829b0002f2dee021ed5+scenario-mvp-absorb-first 6aa49f62b0c9bce24393a98d8aac1b4da9f7aed58dbee6bf3eae694c31097a76mvp-end 6b374f69a0ed276eeea69737e2a8b0e72d26feb930dab35e8f7c50113c4e9c0bscenario-mvp-defeat 584a828a24355f522b8717646a7173b4567d2c202c111c048461d435fd66ccb1diff --git a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txtindex 503854354..9a8bff51f 100644--- a/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt+++ b/sim/Statecraft.Sim.Tests/golden/scenario-mvp-absorb-first.txt@@ -390,5 +390,6 @@ next=273obj{absorb_immigrants=1950-01-15score=100+scoreparts=100,0,0food=3003,1001,0arms=12\ No newline at end of filediff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 6f2f53e2c..977056199 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -363,8 +363,8 @@ namespace Statecraft.Sim}// 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>();+ // In the file's order, not sorted: it is the order objectives record and their cards fire in (R-OBJ-007, Q-CARD-2).+ c.Objectives = ReadOptional<ObjectivesFile>(readFile, ObjectivesFileName)?.Objectives ?? new List<Objective>();Validate(c, settlementIds);ApplyMapOverrides(readFile, c, settlementIds); // after the map's own checks, before the GDD records that read itif (c.IsGdd)diff --git a/sim/Statecraft.Sim/EventSystem.cs b/sim/Statecraft.Sim/EventSystem.csindex 7812b2521..503fbb47d 100644--- a/sim/Statecraft.Sim/EventSystem.cs+++ b/sim/Statecraft.Sim/EventSystem.cs@@ -15,7 +15,7 @@ namespace Statecraft.Sim/// <summary>Fires every unfired event whose `requires` (if any) is met, whose window [From, To) overlaps the turn just played,/// [<paramref name="turnStart"/>, s.Date), or contains s.Date; <paramref name="turnStart"/> defaults to s.Date/// (game start). Every eligible hard anchor fires; MaxSoftEventsPerTurn caps only the non-hard events per turn,- /// which fill the slots that remain (max(0, cap - hard count)) in the usual order (consequence cards first, R-ALT-008, then From, then id). The fired+ /// which fill the slots that remain (max(0, cap - hard count)) in the usual order (consequence cards first, R-ALT-008, then From, objective cards last in objectives.yaml's order, R-OBJ-007, then id). The fired/// events keep the usual order./// Late fire: an event whose window overlapped the turn just played can fire after its window has ended; its/// conditions are evaluated at the end of the turn, and its text is filled at the last in-window day@@ -39,7 +39,9 @@ namespace Statecraft.Sim&& (!k.Min.HasValue || v >= k.Min.Value) && (!k.Max.HasValue || v <= k.Max.Value)))// R-ALT-008: a road the player took is not crowded out of its window. With no consequence card eligible the first// key is the same for every event, and (From, id) is a total order (ids are unique), so the order is as before.- .OrderBy(e => e.Kind == EventKinds.Consequence ? 0 : 1).ThenBy(e => e.From).ThenBy(e => e.Id, StringComparer.Ordinal)+ // R-OBJ-007 (Q-CARD-2): objective cards of the same From come after that From's other events, in objectives.yaml's order.+ .OrderBy(e => e.Kind == EventKinds.Consequence ? 0 : 1).ThenBy(e => e.From)+ .ThenBy(e => e.Objective == "" ? -1 : c.Objectives.FindIndex(o => o.Id == e.Objective)).ThenBy(e => e.Id, StringComparer.Ordinal).ToList();var hardCount = eligible.Count(e => e.Anchor == "hard");var chosen = new HashSet<string>(eligible.Where(e => e.Anchor == "hard")diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.csindex 343274b17..c8d5168ca 100644--- a/sim/Statecraft.Sim/GameState.cs+++ b/sim/Statecraft.Sim/GameState.cs@@ -83,9 +83,13 @@ namespace Statecraft.Simpublic SortedDictionary<string, DateTime> Objectives = new SortedDictionary<string, DateTime>(StringComparer.Ordinal);/// <summary>Settlement control by target id, ordinal (R-CTRL-002).</summary>public SortedDictionary<string, SettlementControl> Settlements = new SortedDictionary<string, SettlementControl>(StringComparer.Ordinal);- /// <summary>The player's score (GDD "Objectives": bonus points). An int assumes whole-number points; the point values and- /// the timing bonus are open decisions with the owner (D-B2, D-B6), so the type is revisited when they are set.</summary>+ /// <summary>The player's score (GDD "Objectives": bonus points). An int: the point values (D-B6) and the timing bonus (D-B2)+ /// the owner set on 14 October 2026 (#456) are whole numbers (R-OBJ-002).</summary>public int Score;+ /// <summary>The parts of <see cref="Score"/> (R-SCORE-001; Q-SCORE-1), each added when it scores, so no reading has to+ /// rebuild them from rules that may have changed since: objective base points (R-OBJ-002, R-OBJ-006), timing bonuses+ /// (R-OBJ-002, R-OBJ-005) and points for prisoners returned (R-POW-004). Their sum is <see cref="Score"/>.</summary>+ public int ScoreObjectivePoints, ScoreTimingBonuses, ScorePrisonerPoints;/// <summary>The national Food stock (R-FOOD-001; D-C2): units of Food, one population unit's food for a month. Never below 0.</summary>public int Food;/// <summary>The Food the nation needed in the last turn (R-FOOD-002): its population in units, set at the start and in step 7.</summary>@@ -228,6 +232,12 @@ namespace Statecraft.Simif (Settlements.Count > 0)Section("ctrl", '{', '}', Settlements.Select(kv => kv.Key + "=" + kv.Value.Canonical()));if (Score != 0) { Sep(); Nl(); sb.Append("score=").Append(Score.ToString(CultureInfo.InvariantCulture)); }+ if (ScoreObjectivePoints != 0 || ScoreTimingBonuses != 0 || ScorePrisonerPoints != 0)+ {+ Sep(); Nl();+ sb.Append("scoreparts=").Append(ScoreObjectivePoints.ToString(CultureInfo.InvariantCulture)).Append(',')+ .Append(ScoreTimingBonuses.ToString(CultureInfo.InvariantCulture)).Append(',').Append(ScorePrisonerPoints.ToString(CultureInfo.InvariantCulture));+ }if (Food != 0 || FoodNeed != 0 || FoodUnmet != 0){Sep(); Nl();diff --git a/sim/Statecraft.Sim/Objectives.cs b/sim/Statecraft.Sim/Objectives.csindex 34dc774f0..cde35c6c4 100644--- a/sim/Statecraft.Sim/Objectives.cs+++ b/sim/Statecraft.Sim/Objectives.cs@@ -30,19 +30,19 @@ namespace Statecraft.Simreturn r.ObjectivePoints!.Value + (int)bonus;}- /// <summary>The Objectives screen's reading (#1189): one row per objective, in id order (as the loader sorts them),+ /// <summary>The Objectives screen's reading (#1189): one row per objective, in objectives.yaml's order (the loader),/// done or not, with the player's completion date when it is done and the historical reference date. No score: the/// owner's ruling for the screen (20 October 2026). A pure reading: it writes nothing, so the hash stays put.</summary>public static IReadOnlyList<ObjectiveStatus> Status(Content c, GameState s) =>c.Objectives.Select(o => new ObjectiveStatus(o.Id, o.Name, s.Objectives.TryGetValue(o.Id, out var done) ? done : (DateTime?)null,o.ReferenceDate)).ToList();- /// <summary>Step 11 of the GDD turn (spec 2026-10-12 §2.3, D-A6): records, in id order, every objective whose condition+ /// <summary>Step 11 of the GDD turn (spec 2026-10-12 §2.3, D-A6): records, in objectives.yaml's 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)+ foreach (var o in c.Objectives) // in objectives.yaml's order (the loader; R-OBJ-007)if (Holds(c, s, o)) Record(c, s, r, o.Id, next, why);}@@ -91,6 +91,8 @@ namespace Statecraft.Simvar points = basePoints + bonus;s.Objectives[id] = date;s.Score += points;+ s.ScoreObjectivePoints += basePoints; // R-SCORE-001: the parts as scored, not rebuilt later+ s.ScoreTimingBonuses += bonus;// 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/Prisoners.cs b/sim/Statecraft.Sim/Prisoners.csindex 6e6671c7b..0cbd939a6 100644--- a/sim/Statecraft.Sim/Prisoners.cs+++ b/sim/Statecraft.Sim/Prisoners.cs@@ -92,6 +92,7 @@ namespace Statecraft.Simif (returned > 0){s.Score += returned * points;+ s.ScorePrisonerPoints += returned * points; // R-SCORE-001why.Add(new Cause("events", "prisoners", returned, FormattableString.Invariant($"Prisoners exchanged: {returned * ppu:N0} prisoners returned to {Name(front)}")));}if (home > 0)diff --git a/sim/Statecraft.Sim/ScoreParts.cs b/sim/Statecraft.Sim/ScoreParts.csnew file mode 100644index 000000000..1df811246--- /dev/null+++ b/sim/Statecraft.Sim/ScoreParts.cs@@ -0,0 +1,23 @@+namespace Statecraft.Sim+{+ /// <summary>The final score's parts (R-SCORE-001; Q-SCORE-1, owner, 17 October 2026, #784): objective base points, their+ /// timing bonuses and prisoner points, nothing else. A pure reading of the parts the state recorded as it scored, so they+ /// always sum to <see cref="GameState.Score"/>; the end report (#810) lists them.</summary>+ public sealed class ScoreParts+ {+ /// <summary>objective_points, once per objective (R-OBJ-002; a multipart objective's with its last part, R-OBJ-006).</summary>+ public int ObjectivePoints { get; }+ /// <summary>The months-early bonuses (R-OBJ-002, R-OBJ-005).</summary>+ public int TimingBonuses { get; }+ /// <summary>points_per_prisoner_unit_returned per unit returned (R-POW-004).</summary>+ public int PrisonerPoints { get; }++ ScoreParts(int objectivePoints, int timingBonuses, int prisonerPoints)+ {+ ObjectivePoints = objectivePoints; TimingBonuses = timingBonuses; PrisonerPoints = prisonerPoints;+ }++ public static ScoreParts For(GameState s) =>+ new ScoreParts(s.ScoreObjectivePoints, s.ScoreTimingBonuses, s.ScorePrisonerPoints);+ }+}diff --git a/unity/Assets/Tests/EditMode/EndScreenTests.cs b/unity/Assets/Tests/EditMode/EndScreenTests.csindex b4f82f88b..a902b9226 100644--- a/unity/Assets/Tests/EditMode/EndScreenTests.cs+++ b/unity/Assets/Tests/EditMode/EndScreenTests.cs@@ -84,7 +84,7 @@ public class EndScreenTests/// <summary>A game on its last day, ended as the MVP ends, with the first objective completed a month early.</summary>static void Ended(GameState s){- var first = C.Objectives[0];+ var first = C.Objectives.Single(o => o.Id == "absorb_immigrants"); // by id: the first in id order, as before R-OBJ-007Objectives.Record(C, s, C.RulesAt(s.Date).Mvp!, first.Id, first.ReferenceDate.AddMonths(-1), new List<Cause>());s.Date = C.End;s.GameOver = GameOverCodes.MvpEnded;@@ -118,11 +118,11 @@ public class EndScreenTestsAssert.AreEqual(En.Format("hud.score", s.Score), k.Line("score"));Assert.Greater(s.Score, 0);// The first objective: the card's title, the player's date and the historical date (Q-END-1).- var first = C.Objectives[0];+ var first = C.Objectives.Single(o => o.Id == "absorb_immigrants"); // by id: the first in id order, as before R-OBJ-007string Date(System.DateTime d) => En.Format("date.day_month_year", d.Day, En["date.month_" + d.Month], d.Year);var title = EventSystem.Title(C, s, C.Events.First(e => e.Id == first.Card));Assert.AreEqual(En.Format("end.objective_done", title, Date(first.ReferenceDate.AddMonths(-1)), Date(first.ReferenceDate)), k.Line("objective-" + first.Id));- foreach (var o in C.Objectives.Skip(1))+ foreach (var o in C.Objectives.Where(o => o.Id != first.Id))StringAssert.Contains(Date(o.ReferenceDate), k.Line("objective-" + o.Id), "an open objective still shows its historical date");Assert.AreEqual(En.Format("end.parameter", En["hud.caption.cohesion"], PlayerText.Percent(r.SocialCohesion)), k.Line("cohesion"));Assert.AreEqual(En.Format("end.parameter", En["hud.caption.standing"], PlayerText.Percent(r.InternationalSupport)), k.Line("standing"));diff --git a/unity/Assets/Tests/EditMode/ObjectivesScreenTests.cs b/unity/Assets/Tests/EditMode/ObjectivesScreenTests.csindex 1ba202db5..81447e5cc 100644--- a/unity/Assets/Tests/EditMode/ObjectivesScreenTests.cs+++ b/unity/Assets/Tests/EditMode/ObjectivesScreenTests.cs@@ -77,10 +77,10 @@ public class ObjectivesScreenTestsAssert.IsTrue(Objectives.Status(bridge.Content, bridge.State).All(o => !o.Done), "precondition: nothing done at the start");Check("at the start");- var first = C.Objectives[0];+ var first = C.Objectives.Single(x => x.Id == "absorb_immigrants"); // by id: the first in id order, as before R-OBJ-007Assert.IsTrue(Objectives.Record(C, bridge.State, C.RulesAt(bridge.State.Date).Mvp!, first.Id, first.ReferenceDate.AddMonths(-1), new List<Cause>()));presenter.Render();- Assert.IsTrue(Objectives.Status(bridge.Content, bridge.State)[0].Done, "precondition: the first is done");+ Assert.IsTrue(Objectives.Status(bridge.Content, bridge.State).Single(x => x.Id == first.Id).Done, "precondition: the first is done");Check("after the first is done");}