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.

Sim: basic training graduates into a formation that pays upkeep (Refs #1699) (#2439)

Eyal Golane848831ac651
diff --git a/changelog.d/1699-basic-training-graduation.md b/changelog.d/1699-basic-training-graduation.md
new file mode 100644
index 000000000..f8cd2a0ab
--- /dev/null
+++ b/changelog.d/1699-basic-training-graduation.md
@@ -0,0 +1,5 @@
+### Added
+- In the same gdd-0.3 basic training test fixture, a recruit group that finishes its course becomes one formation: the
+ same people serve as active soldiers in their camp's region, qualified as infantry so they cannot take basic training
+ again, and keep their Arms, and the formation pays 0.05 Money a month from the month it graduates, whatever its size
+ (Refs #1699). It is not in the game yet; the game players play (gdd-0.1) is unchanged.
diff --git a/sim/Statecraft.Sim.Tests/Gdd03BasicTrainingFixtureTests.cs b/sim/Statecraft.Sim.Tests/Gdd03BasicTrainingFixtureTests.cs
index 63cac7458..8ff9d9d38 100644
--- a/sim/Statecraft.Sim.Tests/Gdd03BasicTrainingFixtureTests.cs
+++ b/sim/Statecraft.Sim.Tests/Gdd03BasicTrainingFixtureTests.cs
@@ -22,11 +22,29 @@ using Statecraft.Sim;
// does not exist, or has finished, is refused with the state unchanged."
// - R-ARMS-003 (docs/rules/mvp.md): "The cohort keeps the Arms it took, and the state hash writes them with it; cancelling
// the cohort (R-TRAIN-002) returns them to the pool, up to the most the stock can hold, although the Money stays paid"
+// Completion and upkeep (#1699 third slice), quoted at 3b18babc1:
+// - R-UNIT-003 (docs/rules/mvp.md): "A finished recruit cohort becomes exactly one Israeli infantry formation at its city's
+// settlement hex, with `Strength` equal to the cohort's `Count` in population units ... Its reserved Arms are neither
+// charged again nor refunded on completion (R-ARMS-003)."
+// - docs/GDD.md:372 (Q43(b)): "they are released in the turn its last course turn counts".
+// - docs/GDD.md:374 (27M-8): "A formation pays military upkeep from the turn it graduates (27M-8)."
+// - R-UNIT-010 (docs/rules/mvp.md): "each Israeli military formation pays `military_upkeep_per_turn` Money, including a
+// formation that graduated this turn. The owner-accepted initial rate is IL 0.05m per formation per turn, independent of
+// strength and turn length"; content/gdd03-balance.yaml `military.active_money` [0.05].
+// Maintainer calls by coordinator 53 (3 November 2026), not owner rulings: formations are pre-bound, empty ActiveService
+// targets supplied by the tests; one Start order is one cohort and one formation, its strength its count; only formations
+// this fixture graduated pay; a graduating Advance after that month's PayUpkeep is refused. A graduate's military
+// qualification (docs/GDD.md:372: a returned captive "keeps their id and military qualification") is the course's unit
+// class, content/unit_types.yaml `recruit` `class` (infantry); value: the course's unit class (unit_types.yaml); maintainer
+// call on the source of the value, not an owner ruling.
public class Gdd03BasicTrainingFixtureTests
{
- static readonly Lazy<Gdd03BalanceCatalogue> Real = new(() => ContentLoader.Load(RealContentTests.ContentRoot()).Gdd03Balance!);
+ static readonly Lazy<Content> RealContent = new(() => ContentLoader.Load(RealContentTests.ContentRoot()));
+ static readonly Lazy<Gdd03BalanceCatalogue> Real = new(() => RealContent.Value.Gdd03Balance!);
const string CampNorth = "fixture-camp-north", CampSouth = "fixture-camp-south", Field = "fixture-field", Service = "fixture-service";
- const string Infantry = "infantry", Carried = "fixture-carried-item";
+ const string Infantry = "infantry", FixtureClass = "fixture-class", Carried = "fixture-carried-item";
+ const string FormationNorthA = "fixture-formation-north-a", FormationNorthB = "fixture-formation-north-b",
+ FormationSouth = "fixture-formation-south";
static Content Catalogue(string? key = null, Gdd03DesignValue? replacement = null, string ruleset = SaveGame.Gdd03Ruleset)
{
@@ -34,6 +52,14 @@ public class Gdd03BasicTrainingFixtureTests
var values = new Dictionary<string, Gdd03DesignValue>(Real.Value.Values, StringComparer.Ordinal);
if (key != null) { if (replacement == null) values.Remove(key); else values[key] = replacement; }
c.Gdd03Balance = new Gdd03BalanceCatalogue { Ruleset = Real.Value.Ruleset, Values = values };
+ c.UnitTypes = RealContent.Value.UnitTypes;
+ return c;
+ }
+ // The real unit types with `recruit` replaced by one of the given class, or without `recruit` when the class is null.
+ static Content WithRecruitClass(Content c, string? recruitClass)
+ {
+ c.UnitTypes = RealContent.Value.UnitTypes.Where(t => t.Id != "recruit").ToList();
+ if (recruitClass != null) c.UnitTypes.Add(new UnitType { Id = "recruit", Kind = "unit", Side = "israel", Class = recruitClass });
return c;
}
static Gdd03DesignValue Agreed(decimal v) => new() { Basis = "Agreed", Values = new() { v }, Note = "synthetic test value" };
@@ -44,8 +70,11 @@ public class Gdd03BasicTrainingFixtureTests
new[] { new PopulationTarget(CampNorth, PopulationAssignmentKind.Course, "north", 3),
new PopulationTarget(CampSouth, PopulationAssignmentKind.Course, "south", 3),
new PopulationTarget(Field, PopulationAssignmentKind.Work, "north"),
- new PopulationTarget(Service, PopulationAssignmentKind.ActiveService, "north") },
- Array.Empty<string>(), new[] { Infantry });
+ new PopulationTarget(Service, PopulationAssignmentKind.ActiveService, "north"),
+ new PopulationTarget(FormationNorthA, PopulationAssignmentKind.ActiveService, "north"),
+ new PopulationTarget(FormationNorthB, PopulationAssignmentKind.ActiveService, "north"),
+ new PopulationTarget(FormationSouth, PopulationAssignmentKind.ActiveService, "south") },
+ Array.Empty<string>(), new[] { Infantry, FixtureClass });
static PopulationUnit Person(PopulationStatus status = PopulationStatus.FreeCivilian, string region = "north",
PopulationAssignment? assignment = null, string qualification = "", string? military = null, string? tools = null)
@@ -67,8 +96,14 @@ public class Gdd03BasicTrainingFixtureTests
}
static Gdd03FixtureMilitaryCamp[] Camps(bool northOperating = true) => new[] {
new Gdd03FixtureMilitaryCamp(CampNorth, "north", northOperating), new Gdd03FixtureMilitaryCamp(CampSouth, "south", true) };
- static Gdd03BasicTrainingFixture Fixture(Content c, GameState s, int spare = 10, decimal money = 10m, bool northOperating = true)
- => new(c, s, Camps(northOperating), spare, money);
+ static Gdd03FixtureFormation[] Formations() => new[] {
+ new Gdd03FixtureFormation(FormationNorthA, "north"), new Gdd03FixtureFormation(FormationNorthB, "north"),
+ new Gdd03FixtureFormation(FormationSouth, "south") };
+ static Gdd03BasicTrainingFixture Fixture(Content c, GameState s, int spare = 10, decimal money = 10m, bool northOperating = true,
+ Gdd03FixtureFormation[]? formations = null)
+ => new(c, s, Camps(northOperating), formations ?? Formations(), spare, money);
+ static int[] Soldiers(GameState s, string formation) => s.PopulationLedger.Units
+ .Where(p => p.Status == PopulationStatus.ActiveSoldier && p.Assignment.Target == formation).Select(p => p.Id).ToArray();
static int Issued(GameState s) => s.PopulationLedger.Units.Count(p => p.Equipment.MilitaryId != null);
static string Snapshot(GameState s, Gdd03BasicTrainingFixture f)
@@ -237,10 +272,11 @@ public class Gdd03BasicTrainingFixtureTests
}
// R-TRAIN-001 (docs/rules/mvp.md): "counting the turn it was ordered in"; content/gdd03-balance.yaml:311-314
- // `military.basic_turns` [3]. The enrolment month is course turn 1, each month ordinal counts once, and the turn that
- // would complete the course is Deferred (completion into a formation is not in this slice). The issued item stays on the
- // record throughout.
- [Fact] public void TheEnrolmentMonthCountsAndCompletionIsDeferred()
+ // `military.basic_turns` [3]. The enrolment month is course turn 1 and each month ordinal counts once. The month that
+ // counts the last course turn graduates the record (Q43(b), R-TRAIN-003, R-UNIT-003): the same id, in place, becomes an
+ // active soldier of a formation in the camp's region, keeping its issued item; nothing is charged or refunded, and no
+ // person is created.
+ [Fact] public void TheEnrolmentMonthCountsAndTheLastTurnGraduates()
{
var c = Catalogue(); var s = State(c); var f = Fixture(c, s); var l = s.PopulationLedger;
f.Start(new[] { 0 }, CampNorth, 4);
@@ -251,23 +287,48 @@ public class Gdd03BasicTrainingFixtureTests
Unchanged(s, f, () => f.Advance(0, 3), typeof(ArgumentException));
f.Advance(0, 5);
Assert.Equal(2, l.Get(0).Assignment.ProgressTicks);
- Unchanged(s, f, () => f.Advance(0, 6), typeof(NotSupportedException), "Deferred:");
Assert.Equal(PopulationStatus.Trainee, l.Get(0).Status);
- Assert.Equal(item, l.Get(0).Equipment.MilitaryId);
+ var before = l.Get(0); int count = l.Units.Count, next = l.NextPopulationId;
+ int spare = f.SpareArms; decimal money = f.Money, debt = f.Debt;
+
+ f.Advance(0, 6);
+
+ var p = l.Get(0);
+ Assert.Equal(PopulationStatus.ActiveSoldier, p.Status);
+ Assert.Equal(PopulationAssignmentKind.ActiveService, p.Assignment.Kind);
+ Assert.Equal(FormationNorthA, p.Assignment.Target);
+ Assert.Equal(0, p.Assignment.ProgressTicks); Assert.Null(p.Assignment.TeacherId);
+ Assert.Equal(item, p.Equipment.MilitaryId); Assert.True(p.Equipment.MilitaryPaid);
+ Assert.Equal(Infantry, p.Qualification);
+ Assert.Same(before.Location, p.Location);
+ Assert.Equal(before.Equipment.ToolsId, p.Equipment.ToolsId); Assert.Equal(before.Profession, p.Profession);
+ Assert.Equal(before.Tier, p.Tier); Assert.Equal(before.WorkXp, p.WorkXp); Assert.Equal(before.CombatXp, p.CombatXp);
+ Assert.Equal(before.ReceptionTicks, p.ReceptionTicks);
+ Assert.Equal(spare, f.SpareArms); Assert.Equal(money, f.Money); Assert.Equal(debt, f.Debt);
+ Assert.Equal(count, l.Units.Count); Assert.Equal(next, l.NextPopulationId);
+ Unchanged(s, f, () => f.Advance(0, 7), typeof(ArgumentException)); // a graduate is not a trainee
Unchanged(s, f, () => f.Advance(1, 6), typeof(ArgumentException)); // never started
l.Reconcile();
}
// content/gdd03-balance.yaml:311-314 `military.basic_turns` [3], read from the catalogue, not a literal: with a synthetic
- // 2 or 4, the enrolment month and every later month count until the turn that would reach that value, which is Deferred.
+ // 2 or 4, the enrolment month and every later month count, the record staying a trainee, until the month that reaches
+ // that value, which graduates it.
[Theory, InlineData(2), InlineData(4)]
- public void TheCompletionTurnComesFromTheCatalogue(int turns)
+ public void TheGraduationTurnComesFromTheCatalogue(int turns)
{
var c = Catalogue("military.basic_turns", Agreed(turns)); var s = State(c); var f = Fixture(c, s); var l = s.PopulationLedger;
f.Start(new[] { 0 }, CampNorth, 0);
- for (int month = 0; month < turns - 1; month++) f.Advance(0, month);
+ for (int month = 0; month < turns - 1; month++)
+ {
+ f.Advance(0, month);
+ Assert.Equal(PopulationStatus.Trainee, l.Get(0).Status);
+ }
Assert.Equal(turns - 1, l.Get(0).Assignment.ProgressTicks);
- Unchanged(s, f, () => f.Advance(0, turns - 1), typeof(NotSupportedException), "Deferred:");
+ f.Advance(0, turns - 1);
+ Assert.Equal(PopulationStatus.ActiveSoldier, l.Get(0).Status);
+ Assert.Equal(FormationNorthA, l.Get(0).Assignment.Target);
+ l.Reconcile();
}
// R-MONEY-003 (docs/rules/mvp.md): "A shortfall changes nothing but the Treasury and the debt, and a refused order
@@ -303,7 +364,8 @@ public class Gdd03BasicTrainingFixtureTests
() => f.Start(new[] { 1 }, CampNorth, 0), // one issue, the last spare
() => f.Start(new[] { 2 }, CampSouth, 1), // wrong region: refused
() => f.Advance(0, 0), () => f.Advance(0, 0), // second count refused
- () => f.Advance(0, 1), () => f.Advance(0, 2), // completion Deferred
+ () => f.Advance(0, 1), () => f.Advance(0, 2), // 0 graduates, keeping its item
+ () => f.Advance(0, 3), // a graduate: refused
() => f.Advance(3, 1),
};
int accepted = 0;
@@ -314,9 +376,12 @@ public class Gdd03BasicTrainingFixtureTests
Assert.Equal(units, s.PopulationLedger.Units.Count);
s.PopulationLedger.Reconcile();
}
- Assert.Equal(6, accepted);
+ Assert.Equal(7, accepted);
Assert.Equal(0, f.SpareArms);
Assert.Equal(1.25m, f.Debt); // 4 courses x 0.5 = 2, of which 0.75 was in hand
+ Assert.Equal(PopulationStatus.ActiveSoldier, s.PopulationLedger.Get(0).Status);
+ Assert.Equal(new[] { 0 }, Soldiers(s, FormationNorthA));
+ Assert.Equal(Gdd03BasicTrainingFixture.IssuedPrefix + "0", s.PopulationLedger.Get(0).Equipment.MilitaryId);
}
finally { CultureInfo.CurrentCulture = saved; }
}
@@ -353,22 +418,30 @@ public class Gdd03BasicTrainingFixtureTests
foreach (var identity in new[] { SaveGame.LegacyRuleset, SaveGame.GddRuleset })
{
var c = Catalogue(ruleset: identity); var s = new GameState(c); var before = s.Describe();
- Assert.Throws<InvalidOperationException>(() => new Gdd03BasicTrainingFixture(c, s, Camps(), 1, 1m));
+ Assert.Throws<InvalidOperationException>(() => new Gdd03BasicTrainingFixture(c, s, Camps(), Formations(), 1, 1m));
Assert.Equal(before, s.Describe());
}
var g = Catalogue();
- Assert.Throws<InvalidOperationException>(() => new Gdd03BasicTrainingFixture(g, new GameState(g), Camps(), 1, 1m));
+ Assert.Throws<InvalidOperationException>(() => new Gdd03BasicTrainingFixture(g, new GameState(g), Camps(), Formations(), 1, 1m));
var state = State(g);
- foreach (var key in new[] { "military.camp_capacity", "military.basic_turns", "military.issue_arms", "military.training_money" })
+ foreach (var key in new[] { "military.camp_capacity", "military.basic_turns", "military.issue_arms", "military.training_money", "military.active_money" })
foreach (var replacement in new[] { null, Deferred() })
- Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue(key, replacement), state, Camps(), 1, 1m));
- Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue("military.issue_arms", Agreed(2)), state, Camps(), 1, 1m));
- Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue("military.repeat_issue", Agreed(1)), state, Camps(), 1, 1m));
- Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(), -1, 1m));
- Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(), 1, -1m));
- Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps().Concat(Camps()), 1, 1m));
+ Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue(key, replacement), state, Camps(), Formations(), 1, 1m));
+ Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue("military.issue_arms", Agreed(2)), state, Camps(), Formations(), 1, 1m));
+ Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(Catalogue("military.repeat_issue", Agreed(1)), state, Camps(), Formations(), 1, 1m));
+ foreach (var recruitClass in new[] { null, "" })
+ Assert.Throws<ContentException>(() => new Gdd03BasicTrainingFixture(WithRecruitClass(Catalogue(), recruitClass), state,
+ Camps(), Formations(), 1, 1m));
+ Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(), Formations(), -1, 1m));
+ Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(), Formations(), 1, -1m));
+ Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps().Concat(Camps()), Formations(), 1, 1m));
Assert.Throws<ArgumentException>(() => new Gdd03FixtureMilitaryCamp(" ", "north", true));
Assert.Throws<ArgumentException>(() => new Gdd03FixtureMilitaryCamp(CampNorth, "", true));
+ Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(), Formations().Concat(Formations()), 1, 1m));
+ Assert.Throws<ArgumentException>(() => new Gdd03BasicTrainingFixture(g, state, Camps(),
+ new[] { new Gdd03FixtureFormation(CampNorth, "north") }, 1, 1m));
+ Assert.Throws<ArgumentException>(() => new Gdd03FixtureFormation(" ", "north"));
+ Assert.Throws<ArgumentException>(() => new Gdd03FixtureFormation(FormationNorthA, ""));
}
// docs/GDD.md:372: "Arms return to the pool"; R-ARMS-003 (docs/rules/mvp.md): "cancelling the cohort (R-TRAIN-002)
@@ -595,4 +668,265 @@ public class Gdd03BasicTrainingFixtureTests
Assert.Equal(5, f.SpareArms);
l.Reconcile();
}
+
+ static void Graduate(Gdd03BasicTrainingFixture f, int id, int enrolment, int turns = 3)
+ {
+ for (int month = enrolment; month < enrolment + turns; month++) f.Advance(id, month);
+ }
+
+ // R-UNIT-003 (docs/rules/mvp.md): "A finished recruit cohort becomes exactly one Israeli infantry formation ... with
+ // `Strength` equal to the cohort's `Count` in population units"; the live path makes one unit per cohort with
+ // `strength: k.Count` (sim/Statecraft.Sim/Training.cs:244-246). 53's maintainer call (not an owner ruling): one Start
+ // order is one cohort and one formation. Two orders in the same camp and month are two cohorts, so two formations; a
+ // carried item stays on its record and the spare stock is unchanged by graduation.
+ [Fact] public void AStartOrderGraduatesAsOneFormationWithItsCountAsStrength()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, spare: 10); var l = s.PopulationLedger;
+ f.Start(new[] { 0, 1, 2 }, CampNorth, 0);
+ f.Start(new[] { 3 }, CampNorth, 0);
+ Assert.Equal(7, f.SpareArms);
+ foreach (var id in new[] { 0, 1, 2, 3 }) Graduate(f, id, 0);
+
+ Assert.Equal(new[] { 0, 1, 2 }, Soldiers(s, FormationNorthA));
+ Assert.Equal(new[] { 3 }, Soldiers(s, FormationNorthB));
+ Assert.Equal(Carried, l.Get(3).Equipment.MilitaryId);
+ Assert.Equal(7, f.SpareArms);
+ l.Reconcile();
+ }
+
+ // 53's maintainer call (not an owner ruling): the cohort is the Start order, so a member whose last course turn counts
+ // in a later month still joins the formation its cohort already graduated into, not a new one.
+ [Fact] public void ALateMemberJoinsItsCohortsFormation()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s);
+ f.Start(new[] { 0, 1 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ f.Advance(1, 0); f.Advance(1, 1);
+ Assert.Equal(new[] { 0 }, Soldiers(s, FormationNorthA));
+ f.Advance(1, 4);
+ Assert.Equal(new[] { 0, 1 }, Soldiers(s, FormationNorthA));
+ Assert.Empty(Soldiers(s, FormationNorthB));
+ s.PopulationLedger.Reconcile();
+ }
+
+ // R-TRAIN-002 (docs/rules/mvp.md): "A cohort that does not exist, or has finished, is refused with the state unchanged."
+ // A graduate cannot be cancelled or advanced, and cannot take basic training again (#1699 Done when row 2: "a
+ // basic-training order for an already qualified soldier is refused (it cannot be used to avoid active upkeep)"): Start
+ // takes only free civilians.
+ [Fact] public void AGraduateIsRefusedCancelAdvanceAndBasicTraining()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ Unchanged(s, f, () => f.Cancel(0), typeof(ArgumentException));
+ Unchanged(s, f, () => f.Advance(0, 3), typeof(ArgumentException));
+ var ex = Unchanged(s, f, () => f.Start(new[] { 0 }, CampNorth, 3), typeof(ArgumentException));
+ Assert.Contains("is not a civilian without a job", ex.Message, StringComparison.Ordinal);
+ }
+
+ // #1699 Done when: "a basic-training order for an already qualified soldier is refused (it cannot be used to avoid
+ // active upkeep)". Graduation gives the record the course's unit class as its military qualification (infantry for
+ // `recruit`, content/unit_types.yaml), so a graduate who is a free civilian without a job again is refused because of
+ // that qualification, not its status. No fixture path demobilises a graduate, so the test moves the record directly.
+ [Fact] public void AGraduateBackInCivilianLifeIsRefusedBasicTraining()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s); var l = s.PopulationLedger;
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ var graduate = l.Get(0);
+ l.Replace(graduate.WithPlacement(PopulationStatus.FreeCivilian, graduate.Location, PopulationAssignment.Unassigned,
+ graduate.Captor, graduate.Home));
+ Assert.Equal(Infantry, l.Get(0).Qualification);
+ var ex = Unchanged(s, f, () => f.Start(new[] { 0 }, CampNorth, 3), typeof(ArgumentException));
+ Assert.Contains("is already a qualified soldier", ex.Message, StringComparison.Ordinal);
+ }
+
+ // The qualification is read from the content, not a literal: with `recruit` given a synthetic class, a graduate holds
+ // that class.
+ [Fact] public void TheGraduatesQualificationIsTheCoursesUnitClass()
+ {
+ var c = WithRecruitClass(Catalogue(), FixtureClass); var s = State(c); var f = Fixture(c, s);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ Assert.Equal(FixtureClass, s.PopulationLedger.Get(0).Qualification);
+ }
+
+ // R-TRAIN-002 and docs/GDD.md:372 (cancel); R-UNIT-003 (strength is the cohort's count). A cancelled trainee is out of its
+ // course and never graduates; the rest of its cohort graduates without it. A cohort cancelled whole claims no formation,
+ // so the next cohort in that region still finds one.
+ [Fact] public void ACancelledTraineeNeverGraduates()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s); var l = s.PopulationLedger;
+ f.Start(new[] { 0, 1 }, CampNorth, 0);
+ f.Advance(0, 0); f.Advance(0, 1); f.Advance(1, 0); f.Advance(1, 1);
+ f.Cancel(1);
+ Unchanged(s, f, () => f.Advance(1, 2), typeof(ArgumentException));
+ f.Advance(0, 2);
+ Assert.Equal(new[] { 0 }, Soldiers(s, FormationNorthA));
+ Assert.Equal(PopulationStatus.FreeCivilian, l.Get(1).Status);
+
+ f.Start(new[] { 5 }, CampSouth, 0);
+ f.Cancel(5);
+ f.Start(new[] { 5 }, CampSouth, 1);
+ Graduate(f, 5, 1);
+ Assert.Equal(new[] { 5 }, Soldiers(s, FormationSouth));
+ l.Reconcile();
+ }
+
+ // 53's maintainer call (not an owner ruling): formations are "pre-bound, empty ActiveService targets supplied by the
+ // tests". A cohort takes the first one in its camp's region that is neither claimed nor serving anyone (the region
+ // limit and this meaning of free are also 53's call; only "the first free pre-bound formation in deterministic order"
+ // is the owner's ruling, 4 November 2026, Q25, #1699 comment 6623136049); with none, the graduating month is refused
+ // with the state unchanged and the trainee keeps its course.
+ [Fact] public void GraduationNeedsAFreeFormationInTheCampsRegion()
+ {
+ var c = Catalogue(); var s = State(c); var l = s.PopulationLedger;
+ var f = Fixture(c, s, formations: new[] { new Gdd03FixtureFormation(Service, "north"), new Gdd03FixtureFormation(FormationSouth, "south") });
+ f.Start(new[] { 0 }, CampNorth, 0);
+ f.Advance(0, 0); f.Advance(0, 1);
+ Unchanged(s, f, () => f.Advance(0, 2), typeof(ArgumentException)); // Service already holds soldier 8
+ Assert.Equal(PopulationStatus.Trainee, l.Get(0).Status);
+ Assert.Equal(2, l.Get(0).Assignment.ProgressTicks);
+
+ var s2 = State(c); var f2 = Fixture(c, s2, formations: new[] { new Gdd03FixtureFormation(FormationNorthA, "north") });
+ f2.Start(new[] { 0 }, CampNorth, 0);
+ f2.Start(new[] { 1 }, CampNorth, 0);
+ Graduate(f2, 0, 0);
+ f2.Advance(1, 0); f2.Advance(1, 1);
+ Unchanged(s2, f2, () => f2.Advance(1, 2), typeof(ArgumentException)); // its region's only formation is taken
+ Assert.Equal(PopulationStatus.Trainee, s2.PopulationLedger.Get(1).Status);
+ }
+
+ // 27M-8 (docs/GDD.md:374): "A formation pays military upkeep from the turn it graduates"; R-UNIT-010 (docs/rules/mvp.md)
+ // "including a formation that graduated this turn"; `military.active_money` [0.05]. Nothing is paid before graduation; the
+ // graduation month pays, and so does every later month.
+ [Fact] public void AFormationPaysUpkeepFromItsGraduationMonth()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 4);
+ Assert.Equal(9.5m, f.Money);
+ f.Advance(0, 4); f.PayUpkeep(4);
+ f.Advance(0, 5); f.PayUpkeep(5);
+ Assert.Equal(9.5m, f.Money);
+ f.Advance(0, 6); f.PayUpkeep(6);
+ Assert.Equal(9.45m, f.Money);
+ f.PayUpkeep(7);
+ Assert.Equal(9.4m, f.Money); Assert.Equal(0m, f.Debt);
+ }
+
+ // R-UNIT-010 (docs/rules/mvp.md): "including a formation that graduated this turn"; 27M-8 (docs/GDD.md:374): "from the
+ // turn it graduates". A formation's upkeep starts at its graduation month even when the first PayUpkeep comes after the
+ // graduation but names an earlier month: that month charges nothing, and the graduation month pays.
+ [Fact] public void UpkeepForAMonthBeforeGraduationChargesNothing()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 4);
+ f.Advance(0, 4); f.Advance(0, 5); f.Advance(0, 6);
+ Assert.Equal(PopulationStatus.ActiveSoldier, s.PopulationLedger.Get(0).Status);
+ f.PayUpkeep(5);
+ Assert.Equal(9.5m, f.Money); Assert.Equal(0m, f.Debt);
+ f.PayUpkeep(6);
+ Assert.Equal(9.45m, f.Money);
+ }
+
+ // R-UNIT-010 (docs/rules/mvp.md): "IL 0.05m per formation per turn, independent of strength". A formation of three and
+ // a formation of one pay 0.05 each.
+ [Fact] public void UpkeepIsPerFormationNotPerSoldier()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0, 1, 2 }, CampNorth, 0);
+ f.Start(new[] { 5 }, CampSouth, 0);
+ foreach (var id in new[] { 0, 1, 2, 5 }) Graduate(f, id, 0);
+ Assert.Equal(8m, f.Money);
+ f.PayUpkeep(2);
+ Assert.Equal(7.9m, f.Money);
+ }
+
+ // #1699 body: "trainees and captured units pay none"; 53's maintainer call (not an owner ruling): only formations this
+ // fixture graduated pay. Trainees pay nothing, and the active soldier 8 of a formation this fixture did not make is not
+ // charged here.
+ [Fact] public void TraineesAndOtherFormationsPayNoUpkeep()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0, 1 }, CampNorth, 0);
+ f.Advance(0, 0); f.Advance(1, 0);
+ f.PayUpkeep(0);
+ Assert.Equal(9m, f.Money); Assert.Equal(0m, f.Debt);
+ Assert.Equal(PopulationStatus.ActiveSoldier, s.PopulationLedger.Get(8).Status);
+ }
+
+ // R-MONEY-003 (docs/rules/mvp.md): the Treasury stops at 0 and the shortfall is borrowed; R-UNIT-010: "R-MONEY-003
+ // borrows a shortfall; no strength is removed or Arms consumed for upkeep".
+ [Fact] public void UpkeepBorrowsTheShortfall()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, spare: 4, money: 0.52m);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ var ledger = s.Describe();
+ f.PayUpkeep(2);
+ Assert.Equal(0m, f.Money); Assert.Equal(0.03m, f.Debt);
+ Assert.Equal(3, f.SpareArms);
+ Assert.Equal(ledger, s.Describe());
+ }
+
+ // Each month's upkeep is paid once and never for an earlier month, like Advance's month ordinals.
+ [Fact] public void AMonthIsPaidOnceAndInOrder()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ f.PayUpkeep(3);
+ Unchanged(s, f, () => f.PayUpkeep(3), typeof(ArgumentException));
+ Unchanged(s, f, () => f.PayUpkeep(2), typeof(ArgumentException));
+ Unchanged(s, f, () => f.PayUpkeep(-1), typeof(ArgumentException));
+ Assert.Equal(9.45m, f.Money);
+ }
+
+ // 53's maintainer call (Q5, not an owner ruling): within a month the order is Advance, then PayUpkeep, so 27M-8 always
+ // holds. In that order the graduation month pays. A graduating Advance for a month whose upkeep already ran is a caller
+ // error: it is refused with nothing changed, and the trainee graduates in a later month, which then pays.
+ [Fact] public void AGraduationAfterThatMonthsUpkeepIsRefused()
+ {
+ var c = Catalogue(); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ f.Advance(0, 0); f.Advance(0, 1); f.Advance(0, 2);
+ f.PayUpkeep(2);
+ Assert.Equal(9.45m, f.Money);
+
+ var s2 = State(c); var f2 = Fixture(c, s2, money: 10m); var l = s2.PopulationLedger;
+ f2.Start(new[] { 0, 1 }, CampNorth, 0);
+ f2.Advance(0, 0); f2.Advance(0, 1); f2.Advance(1, 0);
+ f2.PayUpkeep(2);
+ Unchanged(s2, f2, () => f2.Advance(0, 2), typeof(ArgumentException));
+ Assert.Equal(PopulationStatus.Trainee, l.Get(0).Status);
+ f2.Advance(1, 2); // not graduating (course turn 2): allowed
+ Assert.Equal(2, l.Get(1).Assignment.ProgressTicks);
+ f2.Advance(0, 3);
+ Assert.Equal(PopulationStatus.ActiveSoldier, l.Get(0).Status);
+ f2.PayUpkeep(3);
+ Assert.Equal(8.95m, f2.Money);
+ }
+
+ // `military.active_money` is read from the catalogue, not a literal (a synthetic 0 and 0.2); a cost that cannot be
+ // represented throws before anything is written (R-MONEY-003, "a refused order changes nothing").
+ [Theory, InlineData("0"), InlineData("0.2")]
+ public void UpkeepReadsTheCatalogue(string rate)
+ {
+ var value = decimal.Parse(rate, CultureInfo.InvariantCulture);
+ var c = Catalogue("military.active_money", Agreed(value)); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ Graduate(f, 0, 0);
+ f.PayUpkeep(2);
+ Assert.Equal(9.5m - value, f.Money);
+ }
+
+ [Fact] public void AnUpkeepThatOverflowsChangesNothing()
+ {
+ var c = Catalogue("military.active_money", Agreed(decimal.MaxValue)); var s = State(c); var f = Fixture(c, s, money: 10m);
+ f.Start(new[] { 0 }, CampNorth, 0);
+ f.Start(new[] { 5 }, CampSouth, 0);
+ Graduate(f, 0, 0); Graduate(f, 5, 0);
+ Unchanged(s, f, () => f.PayUpkeep(2), typeof(OverflowException));
+ Assert.Equal(9m, f.Money); Assert.Equal(0m, f.Debt);
+ }
}
diff --git a/sim/Statecraft.Sim/Gdd03BasicTrainingFixture.cs b/sim/Statecraft.Sim/Gdd03BasicTrainingFixture.cs
index 4e3722929..10af0941f 100644
--- a/sim/Statecraft.Sim/Gdd03BasicTrainingFixture.cs
+++ b/sim/Statecraft.Sim/Gdd03BasicTrainingFixture.cs
@@ -21,34 +21,68 @@ namespace Statecraft.Sim
}
}
+ /// <summary>A synthetic formation supplied by a test: an ActiveService target already bound in the ledger fixture, and its
+ /// region. A cohort graduates into the first free pre-bound formation in deterministic order (owner ruling, 4 November
+ /// 2026, Q25: "do the recommended for all"; the chosen option read: "Allocate it to the first free pre-bound formation in
+ /// deterministic order"; https://github.com/eyalgolan/statecraft-israel/issues/1699#issuecomment-6623136049). Limiting
+ /// it to the camp's region, and what makes a formation free, are 53's maintainer calls, not owner rulings. The formations
+ /// are "pre-bound, empty ActiveService targets supplied by the tests; no ledger API change" (53's maintainer call,
+ /// 3 November 2026).</summary>
+ internal sealed class Gdd03FixtureFormation
+ {
+ internal string Id { get; }
+ internal string Region { get; }
+ internal Gdd03FixtureFormation(string id, string region)
+ {
+ if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(region))
+ throw new ArgumentException("A formation needs its own ActiveService target id and a region.");
+ PopulationText.ValidateText(id); PopulationText.ValidateText(region);
+ Id = id; Region = region;
+ }
+ }
+
/// <summary>#1699 first slice: a recruit's basic training starts on the #1689 population ledger and holds its issued
/// Arms (ARMS-1, ARMS-2, 27M-7, R-TRAIN-001, R-ARMS-003), synthetic fixtures only. No command, save, loader, resolver,
/// Food or UI caller. Like <see cref="Gdd03ProjectBuildFixture"/> it owns its spare Arms, Money and Debt, so the ledger
- /// never touches resources (R-POP-002). Completion into a formation is refused with a "Deferred:" NotSupportedException.
- /// Cancel returns an issued item to the spare Arms (R-TRAIN-002, R-ARMS-003, docs/GDD.md:372).</summary>
+ /// never touches resources (R-POP-002). Cancel returns an issued item to the spare Arms (R-TRAIN-002, R-ARMS-003,
+ /// docs/GDD.md:372). The last course turn graduates the record into its cohort's formation (R-TRAIN-003, R-UNIT-003), and
+ /// each formation it graduated pays upkeep from its graduation month (27M-8, R-UNIT-010).</summary>
internal sealed class Gdd03BasicTrainingFixture
{
/// <summary>Issued item ids are this prefix plus the population id. It is disjoint from the census and units_1948
/// source prefixes (<see cref="HistoricalPopulation.CensusPrefix"/>, <see cref="HistoricalPopulation.FormationPrefix"/>),
/// so no id can equal a starting formation's item; a record holds at most one military item, so no two records are issued the same id.</summary>
internal const string IssuedPrefix = "basic_training/";
- const string Completion = "Deferred: completing basic training into a formation (#1699; R-TRAIN-003, R-UNIT-003).";
const string CampLoss = "Deferred: a camp that stops operating during a course (#1699, 27M-9).";
readonly GameState state;
readonly SortedDictionary<string, Gdd03FixtureMilitaryCamp> camps = new SortedDictionary<string, Gdd03FixtureMilitaryCamp>(StringComparer.Ordinal);
readonly int capacity, basicTurns;
- readonly decimal moneyPerCourse;
+ readonly decimal moneyPerCourse, activeMoney;
+ // A graduate's military qualification: the course's unit class, content/unit_types.yaml `recruit` `class` (infantry).
+ // Value: the course's unit class (unit_types.yaml); maintainer call on the source of the value, not an owner ruling.
+ readonly string graduateQualification;
+ readonly SortedDictionary<string, Gdd03FixtureFormation> formations = new SortedDictionary<string, Gdd03FixtureFormation>(StringComparer.Ordinal);
// Per fixture instance only (not saved): each trainee's enrolment month and last counted month ordinal.
readonly SortedDictionary<int, (int enrolment, int lastCounted)> months = new SortedDictionary<int, (int, int)>();
// Per fixture instance only (not saved): the trainees whose item this fixture issued from its spare Arms.
readonly SortedSet<int> issued = new SortedSet<int>();
+ // Per fixture instance only (not saved). 53's maintainer call (not an owner ruling, 3 November 2026): one Start
+ // order is one cohort and graduates into one formation. Each current trainee's cohort, and each cohort's formation
+ // once its first member graduates.
+ readonly SortedDictionary<int, int> cohortOf = new SortedDictionary<int, int>();
+ readonly SortedDictionary<int, string> cohortFormation = new SortedDictionary<int, string>();
+ // Per fixture instance only (not saved): each claimed formation's graduation month, the month its first member
+ // graduated (27M-8, R-UNIT-010).
+ readonly SortedDictionary<string, int> graduationMonth = new SortedDictionary<string, int>(StringComparer.Ordinal);
+ int nextCohort;
+ int? lastPaidMonth;
internal int SpareArms { get; private set; }
internal decimal Money { get; private set; }
internal decimal Debt { get; private set; }
internal Gdd03BasicTrainingFixture(Content content, GameState state, IEnumerable<Gdd03FixtureMilitaryCamp> camps,
- int spareArms, decimal money)
+ IEnumerable<Gdd03FixtureFormation> formations, int spareArms, decimal money)
{
if (!content.UsesPopulationLedger || !state.UsesPopulationLedger || !state.PopulationLedger.IsInitialized)
throw new InvalidOperationException("Basic training requires an initialized gdd-0.3 synthetic fixture.");
@@ -58,10 +92,19 @@ namespace Statecraft.Sim
throw new ContentException(Gdd03BalanceCatalogue.FileName, "values.military.issue_arms", "must be 1: one item per population unit");
if (terms.RepeatIssueArms != 0)
throw new ContentException(Gdd03BalanceCatalogue.FileName, "values.military.repeat_issue", "must be 0: never a second issue");
+ var recruit = content.UnitTypes.FirstOrDefault(t => string.Equals(t.Id, "recruit", StringComparison.Ordinal));
+ if (recruit == null || string.IsNullOrWhiteSpace(recruit.Class))
+ throw new ContentException("unit_types.yaml", "types.recruit.class", "required: a basic training graduate's qualification");
+ PopulationText.ValidateText(recruit.Class);
if (spareArms < 0 || money < 0) throw new ArgumentException("Spare Arms and Money must be nonnegative.");
- this.state = state;
- capacity = terms.CampCapacity; basicTurns = terms.BasicTurns; moneyPerCourse = terms.TrainingMoney;
+ this.state = state; graduateQualification = recruit.Class;
+ capacity = terms.CampCapacity; basicTurns = terms.BasicTurns; moneyPerCourse = terms.TrainingMoney; activeMoney = terms.ActiveMoney;
foreach (var camp in camps) this.camps.Add(camp.Id, camp); // a duplicate id throws ArgumentException
+ foreach (var formation in formations)
+ {
+ if (this.camps.ContainsKey(formation.Id)) throw new ArgumentException("A formation cannot be a camp.");
+ this.formations.Add(formation.Id, formation); // a duplicate id throws ArgumentException
+ }
SpareArms = spareArms; Money = money;
ValidateInventory();
}
@@ -143,11 +186,13 @@ namespace Statecraft.Sim
Money -= paid; Debt = debt;
foreach (var p in recruits) months[p.Id] = (monthOrdinal, monthOrdinal - 1);
foreach (var p in recruits) if (p.Equipment.MilitaryId == null) issued.Add(p.Id);
+ foreach (var p in recruits) cohortOf[p.Id] = nextCohort;
+ nextCohort++;
}
/// <summary>R-TRAIN-001 "counting the turn it was ordered in": count one course turn a month ordinal, the enrolment
- /// month included, each ordinal once and never an earlier one. The turn that would reach <c>military.basic_turns</c>
- /// completes the course and is Deferred.</summary>
+ /// month included, each ordinal once and never an earlier one. The turn that reaches <c>military.basic_turns</c>
+ /// graduates the record (<see cref="Graduate"/>).</summary>
internal void Advance(int traineeId, int monthOrdinal)
{
ValidateInventory();
@@ -159,7 +204,7 @@ namespace Statecraft.Sim
if (monthOrdinal < known.enrolment || monthOrdinal <= known.lastCounted)
throw new ArgumentException("This month ordinal was already counted or is before enrolment.");
int progress = checked(trainee.Assignment.ProgressTicks + 1);
- if (progress >= basicTurns) throw new NotSupportedException(Completion);
+ if (progress >= basicTurns) { Graduate(trainee, camp, monthOrdinal); return; }
Commit(new[] { trainee.WithPlacement(trainee.Status, trainee.Location,
new PopulationAssignment(PopulationAssignmentKind.Course, camp.Id, progress), trainee.Captor, trainee.Home) });
months[traineeId] = (known.enrolment, monthOrdinal);
@@ -192,7 +237,64 @@ namespace Statecraft.Sim
Commit(new[] { person.WithPlacement(PopulationStatus.FreeCivilian, trainee.Location, PopulationAssignment.Unassigned,
trainee.Captor, trainee.Home) });
SpareArms = spare;
- issued.Remove(traineeId); months.Remove(traineeId);
+ issued.Remove(traineeId); months.Remove(traineeId); cohortOf.Remove(traineeId);
+ }
+
+ /// <summary>R-TRAIN-003 and R-UNIT-003 under gdd-0.3: the month that counts the last course turn releases the
+ /// trainee into its cohort's formation (Q43(b), "released in the turn its last course turn counts"). The same
+ /// record, in place (27M-7), becomes an active soldier serving that formation; it keeps its item, and nothing is
+ /// charged or refunded ("Its reserved Arms are neither charged again nor refunded on completion"). Its military
+ /// qualification becomes the course's unit class (docs/GDD.md:372: a returned captive "keeps their id and military
+ /// qualification"), so <see cref="Start"/> refuses it basic training again. Value: the course's unit class
+ /// (unit_types.yaml); maintainer call on the source of the value, not an owner ruling. The cohort's first graduate
+ /// claims the first free formation in deterministic order (owner ruling, 4 November 2026, Q25, #1699 comment
+ /// 6623136049). The camp's-region limit and what counts as free (supplied to this fixture, not claimed by another
+ /// cohort, and serving no one) are 53's maintainer call, not an owner ruling. A graduation in a month
+ /// whose upkeep was already paid is refused (53's maintainer call, not an owner ruling: Advance, then PayUpkeep, in a
+ /// month), so a formation always pays in its graduation month (27M-8).</summary>
+ void Graduate(PopulationUnit trainee, Gdd03FixtureMilitaryCamp camp, int monthOrdinal)
+ {
+ if (lastPaidMonth is int paid && monthOrdinal <= paid)
+ throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
+ "Upkeep was already paid for month {0}: graduate with Advance before that month's PayUpkeep (27M-8).", paid));
+ int cohort = cohortOf[trainee.Id];
+ if (!cohortFormation.TryGetValue(cohort, out var formation))
+ {
+ var ledger = state.PopulationLedger.Units;
+ formation = formations.Values.Where(f => string.Equals(f.Region, camp.Region, StringComparison.Ordinal)
+ && !cohortFormation.ContainsValue(f.Id)
+ && !ledger.Any(p => string.Equals(p.Assignment.Target, f.Id, StringComparison.Ordinal)))
+ .Select(f => f.Id).FirstOrDefault()
+ ?? throw new ArgumentException("No free formation in region " + camp.Region + " for this cohort.");
+ }
+ Commit(new[] { new PopulationUnit(trainee.Id, PopulationStatus.ActiveSoldier, trainee.ReceptionTicks, trainee.Location,
+ new PopulationAssignment(PopulationAssignmentKind.ActiveService, formation), trainee.Profession, trainee.Tier,
+ trainee.WorkXp, graduateQualification, trainee.CombatXp, trainee.Equipment, trainee.Captor, trainee.Home) });
+ if (!cohortFormation.ContainsKey(cohort)) graduationMonth.Add(formation, monthOrdinal);
+ cohortFormation[cohort] = formation;
+ months.Remove(trainee.Id); issued.Remove(trainee.Id); cohortOf.Remove(trainee.Id);
+ }
+
+ /// <summary>R-UNIT-010 under gdd-0.3, the fixture's step 7: each formation this fixture graduated that still has an
+ /// active soldier pays <c>military.active_money</c> once, independent of strength ("IL 0.05m per formation per
+ /// turn, independent of strength"), from its graduation month (27M-8: "A formation pays military upkeep from the
+ /// turn it graduates"; R-UNIT-010: "including a formation that graduated this turn"), so a month before a
+ /// formation's graduation month charges it nothing. Trainees pay none. Only this fixture's formations count (53's
+ /// maintainer call, not an owner ruling); it owns its Money. The shortfall is borrowed (R-MONEY-003); no Arms or
+ /// strength change. Each month ordinal is paid once and never an earlier one; the cost is computed before any
+ /// write.</summary>
+ internal void PayUpkeep(int monthOrdinal)
+ {
+ ValidateInventory();
+ if (monthOrdinal < 0) throw new ArgumentException("The month ordinal must be nonnegative.");
+ if (lastPaidMonth is int paid && monthOrdinal <= paid)
+ throw new ArgumentException("This month's upkeep was already paid, or the month is before the last one paid.");
+ var serving = new HashSet<string>(state.PopulationLedger.Units
+ .Where(p => p.Status == PopulationStatus.ActiveSoldier).Select(p => p.Assignment.Target!), StringComparer.Ordinal);
+ int count = cohortFormation.Values.Count(f => serving.Contains(f) && graduationMonth[f] <= monthOrdinal);
+ decimal cost = activeMoney * count;
+ decimal paidNow = Math.Min(Money, cost), debt = Debt + (cost - paidNow);
+ Money -= paidNow; Debt = debt; lastPaidMonth = monthOrdinal;
}
}
}