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 "absorb immigrants" objective condition, gated on 1,000,000 people (R-OBJ-004, refs #738) (#1019)
Beric953ab41d742
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex fd75c80b9..d4a1bab31 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -12,6 +12,10 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIBeach written into the state hash only when set, so a halutz hashes as before and no golden moves. `unit_types.yaml`gains Israel's `veteran_soldier` (infantry), `artillery` and `armoured_car` (armour) with a `side` and a `class`; theloader refuses a military type without both (R-UNIT-001, R-UNIT-002; refs #741, #385). Nothing uses them yet.+- Objectives can complete on absorbing the immigrants: `completes_when: { absorbed: ... }` holds once the Jewish+ population has reached a stated number and then the cities' overflow and employed shares are inside stated bounds+ (R-OBJ-004; owner's option (a) on #738). The real objective and its card come with a person's source check, so no+ content uses it yet and no golden moves (refs #738, #383).- Farm and village life from MATKOT's 1948 Collection: three tractors by kibbutz fields, three horse wagons and threedraught horses by moshav and moshava fields, three flocks of five sheep and three donkeys by villages, and three camelsby Bedouin camp areas, each anchor chosen by a fixed hash and kept clear of the kits, routes, unit tokens, water,diff --git a/docs/gdd/objective-card.md b/docs/gdd/objective-card.mdindex 2d09443df..9d546ef6c 100644--- a/docs/gdd/objective-card.md+++ b/docs/gdd/objective-card.md@@ -7,6 +7,7 @@ As a player of the MVP, I want completing an objective to show me the real event## 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).+- The "absorb immigrants" objective (D-B4) completes once the Jewish population has reached a stated number, and then the cities' overflow is at most a stated share of the people they house and their employed at least a stated share of their civilians (owner, 18 October 2026, option (a) [S8]; R-OBJ-004). The population gate keeps the start values from completing it on the first turn; refugees waiting do not count, since each turn's arrivals come after housing. Its numbers, reference date and card are content (`objectives.yaml` and its card), added with a person's source check [S8].- 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].@@ -17,7 +18,7 @@ As a player of the MVP, I want completing an objective to show me the real event## 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/objectives.yaml` (`id`, `name`, `completes_when.site_built` or `completes_when.absorbed` with `population_at_least`, `overflow_at_most`, `employed_at_least`, `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.@@ -41,6 +42,7 @@ As a player of the MVP, I want completing an objective to show me the real event- [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+- [S8] Owner decision on the absorb condition and card, <https://github.com/eyalgolan/statecraft-israel/issues/738>, checked 2026-10-18## Open questionsdiff --git a/docs/rules/mvp.md b/docs/rules/mvp.mdindex 38cd8d397..913b9d180 100644--- a/docs/rules/mvp.md+++ b/docs/rules/mvp.md@@ -128,12 +128,14 @@ R-UNIT-002: A unit's side, strength, order and order target are written into the## 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-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-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.+R-OBJ-004: An objective may instead name `completes_when: { absorbed: { population_at_least, overflow_at_most, employed_at_least } }` (D-B4; owner, 18 October 2026, #738, option (a)). It holds at step 11 once the Jewish population (`GameState.TotalPopulation`, the national count as step 11 reads it, before the turn's population step) is at or above `population_at_least`, and then the cities' overflow (R-HOUSE-002), summed, is at most `overflow_at_most` of their housed people (R-HOUSE-003), summed, and their employed civilians, summed, are at least `employed_at_least` of their civilians (as R-CITY-005 counts them). Refugees waiting do not count: each turn's arrivals (step 9) wait at step 11, after housing (step 8). The gate keeps the census start values (41% employed, no overflow) from completing it on the first turn. Sums are integers, compared with the decimal share, so city order cannot change the result. An objective names exactly one kind; all three keys are required (a missing key is never read as 0), the shares are from 0 to 1 and the population above 0 (the loader). Recorded and scored as R-OBJ-001 and R-OBJ-002 say; its card follows R-OBJ-003.+## 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/ObjectivesTests.cs b/sim/Statecraft.Sim.Tests/ObjectivesTests.csindex 2343b1ee7..97b862a01 100644--- a/sim/Statecraft.Sim.Tests/ObjectivesTests.cs+++ b/sim/Statecraft.Sim.Tests/ObjectivesTests.cs@@ -308,6 +308,114 @@ eras:[Fact]public void ContentWithoutObjectivesHasNone() => Assert.Empty(ContentLoader.Load(Fixture.Write()).Objectives);+ // ---- R-OBJ-004, the "absorb immigrants" objective (D-B4; owner, 18 October 2026, #738: option (a)) ----++ /// <summary>The fixture's absorb objective: the fixture starts with 1000 people, so its gate is 1500.</summary>+ const string AbsorbYaml = "objectives:\n - { id: first_goal, name: First goal, completes_when: { absorbed: { population_at_least: 1500, overflow_at_most: 0.10, employed_at_least: 0.40 } }, reference_date: 1949-06-12, card: first_card }\n";++ static Content LoadAbsorb(string objectives = AbsorbYaml) => Load(gdd: true, new Dictionary<string, string> { ["objectives.yaml"] = objectives });++ /// <summary>The real content with the absorb objective as #738 decides it (Jewish population 1,000,000, overflow at most+ /// 10%, employed at least 40%), built in memory: its card is a person's to add (#738, card option (i)), and nothing here+ /// reads the card.</summary>+ static Content RealWithAbsorb()+ {+ var c = ContentLoader.Load(RealContentTests.ContentRoot());+ c.Objectives = c.Objectives.Append(new Objective+ {+ Id = "absorb_immigrants",+ Name = "Absorb the immigrants",+ CompletesWhen = new ObjectiveCondition { Absorbed = new AbsorbCondition { PopulationAtLeast = 1_000_000, OverflowAtMost = 0.10m, EmployedAtLeast = 0.40m } },+ ReferenceDate = D("1949-12-20"),+ Card = "absorb_immigrants",+ }).OrderBy(o => o.Id, StringComparer.Ordinal).ToList();+ return c;+ }++ // R-OBJ-004: town_a houses 10 units and its people are civilians only, so overflow = civilians - 10. Each row is just+ // inside or just outside one bound; the shares are "at or below" and "at or above".+ [Theory]+ [InlineData(1500, 11, 5, 0, true)] // overflow 1 <= 1.1, employed 5 >= 4.4+ [InlineData(1499, 11, 5, 0, false)] // below the population gate+ [InlineData(1500, 10, 4, 0, true)] // no overflow, employed 4 = 40% of 10: on the bound+ [InlineData(1500, 10, 3, 0, false)] // employed 30%+ [InlineData(1500, 12, 5, 0, false)] // overflow 2 > 1.2+ [InlineData(1500, 11, 5, 7, true)] // refugees waiting do not block it (the owner dropped that clause, #738)+ public void AbsorptionCompletesWhenTheShareIsHousedAndEmployed(int population, int civilians, int employed, int refugees, bool done)+ {+ var c = LoadAbsorb();+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ s.Population = new Dictionary<string, double> { ["veterans"] = population };+ s.Cities["town_a"] = new City("town_a", 10, 8, civilians, employed, refugees);+ Objectives.Complete(c, s, c.Rules.Mvp!, D("1949-04-15"), new List<Cause>());+ Assert.Equal(done, s.Objectives.ContainsKey("first_goal"));+ Assert.Equal(done ? 110 : 0, s.Score);+ }++ // R-OBJ-004: overflow exactly on the bound completes it. With capacity 10 no integer overflow equals 10% of the people+ // housed, so town_a here houses 9: 10 civilians, overflow 1 = 10% of 10 (review on #1019).+ [Fact]+ public void OverflowOnTheBoundCompletes()+ {+ var c = LoadAbsorb();+ var s = Simulation.NewGame(c, 1, Mode.Historical);+ s.Population = new Dictionary<string, double> { ["veterans"] = 1500 };+ s.Cities["town_a"] = new City("town_a", 9, 8, 10, 4, 0);+ Objectives.Complete(c, s, c.Rules.Mvp!, D("1949-04-15"), new List<Cause>());+ Assert.True(s.Objectives.ContainsKey("first_goal"));+ }++ // R-OBJ-004 (#738): Q-ABS-2 as first recorded (no refugees waiting, overflow <= 10%, employed >= 40%) already+ // holds at the end of the real game's first turn, with nobody absorbed: the census start values are 41% employed with no+ // overflow (#738, issuecomment-6242964308). The population gate keeps the objective open.+ [Fact]+ public void TheStartValuesDoNotCompleteItOnTheFirstTurn()+ {+ var c = RealWithAbsorb();+ var s = Step(c, Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical)).State;+ Assert.Equal(0, s.Cities.Values.Sum(x => x.Refugees));+ Assert.Equal(0, s.Cities.Values.Sum(x => Cities.Overflow(s, x)));+ Assert.True(Cities.EmployedShare(s) >= 0.40, "precondition: the old condition holds on turn 1");+ Assert.DoesNotContain("absorb_immigrants", s.Objectives.Keys);+ }++ // R-OBJ-004 (#738): arrivals with no housing or jobs built never complete it. The historical run with no orders+ // passes 1,000,000 people, but its cities are then far below 40% employed.+ [Fact]+ public void ArrivalAloneDoesNotComplete()+ {+ var c = RealWithAbsorb();+ var s = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);+ var passed = false;+ while (s.GameOver == null)+ {+ s = Step(c, s).State;+ passed |= s.TotalPopulation >= 1_000_000;+ Assert.DoesNotContain("absorb_immigrants", s.Objectives.Keys);+ }+ Assert.True(passed, "precondition: the run passes 1,000,000 people");+ }++ // R-OBJ-004 with R-OBJ-003: once the condition holds, the objective is recorded at the end of that turn and its card is+ // pending for the next; it neither records nor fires again.+ [Fact]+ public void TheAbsorbCardFiresOnceTheTurnAfter()+ {+ var c = LoadAbsorb(AbsorbYaml.Replace("population_at_least: 1500", "population_at_least: 1000")); // the start: 60% employed, no overflow+ var r = Step(c, Simulation.NewGame(c, 1, Mode.Historical));+ Assert.Equal(r.State.Date, Assert.Single(r.State.Objectives).Value);+ Assert.Contains("first_card", r.State.PendingEvents);+ var score = r.State.Score;+ var s = Step(c, r.State, new ChooseEventOption("first_card", "continue")).State;+ for (int i = 0; i < 3; i++)+ {+ s = Step(c, s).State;+ Assert.DoesNotContain("first_card", s.PendingEvents);+ }+ Assert.Single(s.Objectives);+ Assert.Equal(score, s.Score);+ }+static string GddRules(string from, string to) => Fixture.Gdd()["rules.yaml"].Replace(from, to);static string TwoOptions => Card + " - id: refuse\n text: Refuse\n";@@ -320,6 +428,11 @@ eras: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("site_built: site_a", "site_built: site_a, absorbed: { population_at_least: 1, overflow_at_most: 0.1, employed_at_least: 0.4 }"), Card, "objectives.yaml", "objectives[first_goal].completes_when", "exactly one of" },+ new object[] { "objectives.yaml", AbsorbYaml.Replace("population_at_least: 1500", "population_at_least: 0"), Card, "objectives.yaml", "objectives[first_goal].completes_when.absorbed.population_at_least", "above 0" },+ new object[] { "objectives.yaml", AbsorbYaml.Replace("overflow_at_most: 0.10, ", ""), Card, "objectives.yaml", "objectives[first_goal].completes_when.absorbed.overflow_at_most", "required" },+ new object[] { "objectives.yaml", AbsorbYaml.Replace("overflow_at_most: 0.10", "overflow_at_most: 1.5"), Card, "objectives.yaml", "objectives[first_goal].completes_when.absorbed.overflow_at_most", "share from 0 to 1" },+ new object[] { "objectives.yaml", AbsorbYaml.Replace("employed_at_least: 0.40", "employed_at_least: 0"), Card, "objectives.yaml", "objectives[first_goal].completes_when.absorbed.employed_at_least", "share above 0" },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'" },diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 0e895dacf..cf1280409 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -896,11 +896,28 @@ namespace Statecraft.Simpublic string Card { get; set; } = "";}- /// <summary>What completes an objective (objectives.yaml completes_when). Phase 1 has one kind.</summary>+ /// <summary>What completes an objective (objectives.yaml completes_when): exactly 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>The cities have absorbed the immigrants (R-OBJ-004, D-B4).</summary>+ public AbsorbCondition? Absorbed { get; set; }+ }++ /// <summary>R-OBJ-004 (D-B4; owner, 18 October 2026, #738, option (a)): once the Jewish population has reached+ /// <see cref="PopulationAtLeast"/>, the cities' overflow is at most <see cref="OverflowAtMost"/> of the people they house+ /// and their employed civilians at least <see cref="EmployedAtLeast"/> of their civilians. The population gate keeps the+ /// start values (already 41% employed, no overflow) from completing it on the first turn.</summary>+ public sealed class AbsorbCondition+ {+ /// <summary>GameState.TotalPopulation, the national Jewish count, at or above this.</summary>+ public long PopulationAtLeast { get; set; }+ /// <summary>Overflow (R-HOUSE-002) over the housed people (R-HOUSE-003), at or below this share. Required: 0 is a+ /// real value here, so a missing key must not read as 0.</summary>+ public decimal? OverflowAtMost { get; set; }+ /// <summary>Employed over civilians (as R-CITY-005 counts them), at or above this share.</summary>+ public decimal EmployedAtLeast { get; set; }}/// <summary>One hex of content/map/hexes.json (written by tools/hexgrid.py; axial q, r, pointy-top).</summary>diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex fb54b09ee..471ba11fe 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -1211,7 +1211,8 @@ namespace Statecraft.Simforeach (var o in c.Objectives){var at = $"objectives[{o.Id}]";- var id = o.CompletesWhen!.SiteBuilt; // EventRules requires it+ if (o.CompletesWhen!.Absorbed != null) continue; // R-OBJ-004 has no site; the GDD loop always has cities+ var id = o.CompletesWhen.SiteBuilt; // EventRules requires one kindvar 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))diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex 29154d38d..7c2fabb69 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -166,8 +166,15 @@ namespace Statecraft.Simif (!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.CompletesWhen == null || (o.CompletesWhen.SiteBuilt == "") == (o.CompletesWhen.Absorbed == null))+ throw new ContentException(file, F("completes_when"), "required, exactly one of: { site_built: <site id> }, { absorbed: { ... } }");+ if (o.CompletesWhen.Absorbed is AbsorbCondition a)+ {+ if (a.PopulationAtLeast <= 0) throw new ContentException(file, F("completes_when.absorbed.population_at_least"), "must be above 0");+ if (a.OverflowAtMost == null) throw new ContentException(file, F("completes_when.absorbed.overflow_at_most"), "required");+ if (!(a.OverflowAtMost >= 0 && a.OverflowAtMost <= 1)) throw new ContentException(file, F("completes_when.absorbed.overflow_at_most"), "must be a share from 0 to 1");+ if (!(a.EmployedAtLeast > 0 && a.EmployedAtLeast <= 1)) throw new ContentException(file, F("completes_when.absorbed.employed_at_least"), "must be a share above 0, at most 1");+ }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}'");diff --git a/sim/Statecraft.Sim/Objectives.cs b/sim/Statecraft.Sim/Objectives.csindex d706c82f7..14bb7921c 100644--- a/sim/Statecraft.Sim/Objectives.cs+++ b/sim/Statecraft.Sim/Objectives.cs@@ -39,9 +39,30 @@ namespace Statecraft.Simif (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>+ /// <summary>Whether the objective's condition holds: the immigrants are absorbed (R-OBJ-004), or 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;+ o.CompletesWhen!.Absorbed is AbsorbCondition a ? Absorbed(s, a)+ : s.Sites.TryGetValue(o.CompletesWhen.SiteBuilt, out var w) && w.BuiltOn != null;++ /// <summary>R-OBJ-004 (D-B4; owner, 18 October 2026, #738, option (a)): once the Jewish population (the national count,+ /// as it stands when step 11 runs, before the turn's population step) has reached the gate, the cities' overflow is at+ /// most its share of the people they house and their employed at least its share of their civilians. Refugees waiting+ /// do not count: the turn's arrivals (step 9) always wait at step 11, after housing (step 8). The city counts are+ /// integer sums times a decimal share, so city order and the runtime cannot change them.</summary>+ static bool Absorbed(GameState s, AbsorbCondition a)+ {+ if (s.TotalPopulation < a.PopulationAtLeast) return false;+ long housed = 0, over = 0, civilians = 0, employed = 0;+ foreach (var x in s.Cities.Values)+ {+ housed += Cities.Housed(s, x);+ over += Cities.Overflow(s, x);+ civilians += x.Civilians;+ employed += x.Employed;+ }+ return over <= a.OverflowAtMost!.Value * housed && employed >= a.EmployedAtLeast * civilians;+ }/// <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