Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Training centre fixture: a professionless free civilian takes a farmer or pioneer course (Fixes #2464) (#2718)

Beri79007f2c3384
diff --git a/changelog.d/2464.md b/changelog.d/2464.md
new file mode 100644
index 000000000..7688520b9
--- /dev/null
+++ b/changelog.d/2464.md
@@ -0,0 +1,5 @@
+### Added
+
+- GDD 0.3 training centre courses in the sim test fixture (Fixes #2464): a free civilian with no profession can start
+ a farmer or pioneer course with a matching veteran teacher, graduates in the teacher's profession at the trained
+ tier, and is still professionless after a cancelled course.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index 12762274a..f5c40660a 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -178,13 +178,13 @@ R-TRAIN-003: Each turn, in ascending id, every cohort has one turn less to go. A
R-TRAIN-004: `Reinforce(unit, city, n)` (#1510; owner, 23 October 2026: "Replacements cost Arms", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6372356139, and "Default (Recommended)") refills a damaged formation of the player's with trained replacements. The unit must be a military unit of the player's side standing on `city`'s settlement hex. Its course is the trained type of the unit's side and class (a type with a `facility`): the recruit's basic training for a recruit or a veteran soldier, the guns' and the armoured cars' own for artillery and armoured cars (R-UNIT-008); a type no course trains (any enemy type) takes none. The cohort then follows R-TRAIN-001: the city's facility, `n` of its civilians without a job, `n * training_cost` with borrowing (R-MONEY-003), and the Arms of R-ARMS-003 for that course; it carries the unit's id, written into the state hash (`|unit=<id>`) only when set. The cap is the strength the unit had before its first loss, `Unit.Full`: combat stores it on a player's unit at its first loss (R-COMBAT-003) and clears it when replacements bring the unit back to it, and it is written into the state hash (`|full=<n>`) only when set, so a unit that has lost nobody, and every enemy unit, hashes as before. The order is refused, the state and Attention unchanged, for an unknown unit ("There is no such unit"), a unit with no side or an enemy unit (R-ORDER-001's wording), an unknown city, a unit off the city's hex ("Unit N is not in <city>"), a type no course trains ("Unit N cannot take replacements"), a unit with nothing to refill ("Unit N has no losses to replace") and `n` past the cap less the unit's strength and the replacements already training for it ("Unit N can take K more groups"), then for R-TRAIN-001's and R-ARMS-003's reasons. A queued `Reinforce` takes its city's civilians as a queued `Train` does (R-CITY-001). In step 4, before a turn is counted, replacements whose unit has left the state (destroyed, captured, sent home) or stands off the city's hex are cancelled as R-TRAIN-002 cancels a cohort: people and Arms back, the Money spent, with a Why line. A cohort that finishes adds its count to the unit's strength and makes no unit and takes no id; the unit keeps its type, service, order and home (a veteran stays a veteran, R-UNIT-004). The people join the unit's home city's housing (R-HOUSE-003). `attention_cost.reinforce` is 1, Train's cost, a design value (owner, 24 October 2026: "1, like Train (Recommended)", https://github.com/eyalgolan/statecraft-israel/issues/1510#issuecomment-6375591436). The save line is `reinforce <unit> <city> <n>` and the scenario form `{ kind: reinforce, unit, city, count }`.
-R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex or facility but no city, so the centre's region stands in for its host city, an approximation until real places are bound (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee lives in the centre's host city too was our reading (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and is now the owner's ruling (owner, 4 November 2026, Q23: asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", the owner answered "yes", [recorded on #1697](https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820)). The fixture still uses the centre's region as the stand-in for its host city, so a trainee outside the region is refused with a plain reason that says so; the rule tightens to the host city once centres are bound to real cities (#1691). A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession. Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged. The centre course does not retire the Hakhshara: the owner kept it under `gdd-0.3` (4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)), and R-TRAIN-001's `halutz` track stays.
+R-TRAIN-005: In gdd-0.3 synthetic fixtures only (#1697; nothing in the game calls it), a farmer or pioneer course starts at an operating training centre, a facility in its host city with no reception camp, centre upgrade or reception bed (owner, 1 November 2026, "No reception-bed layer (Recommended)"; `docs/gdd/training.md:38`, "The MVP has no reception-bed layer"). A centre has one veteran teacher and one pupil, the teacher housed in the centre's city (GDD, 1 November 2026 answers, `docs/GDD.md:372`: "One veteran teacher and one pupil per centre, the teacher housed in the centre's city (Q42)."). A population location has a region and an optional hex or facility but no city, so the centre's region stands in for its host city, an approximation until real places are bound (#1691). A teacher outside the centre's region is refused with a plain reason that cites Q42. Q42 rules only on the teacher; that the trainee lives in the centre's host city too was our reading (#1697 body: "the teacher and the trainee are housed there as ordinary residents"; `docs/GDD.md:374`, "Training is ordered in the camp's city, with no travel (27M-7)."), and is now the owner's ruling (owner, 4 November 2026, Q23: asked "Must a farmer-course or pioneer-course pupil live in the training centre's host city?", the owner answered "yes", [recorded on #1697](https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6623127820)). The fixture still uses the centre's region as the stand-in for its host city, so a trainee outside the region is refused with a plain reason that says so; the rule tightens to the host city once centres are bound to real cities (#1691). A centre takes at most one teacher and one pupil, whatever `profession.trainees_per_teacher` says: a second teacher, or a second pupil while one is on a course there, is refused with a plain reason that cites Q42, not as Deferred, and an inventory with either is refused the same way. The teacher is a free civilian, a veteran of the matching profession; the trainee is a free civilian who is a novice of that profession, or a free civilian with no profession (#2464; `docs/gdd/training.md:48`: "An eligible free civilian may train under the retained course rules."). That such a pupil stays without a profession on the course is a maintainer reading, not an owner ruling: [#1697](https://github.com/eyalgolan/statecraft-israel/issues/1697), update of 3 November 2026, "the MVP has no novice stage for farmers or pioneers: an entrant is a free civilian with no profession label until completion, and a cancel leaves an ordinary civilian", built on the owner's #1693 answers of 3 November 2026 ([answers](https://github.com/eyalgolan/statecraft-israel/issues/1693#issuecomment-6606032643)), which do not say this in those words. The craftsman course differs under an owner-approved answer: "The novice craftsman label starts with the craftsman course" (`docs/GDD.md:372`, #1698 follow-up; R-CRAFT-003). Either may hold a job, which is released in the same commit that starts the course (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically.", with `docs/GDD.md:372`, Q43(b) and (c), "can be assigned from the next planning, or at once on cancellation", and `docs/gdd/training.md:66`, people "return at once"); a teacher teaching elsewhere, or a pupil on a course, is refused, since only a cancel or a graduation ends those here. No reception progress is read (`docs/GDD.md:374`, "Refugees cannot train until they become civilians"), and refugees in a reception camp take no course place. No tools are needed or charged: tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1: "Tools in the MVP: no."), and the record's tools fields are kept unchanged. A teacher also takes at most Agreed `profession.trainees_per_teacher` pupils (currently 1; the approved Q42 answer names this value as its basis), so a busy teacher refuses another pupil; a synthetic value above 1 admits no second pupil, because the centre's own limit is one. No Money is charged. Teacher and trainee then hold exclusive Teaching and Course assignments, so other assignment paths refuse them (`docs/gdd/training.md:31` at `605277dfa511dc512562ececeb273b8393b21d35`, "The teacher is fully occupied and cannot work, fight, build, travel or teach another pupil simultaneously."). Every refusal leaves the state unchanged. Craftsmen, soldiers and refugees cannot enrol. Only exact gdd-0.3 states with an initialized population ledger are accepted; legacy and gdd-0.1 are refused unchanged. The centre course does not retire the Hakhshara: the owner kept it under `gdd-0.3` (4 November 2026: "Keep the Hakhshara", [#2484](https://github.com/eyalgolan/statecraft-israel/issues/2484)), and R-TRAIN-001's `halutz` track stays.
-R-TRAIN-006: In the same fixture, the enrolment month is course turn 1 (#1668 question 43(a); GDD, 1 November 2026 answers: "A course occupies its people from its first turn"), so a course turn is counted in the enrolment month, even with a snapshot taken before the course started, unless the centre was not available at that month's freeze, and in a later month only when its opening snapshot (the #1716 synthetic month context) already holds that course with the same teacher. It is counted at most once per month ordinal: an ordinal before the enrolment month, or not above the last one counted for that pupil, is refused. A counted turn keeps the same population id and every record field (work XP, reception progress, equipment, location, military history); no person is created, and teaching and the course earn no work XP (`docs/gdd/training.md:17` at `605277dfa511dc512562ececeb273b8393b21d35`, "Travel, idle time, teaching and courses do not count."). The turn that brings a course to Agreed `profession.course_turns` counted turns (currently 3) graduates it: the pupil takes the trained tier through R-QUAL-008's transform and keeps the same id, work XP, reception progress, equipment and the tools' payment fact, location and military history; the pupil and the teacher (a centre has one pupil, R-TRAIN-005) are released in that turn, in one change, as civilians without a job. Nothing is charged and no person is created. #1697: "A free civilian or a matching equipped novice may enrol; completion gives the trained tier." Release timing follows R-TRAIN-008. The fixture also refuses a unit already trained, because Amir's proposal made a trained profession permanent (`docs/gdd/training.md:13` at the same commit, "Once trained, a civilian profession cannot be replaced."). That lock is post-MVP: D3 keeps two-way professions (R-QUAL-006), and the GDD's 1 November 2026 answers say "Graduates join their city's civilians and may re-enrol at any time" (27M-5).
+R-TRAIN-006: In the same fixture, the enrolment month is course turn 1 (#1668 question 43(a); GDD, 1 November 2026 answers: "A course occupies its people from its first turn"), so a course turn is counted in the enrolment month, even with a snapshot taken before the course started, unless the centre was not available at that month's freeze, and in a later month only when its opening snapshot (the #1716 synthetic month context) already holds that course with the same teacher. It is counted at most once per month ordinal: an ordinal before the enrolment month, or not above the last one counted for that pupil, is refused. A counted turn keeps the same population id and every record field (work XP, reception progress, equipment, location, military history); no person is created, and teaching and the course earn no work XP (`docs/gdd/training.md:17` at `605277dfa511dc512562ececeb273b8393b21d35`, "Travel, idle time, teaching and courses do not count."). The turn that brings a course to Agreed `profession.course_turns` counted turns (currently 3) graduates it: a novice takes the trained tier through R-QUAL-008's transform; a pupil with no profession takes the course teacher's profession at the trained tier here, not through that transform, with work XP 0 (#2464; the ledger requires work XP 0 with no profession, `PopulationLedger.cs:212`). The pupil keeps the same id, work XP, reception progress, equipment and the tools' payment fact, location and military history; the pupil and the teacher (a centre has one pupil, R-TRAIN-005) are released in that turn, in one change, as civilians without a job. Nothing is charged and no person is created. #1697: "A free civilian or a matching equipped novice may enrol; completion gives the trained tier." Release timing follows R-TRAIN-008. The fixture also refuses a unit already trained, because Amir's proposal made a trained profession permanent (`docs/gdd/training.md:13` at the same commit, "Once trained, a civilian profession cannot be replaced."). That lock is post-MVP: D3 keeps two-way professions (R-QUAL-006), and the GDD's 1 November 2026 answers say "Graduates join their city's civilians and may re-enrol at any time" (27M-5).
-R-TRAIN-007: In the same fixture, cancelling a course at any turn before its graduation keeps the population id, profession, novice tier, the record's tools fields and reception progress. It grants no unfinished trained tier, clears the course progress and releases the teacher and the centre's place. Nothing is refunded and no one moves. The released teacher and pupil are civilians without a job at once, in that month's snapshot, and may take a job that month, or start another course that month, and the centre can take another teacher and pupil at once (#1716; #1668 question 43(b), owner-approved answer of 1 November 2026, [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547): "Cancellation: they are released at once, as civilians without a job."). A second cancel, a cancel of a unit not in a course, or a cancel or further course turn for a graduate, is refused unchanged, and a restart is a full new course with no charge (`docs/gdd/training.md:49@605277dfa511dc512562ececeb273b8393b21d35`, "Cancelled courses retain paid entry costs and earned reception credit but award no unfinished qualification." and "Unfinished course progress clears, and restarting needs a fresh course."). A centre that stops operating cancels its course at once in the same way (owner, 4 November 2026, https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6622207214, asked "When a training centre stops operating, what happens to the course running there?", answered "Cancel at once (Recommended)"; the chosen option read: "Losing the centre cancels the course immediately, exactly like CancelTraining: people go home as jobless civilians, no Money refund, issued Arms go back to the pool."; with 27M-4, "It is cancelled like CancelTraining, with no Money refund. Arms return to the pool.", and 27M-9, "To their city as a civilian without a job. Overflow rules apply, with no hard cap.", in the [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547)): its next course turn counts nothing and cancels the course, the turn that would have graduated it included, so no one graduates, and a cancel there is an ordinary cancel. Our readings, not owner rulings: the fixture's centres are fixed records, so a centre that stops operating is one given to the fixture as not operating; the pupil and teacher are already in the centre's city (R-TRAIN-005), so no one moves; the fixture charges no Money and issues no Arms, so there is nothing to refund or return; and the released pair may start a course that month at another operating centre, while the lost centre refuses a start.
+R-TRAIN-007: In the same fixture, cancelling a course at any turn before its graduation keeps the population id, profession, novice tier (a pupil with no profession stays without one, #2464), the record's tools fields and reception progress. It grants no unfinished trained tier, clears the course progress and releases the teacher and the centre's place. Nothing is refunded and no one moves. The released teacher and pupil are civilians without a job at once, in that month's snapshot, and may take a job that month, or start another course that month, and the centre can take another teacher and pupil at once (#1716; #1668 question 43(b), owner-approved answer of 1 November 2026, [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547): "Cancellation: they are released at once, as civilians without a job."). A second cancel, a cancel of a unit not in a course, or a cancel or further course turn for a graduate, is refused unchanged, and a restart is a full new course with no charge (`docs/gdd/training.md:49@605277dfa511dc512562ececeb273b8393b21d35`, "Cancelled courses retain paid entry costs and earned reception credit but award no unfinished qualification." and "Unfinished course progress clears, and restarting needs a fresh course."). A centre that stops operating cancels its course at once in the same way (owner, 4 November 2026, https://github.com/eyalgolan/statecraft-israel/issues/1697#issuecomment-6622207214, asked "When a training centre stops operating, what happens to the course running there?", answered "Cancel at once (Recommended)"; the chosen option read: "Losing the centre cancels the course immediately, exactly like CancelTraining: people go home as jobless civilians, no Money refund, issued Arms go back to the pool."; with 27M-4, "It is cancelled like CancelTraining, with no Money refund. Arms return to the pool.", and 27M-9, "To their city as a civilian without a job. Overflow rules apply, with no hard cap.", in the [answers](https://github.com/eyalgolan/statecraft-israel/pull/1668#issuecomment-6553884547)): its next course turn counts nothing and cancels the course, the turn that would have graduated it included, so no one graduates, and a cancel there is an ordinary cancel. Our readings, not owner rulings: the fixture's centres are fixed records, so a centre that stops operating is one given to the fixture as not operating; the pupil and teacher are already in the centre's city (R-TRAIN-005), so no one moves; the fixture charges no Money and issues no Arms, so there is nothing to refund or return; and the released pair may start a course that month at another operating centre, while the lost centre refuses a start.
-R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case this slice has not built, and chooses no default. Question 44 and the novice lock-in below are decided (GDD, 1 November 2026 answers, and D3), so those refusals are implementation gaps, not open design answers. Question 42 is built and refuses with a plain reason that cites it, not as Deferred (R-TRAIN-005): a second teacher or a second pupil at one centre, a teacher outside the centre's region (the region standing in for the city), and a teaching teacher with no pupil (an invalid inventory); a pupil outside the region is refused with a plain reason that cites the owner's Q23 ruling (4 November 2026) on where the pupil lives, and our reading of 27M-7 for training there with no travel, as R-TRAIN-005 says. Question 43 is built in full: what either participant held at the month's opening (a job, or a course or teaching cancelled this turn) is no bar to starting a course that month (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically."; `docs/GDD.md:372`, "they are released in the turn its last course turn counts and can be assigned from the next planning, or at once on cancellation"; `docs/gdd/training.md:66`, people "return at once"), except a graduation, below. The ruled question 43 limits are refused unchanged with a plain reason that cites the ruling, not as Deferred: counting a month after the enrolment month whose opening snapshot does not hold the course with the same teacher (43(a)). There are no reception beds, so a centre's place freed by a cancel or a graduation is free at once, also in the month a course started and was cancelled; #1668 question 41's bed reuse is post-MVP (`docs/GDD.md:377`). #1668 question 44 and the GDD's novice lock-in decision: a free civilian without a profession, or a novice of another profession, entering a course. A course turn in a month whose #1716 facility freeze lists the centre as unavailable or without a place: a centre that stops operating cancels its course (R-TRAIN-007), but when a loss inside a month takes effect against that freeze is unruled. Graduation release under question 43(b) and (c) is built and is not Deferred (#1697 body, owner answers of 1 November 2026: "on graduation the people are released in the turn the last course turn counts and can be assigned from the next turn's planning" and "a person whose course ends this turn starts work the next turn"): a graduate and a teacher released by the graduation cannot start a course in the graduation month, even after taking a job that month (refused unchanged with a plain reason, not Deferred), and can from the next month; and work eligibility is read from the month's opening snapshot (#1716), where the graduate still holds the course, so a job given after graduation counts from the next month. Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1691, #1696, #1700, #1702, #1713, #1716; #1690 closed on 2 November 2026, its post-MVP regional pools moved to #2233).
+R-TRAIN-008: The fixture refuses, with a "Deferred:" reason and the state unchanged, every case this slice has not built, and chooses no default. Question 44 and the novice lock-in below are decided (GDD, 1 November 2026 answers, and D3), so those refusals are implementation gaps, not open design answers. Question 42 is built and refuses with a plain reason that cites it, not as Deferred (R-TRAIN-005): a second teacher or a second pupil at one centre, a teacher outside the centre's region (the region standing in for the city), and a teaching teacher with no pupil (an invalid inventory); a pupil outside the region is refused with a plain reason that cites the owner's Q23 ruling (4 November 2026) on where the pupil lives, and our reading of 27M-7 for training there with no travel, as R-TRAIN-005 says. Question 43 is built in full: what either participant held at the month's opening (a job, or a course or teaching cancelled this turn) is no bar to starting a course that month (a reading of `docs/gdd/cities.md:42`, "Reassignment releases old capacity atomically."; `docs/GDD.md:372`, "they are released in the turn its last course turn counts and can be assigned from the next planning, or at once on cancellation"; `docs/gdd/training.md:66`, people "return at once"), except a graduation, below. The ruled question 43 limits are refused unchanged with a plain reason that cites the ruling, not as Deferred: counting a month after the enrolment month whose opening snapshot does not hold the course with the same teacher (43(a)). There are no reception beds, so a centre's place freed by a cancel or a graduation is free at once, also in the month a course started and was cancelled; #1668 question 41's bed reuse is post-MVP (`docs/GDD.md:377`). #1668 question 44 and the GDD's novice lock-in decision: a novice of another profession entering a course (a free civilian without a profession enters, R-TRAIN-005, #2464). A course turn in a month whose #1716 facility freeze lists the centre as unavailable or without a place: a centre that stops operating cancels its course (R-TRAIN-007), but when a loss inside a month takes effect against that freeze is unruled. Graduation release under question 43(b) and (c) is built and is not Deferred (#1697 body, owner answers of 1 November 2026: "on graduation the people are released in the turn the last course turn counts and can be assigned from the next turn's planning" and "a person whose course ends this turn starts work the next turn"): a graduate and a teacher released by the graduation cannot start a course in the graduation month, even after taking a job that month (refused unchanged with a plain reason, not Deferred), and can from the next month; and work eligibility is read from the month's opening snapshot (#1716), where the graduate still holds the course, so a job given after graduation counts from the next month. Real centres, hosts, regions, map bindings, Money and Food settlement, saves and commands remain held with their owners (#1691, #1696, #1700, #1702, #1713, #1716; #1690 closed on 2 November 2026, its post-MVP regional pools moved to #2233).
## Craftsmen
diff --git a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
index 8fab3284c..0ae121dd9 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03TrainingCentreFixtureTests.cs
@@ -836,13 +836,86 @@ public class Gdd03TrainingCentreFixtureTests
Assert.Equal(4, s.PopulationLedger.Get(5).Assignment.TeacherId);
}
- // R-TRAIN-008: #1668 Q44 and the GDD's novice lock-in stay open: no free entrant becomes a novice here, and no
- // novice (cancelled or not) changes profession through a course.
- [Fact] public void LockInAndProfessionChangeStayDeferred()
+ // R-TRAIN-005, R-TRAIN-006 (#2464): a free civilian with no profession enters either course with a matching veteran
+ // teacher (`docs/gdd/training.md:48`: "An eligible free civilian may train under the retained course rules. Completion
+ // grants the retained qualification"; #1697: "A free civilian or a matching equipped novice may enrol; completion gives
+ // the trained tier."). The pupil stays professionless on the course, and the course's teacher decides the profession:
+ // graduation gives the same id the teacher's profession at the trained tier, keeping every other record field.
+ [Theory]
+ [InlineData(CivilianProfession.Farmer)]
+ [InlineData(CivilianProfession.Pioneer)]
+ public void AProfessionlessPupilGraduatesInTheTeachersProfession(CivilianProfession profession)
+ {
+ var c = Catalogue(); var s = State(c, Person(CivilianProfession.None, CivilianTier.None, null));
+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());
+ var (teacher, _) = Pair(profession); var l = s.PopulationLedger;
+ var before = l.Get(6); int count = l.Units.Count, next = l.NextPopulationId;
+
+ f.Start(6, teacher, CentreA, Month(s, 0));
+ var on = l.Get(6);
+ Assert.Equal(PopulationStatus.Trainee, on.Status); Assert.Equal(teacher, on.Assignment.TeacherId);
+ Assert.Equal(CivilianProfession.None, on.Profession); Assert.Equal(CivilianTier.None, on.Tier);
+ f.Advance(6, Month(s, 0)); f.Advance(6, Month(s, 1));
+ Assert.Equal(CivilianProfession.None, l.Get(6).Profession); // no unfinished qualification on the course
+ f.Advance(6, Month(s, 2));
+
+ var graduate = l.Get(6);
+ Assert.Equal(PopulationStatus.FreeCivilian, graduate.Status); Assert.Same(PopulationAssignment.Unassigned, graduate.Assignment);
+ Assert.Equal(profession, graduate.Profession); Assert.Equal(CivilianTier.Trained, graduate.Tier);
+ Assert.Equal(0, graduate.WorkXp); Assert.Equal(before.ReceptionTicks, graduate.ReceptionTicks);
+ Assert.Same(before.Equipment, graduate.Equipment); Assert.Same(before.Location, graduate.Location);
+ Assert.Equal(before.CombatXp, graduate.CombatXp); Assert.Equal(before.Qualification, graduate.Qualification);
+ Assert.Equal(PopulationAssignmentKind.Unassigned, l.Get(teacher).Assignment.Kind);
+ Assert.Equal(CivilianTier.Veteran, l.Get(teacher).Tier);
+ Assert.Equal(count, l.Units.Count); Assert.Equal(next, l.NextPopulationId);
+ }
+
+ // R-TRAIN-007 (#2464): cancelling a professionless pupil's course keeps the id and leaves an ordinary civilian with no
+ // profession, no unfinished qualification and no course progress (`docs/gdd/training.md:66`: "Cancelled retained
+ // courses award no unfinished qualification."); the teacher is released, and the pupil may start again at once.
+ [Theory]
+ [InlineData(CivilianProfession.Farmer)]
+ [InlineData(CivilianProfession.Pioneer)]
+ public void ACancelledProfessionlessPupilStaysProfessionless(CivilianProfession profession)
{
var c = Catalogue(); var s = State(c, Person(CivilianProfession.None, CivilianTier.None, null));
var f = new Gdd03TrainingCentreFixture(c, s, Centres());
- Unchanged(s, () => f.Start(6, 0, CentreA, Month(s, 0)), typeof(NotSupportedException), "Deferred: #1668 Q44");
+ var (teacher, _) = Pair(profession); var l = s.PopulationLedger; var before = l.Get(6);
+ f.Start(6, teacher, CentreA, Month(s, 0)); f.Advance(6, Month(s, 0)); f.Advance(6, Month(s, 1));
+ f.Cancel(6);
+
+ var p = l.Get(6);
+ Assert.Equal(PopulationStatus.FreeCivilian, p.Status); Assert.Same(PopulationAssignment.Unassigned, p.Assignment);
+ Assert.Equal(CivilianProfession.None, p.Profession); Assert.Equal(CivilianTier.None, p.Tier); Assert.Equal(0, p.WorkXp);
+ Assert.Equal(before.ReceptionTicks, p.ReceptionTicks); Assert.Same(before.Equipment, p.Equipment);
+ Assert.Same(before.Location, p.Location); Assert.Equal(before.CombatXp, p.CombatXp); Assert.Equal(before.Qualification, p.Qualification);
+ Assert.Equal(PopulationAssignmentKind.Unassigned, l.Get(teacher).Assignment.Kind);
+ f.Start(6, teacher, CentreA, Month(s, 1)); // a restart is a fresh course, from 0
+ Assert.Equal(0, l.Get(6).Assignment.ProgressTicks);
+ }
+
+ // R-TRAIN-005 (#2464): a professionless pupil now passes the Q44 check and meets the region, occupancy and one-pupil
+ // checks, each refused with the state unchanged: a pupil outside the centre's region (the owner's Q23 ruling), a second
+ // pupil at an occupied centre (Q42), and a pupil already on a course.
+ [Fact] public void AProfessionlessPupilMeetsTheSameRefusals()
+ {
+ var c = Catalogue(); var s = State(c,
+ Person(CivilianProfession.None, CivilianTier.None, null, region: "south"), // 6
+ Person(CivilianProfession.None, CivilianTier.None, null), // 7
+ Person(CivilianProfession.None, CivilianTier.None, null)); // 8
+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());
+ Unchanged(s, () => f.Start(6, 0, CentreA, Month(s, 0)), typeof(ArgumentException), PupilCity);
+ f.Start(7, 0, CentreA, Month(s, 0));
+ Unchanged(s, () => f.Start(8, 4, CentreA, Month(s, 0)), typeof(ArgumentException), OneTeacherOnePupil);
+ Unchanged(s, () => f.Start(7, 4, CentreB, Month(s, 0)), typeof(ArgumentException), "The trainee must be a free civilian");
+ }
+
+ // R-TRAIN-008: a novice of another profession still does not change profession through a course (cancelled or not),
+ // and stays Deferred; a professionless pupil no longer is (#2464, above).
+ [Fact] public void ProfessionChangeStaysDeferred()
+ {
+ var c = Catalogue(); var s = State(c);
+ var f = new Gdd03TrainingCentreFixture(c, s, Centres());
Unchanged(s, () => f.Start(1, 2, CentreA, Month(s, 0)), typeof(NotSupportedException), "Deferred: #1668 Q44");
f.Start(1, 0, CentreA, Month(s, 0)); f.Cancel(1);
Unchanged(s, () => f.Start(1, 2, CentreA, Month(s, 1)), typeof(NotSupportedException), "Deferred: #1668 Q44");
diff --git a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
index b787fe283..bb76c7230 100644
--- a/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
+++ b/sim/Statecraft.Sim/Gdd03TrainingCentreFixture.cs
@@ -71,7 +71,7 @@ namespace Statecraft.Sim
internal const string PupilCityReason = "The pupil lives in the centre's host city (owner ruling Q23, 4 November 2026, #1697) and trains there with no travel (a reading of 27M-7); this fixture checks the centre's region as an approximation of the city.";
internal const string GraduationMonthReason = "A person released by a graduation can start a course from the next month (#1668 Q43(b), GDD 1 Nov 2026).";
internal const string CourseAtOpeningReason = "After the enrolment month, a course turn counts only when the month's opening holds the course with the same teacher (#1668 Q43(a), GDD 1 Nov 2026).";
- const string Q44 = "#1668 Q44 and the GDD novice lock-in decision (when a free entrant becomes a novice; profession change after a cancelled course).";
+ const string Q44 = "#1668 Q44 and the GDD novice lock-in decision (a novice changing profession through a course, also after a cancelled course).";
// The owner's 4 November 2026 ruling covers a centre that stops operating (Operating false). When a loss inside a
// month takes effect against the #1716 month freeze, which lists the centre unavailable or without a place, is unruled.
const string MonthFreeze = "#1716 month freeze: when a centre loss inside a month takes effect is unruled (a centre that stops operating is cancelled, owner 4 Nov 2026).";
@@ -104,10 +104,12 @@ namespace Statecraft.Sim
if (n > pupilsPerTeacher || !FarmerOrPioneer(t.Profession) || t.Tier != CivilianTier.Veteran)
throw new ArgumentException("Centre teacher must be a matching veteran within the pupil limit.");
}
+ // A pupil is a novice of the teacher's profession, or a free civilian with no profession (#2464).
foreach (var p in pupils)
- if (p.Assignment.TeacherId is not int teacher || state.PopulationLedger.Get(teacher).Profession != p.Profession
- || p.Tier != CivilianTier.Novice || p.Assignment.ProgressTicks >= courseTurns)
- throw new ArgumentException("Centre pupil must be a matching novice with a teacher and an unfinished course.");
+ if (p.Assignment.TeacherId is not int teacher
+ || p.Profession != CivilianProfession.None && (state.PopulationLedger.Get(teacher).Profession != p.Profession || p.Tier != CivilianTier.Novice)
+ || p.Assignment.ProgressTicks >= courseTurns)
+ throw new ArgumentException("Centre pupil must be a matching novice or have no profession, with a teacher and an unfinished course.");
if (teachers.Any(p => p.Location!.Region != centre.Region)) throw new ArgumentException(TeacherCityReason);
if (pupils.Any(p => p.Location!.Region != centre.Region)) throw new ArgumentException(PupilCityReason);
}
@@ -135,8 +137,8 @@ namespace Statecraft.Sim
static PopulationUnit Released(PopulationUnit p)
=> p.WithPlacement(PopulationStatus.FreeCivilian, p.Location, PopulationAssignment.Unassigned, p.Captor, p.Home);
- /// <summary>R-TRAIN-005: enrol a matching novice with a matching veteran teacher at an operating centre, both in the
- /// centre's region (Q42 for the teacher, the owner's Q23 ruling for the pupil), and only into an empty
+ /// <summary>R-TRAIN-005: enrol a matching novice, or a free civilian with no profession (#2464), with a matching
+ /// veteran teacher at an operating centre, both in the centre's region (Q42 for the teacher, the owner's Q23 ruling for the pupil), and only into an empty
/// centre: one teacher and one pupil (Q42). Either may leave a job to do so, released in the same commit. No payment, and no tools:
/// tools are post-MVP (#1693, owner answers of 3 November 2026, answer 1).</summary>
internal void Start(int traineeId, int teacherId, string centreId, Gdd03SyntheticMonthContext month)
@@ -160,7 +162,9 @@ namespace Statecraft.Sim
throw new ArgumentException("A course cannot replace another civilian profession.");
if (trainee.Profession != CivilianProfession.None && trainee.Tier != CivilianTier.Novice)
throw new ArgumentException("Only a novice can gain the trained tier from a course.");
- if (trainee.Profession != teacher.Profession) throw Deferred(Q44);
+ // #2464: a free civilian with no profession may enter either course (docs/gdd/training.md:48, "An eligible free
+ // civilian may train"); a novice of another profession is still not built here.
+ if (trainee.Profession != CivilianProfession.None && trainee.Profession != teacher.Profession) throw Deferred(Q44);
if (teacher.Location!.Region != centre.Region) throw new ArgumentException(TeacherCityReason);
if (trainee.Location!.Region != centre.Region) throw new ArgumentException(PupilCityReason);
@@ -232,8 +236,13 @@ namespace Statecraft.Sim
}
// Graduation (Q43(b)): the trained tier from the pupil's pre-release course record, then pupil and teacher are
// released in one commit, so no teacher is left teaching with no pupil. The pupil is the centre's one pupil (Q42).
- var graduate = Released(CivilianProfessionRules.AfterMatchingCourse(content, state, trainee.Id, trainee.Profession));
+ // A professionless pupil (#2464) takes the course teacher's profession at the trained tier, with work XP 0 as the
+ // ledger requires of a person who had no profession; every other field is kept.
var teacher = ledger.Get(trainee.Assignment.TeacherId!.Value);
+ var graduate = Released(trainee.Profession == CivilianProfession.None
+ ? new PopulationUnit(trainee.Id, trainee.Status, trainee.ReceptionTicks, trainee.Location, trainee.Assignment,
+ teacher.Profession, CivilianTier.Trained, 0, trainee.Qualification, trainee.CombatXp, trainee.Equipment, trainee.Captor, trainee.Home)
+ : CivilianProfessionRules.AfterMatchingCourse(content, state, trainee.Id, trainee.Profession));
Commit(graduate, Released(teacher));
months.Remove(trainee.Id);
graduated[trainee.Id] = month.MonthOrdinal;