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.

Map: ma'abarot at the town's edge, clear only of the tokens of their time (refs #32) (#646)

Eyal Golan2c80bbc95dc9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4c040d21f..c53d9d94c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -391,6 +391,15 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
hill houses that stand on a slope. A village keeps its mosque, now a one-storey hall with a short square minaret; the
domed mosque with its tall minaret stays with the Arab towns. The median Arab locality draws 11 houses (main 5), in
the same merged tile meshes (64 draws). Presentation only (`docs/visual-v1.md`, "Arab villages: dense, terraced cores").
+- Map: the ma'abara kit (Beri's, #557; refs #32) stands at a town's edge, keeps clear only of the unit tokens present in
+ its time, and is never smaller than a camp. A camp's centre is now looked for on rings 450 m apart, not 1.8 km, so
+ Degania Alef's camp finds the free ground at the town's edge and is a kit, not a box. A camp keeps off only the unit
+ tokens whose window runs to its own date or later (owner, 15 October 2026: "Yes, date-aware"). Camps are built from
+ 1950, so Rosh Pinna's camp is 15 tents and 3 huts again, not the box the 1948 Operation Brosh token left it. A camp
+ has at least 6 plots, one of them a hut, or its search goes on further out in its hex, and it is its box only if
+ nowhere in the hex has room (owner, 15 October 2026: "Yes, min 6 plots + a hut"). Gaza's edge has room for 4 tents
+ only, so it stays a box. Built on 26 August 1950: 17 camps of 25 are kits (was 15), and Ein Harod's is smaller (6
+ tents and 2 huts, was 10 and 2). Every structure still stands wholly inside its hex. No golden moves.
- The map's region files (the 1948 sub-districts, the 1949 armistice lines, the 1948-49 control areas) are read
from baked runtime forms at boot instead of being parsed as YAML (`tools/regions_bake.py`, refs #321), as the
localities and the route paths are. The sub-districts are read once, for the camps and the region layers. A stale,
diff --git a/unity/Assets/Scripts/Map/Kits/KitGround.cs b/unity/Assets/Scripts/Map/Kits/KitGround.cs
index 43d7e03bf..358b83c62 100644
--- a/unity/Assets/Scripts/Map/Kits/KitGround.cs
+++ b/unity/Assets/Scripts/Map/Kits/KitGround.cs
@@ -218,6 +218,21 @@ namespace Statecraft.Game.Map.Kits
return false;
}
+ /// <summary>The unit tokens outside the towns with the day each one's window ends (exclusive; MapScene.UnitTokens), for
+ /// the transit camps built later (PlacementLayer.CampGround): a camp keeps off only those still present on or after
+ /// its own date (T67, owner 15 October 2026: "Yes, date-aware").</summary>
+ public readonly List<(Vector2 centre, float radius, System.DateTime until)> DatedTokens = new List<(Vector2, float, System.DateTime)>();
+
+ /// <summary>As <see cref="OnToken(Vector2, float)"/>, also reaching a dated token whose window ends after
+ /// <paramref name="from"/>: one present on that day or later.</summary>
+ public bool OnToken(Vector2 p, float r, System.DateTime from)
+ {
+ if (OnToken(p, r)) return true;
+ foreach (var (c, tr, until) in DatedTokens)
+ if (until > from && (p - c).sqrMagnitude < (tr + r) * (tr + r)) return true;
+ return false;
+ }
+
/// <summary>True when a disc of radius <paramref name="r"/> at <paramref name="p"/> reaches into any route corridor.</summary>
public bool OnRoute(Vector2 p, float r)
{
diff --git a/unity/Assets/Scripts/Map/Kits/SettlementKits.Maabara.cs b/unity/Assets/Scripts/Map/Kits/SettlementKits.Maabara.cs
index 888188e9c..bf62b1cc6 100644
--- a/unity/Assets/Scripts/Map/Kits/SettlementKits.Maabara.cs
+++ b/unity/Assets/Scripts/Map/Kits/SettlementKits.Maabara.cs
@@ -22,6 +22,11 @@ namespace Statecraft.Game.Map.Kits
const int MaabaraCols = 5, MaabaraRows = 4;
const float MaabaraPitchU = 8f, MaabaraPitchV = 9f, MaabaraPlotR = 4f;
+ /// <summary>The fewest plots a ma'abara is drawn with, one of them a hut (owner, 15 October 2026: "Yes, min 6 plots + a
+ /// hut"): fewer reads as a few sheds, not a camp, so the search goes on and the camp is its box if nowhere in its hex
+ /// has room.</summary>
+ public const int MaabaraMinPlots = 6;
+
/// <summary>How far (house-scale metres) a ma'abara reaches from its centre: the communal hut past the last column
/// (30 along, 9 to a side) and the rows' half width, rounded up.</summary>
public const float MaabaraReach = 36f;
@@ -30,18 +35,19 @@ namespace Statecraft.Game.Map.Kits
/// the hex grid's edge marks and on steep ground, so a test can show those rules refuse a plot (review #557).</summary>
internal static bool MaabaraGroundRules = true;
- /// <summary>Builds one ma'abara per entry of <paramref name="camps"/> (seed id, the centre of its hex in world x, z), in
- /// order, on one lot list so no two overlap: a mesh in world space (null when no free ground was found in the camp's
- /// own hex), the tents and huts it holds (the communal hut and the water tower not counted) and its centre.</summary>
- public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at)> camps, KitGround ground,
- float hutShare = MaabaraHutShare)
+ /// <summary>Builds one ma'abara per entry of <paramref name="camps"/> (seed id, the centre of its hex in world x, z, the
+ /// day it was built), in order, on one lot list so no two overlap: a mesh in world space (null when no free ground was
+ /// found in the camp's own hex), the tents and huts it holds (the communal hut and the water tower not counted) and its
+ /// centre. A camp keeps off the unit tokens present on or after its own day (KitGround.OnToken with a date; T67).</summary>
+ public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at, System.DateTime from)> camps,
+ KitGround ground, float hutShare = MaabaraHutShare)
{
var lots = new Lots();
var result = new List<(Mesh?, int, int, Vector2)>();
- foreach (var (id, at) in camps)
+ foreach (var (id, at, from) in camps)
{
var km = new KitMesh();
- var (tents, huts, c) = Maabara(id, at, ground, km, lots, hutShare);
+ var (tents, huts, c) = Maabara(id, at, from, ground, km, lots, hutShare);
result.Add((km.VertexCount > 0 ? km.ToMesh(id + "_kit") : null, tents, huts, c));
}
return result;
@@ -49,47 +55,86 @@ namespace Statecraft.Game.Map.Kits
/// <summary>As Maabarot, also listing everything placed (<see cref="Placed"/>: "tent", "hut", "communal_hut",
/// "water_tower"), in placement order.</summary>
- public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at)> camps, KitGround ground,
- out List<Placed> placed, float hutShare = MaabaraHutShare)
+ public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at, System.DateTime from)> camps,
+ KitGround ground, out List<Placed> placed, float hutShare = MaabaraHutShare)
{
census = placed = new List<Placed>();
try { return Maabarot(camps, ground, hutShare); }
finally { census = null; }
}
- static (int tents, int huts, Vector2 at) Maabara(string id, Vector2 hexCentre, KitGround ground, KitMesh km, Lots lots, float hutShare)
+ /// <summary>As Maabarot, for camps with no date: each keeps off every unit token, dated or not.</summary>
+ public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at)> camps, KitGround ground,
+ float hutShare = MaabaraHutShare) => Maabarot(Undated(camps), ground, hutShare);
+
+ /// <summary>As Maabarot with <paramref name="placed"/>, for camps with no date: each keeps off every unit token.</summary>
+ public static List<(Mesh? mesh, int tents, int huts, Vector2 at)> Maabarot(IReadOnlyList<(string id, Vector2 at)> camps, KitGround ground,
+ out List<Placed> placed, float hutShare = MaabaraHutShare) => Maabarot(Undated(camps), ground, out placed, hutShare);
+
+ static List<(string id, Vector2 at, System.DateTime from)> Undated(IReadOnlyList<(string id, Vector2 at)> camps)
+ {
+ var list = new List<(string, Vector2, System.DateTime)>(camps.Count);
+ foreach (var (id, at) in camps) list.Add((id, at, System.DateTime.MinValue));
+ return list;
+ }
+
+ static (int tents, int huts, Vector2 at) Maabara(string id, Vector2 hexCentre, System.DateTime from, KitGround ground, KitMesh km, Lots lots,
+ float hutShare)
{
- float m = KitScale.Houses;
- if (!MaabaraSpot(hexCentre, MaabaraReach * m, ground, lots, out var c)) return (0, 0, c);
+ float m = KitScale.Houses, plotR = MaabaraPlotR * m;
var rnd = new KitRandom(id, 1);
float yaw = rnd.Range(0f, 90f), a = yaw * Mathf.Deg2Rad, ca = Mathf.Cos(a), sa = Mathf.Sin(a);
- Vector2 At(float u, float v) => c + new Vector2(u * ca - v * sa, u * sa + v * ca);
- // As the Bedouin camps' tents (Encampments): off the routes and the units' clearings, the unit tokens, the hex
- // grid's edge marks and steep ground. Each tent, hut, the communal hut and the water tower's spot stands in the
- // camp's own hex, not only its centre (review #557): the rows reach about 1.6 km from the centre at the house
- // scale, the communal hut about 3 km, against the hex's 4.33 km inradius.
+ Vector2 Turn(float u, float v) => new Vector2(u * ca - v * sa, u * sa + v * ca);
+ // As the Bedouin camps' tents (Encampments): off the routes and the units' clearings, the unit tokens (those present
+ // on or after the camp's own date, T67), the hex grid's edge marks and steep ground. Each tent, hut, the communal
+ // hut and the water tower's spot stands in the camp's own hex, not only its centre (review #557): the rows reach
+ // about 1.6 km from the centre at the house scale, the communal hut about 3 km, against the hex's 4.33 km inradius.
// The whole disc of radius r, not only its centre (review #557, c9): r is at least the half-width of what stands
// there, so nothing overhangs the hex's edge (HexGrid.EdgeDistance: the drawn grid's own distance field).
var hex = ground.Hex(hexCentre.x, hexCentre.y);
bool InHex(Vector2 p, float r) => ground.Hex(p.x, p.y) == hex
&& HexGrid.EdgeDistance(HexGrid.FromWorld(new Vector3(p.x, 0f, p.y), ground.TerrainOrigin, ground.Length), ground.HexSizeM) >= r;
bool Free(Vector2 p, float r) => ground.Inside(p.x, p.y) && InHex(p, r) && !ground.Water(p.x, p.y) && OffTowns(p, r, ground)
- && !ground.OnRoute(p, r) && !ground.OnToken(p, r)
+ && !ground.OnRoute(p, r) && !ground.OnToken(p, r, from)
&& (!MaabaraGroundRules || (!ground.OnGridMark(p, r) && ground.Slope(p.x, p.y, 600f) <= 0.12f)) && lots.Free(p, r, id, 0);
// Huts at an even spread over the plots (a golden-ratio sequence from a seeded phase), not a coin per plot: the
- // camp shows the share asked for, not a lucky draw of it.
+ // camp shows the share asked for, not a lucky draw of it. Drawn before the camp's spot is chosen; the spot draws
+ // nothing, so the stream is the one the camp always had (yaw, then phase).
float phase = rnd.Value();
+ bool HutPlot(int k, float share) => Mathf.Repeat(phase + k * 0.618034f, 1f) < share;
+ // A plot's centre round a camp centre: the grid turned by the yaw, pegged by eye (the first two draws of the
+ // plot's wear stream, as the build below takes them).
+ Vector2 PlotAt(Vector2 centre, int i, int j, int k)
+ {
+ var w = new KitRandom(id, 100UL + (ulong)k);
+ return centre + Turn((i - (MaabaraCols - 1) * 0.5f) * MaabaraPitchU * m, (j - (MaabaraRows - 1) * 0.5f) * MaabaraPitchV * m)
+ + new Vector2(w.Range(-0.4f, 0.4f), w.Range(-0.4f, 0.4f)) * m;
+ }
+ // Owner, 15 October 2026 ("Yes, min 6 plots + a hut"): a camp is at least MaabaraMinPlots free plots, one of them a
+ // hut, or the search goes on, further out in the hex. The hut is counted at the 1950-51 share
+ // (MaabaraHutShare), not the share asked for, so the share still changes what a plot holds, never where the
+ // camp stands. A camp's own lots never block each other (Lots.Free: the same id and group), so this dry run
+ // frees exactly the plots the build below fills.
+ bool Roomy(Vector2 centre)
+ {
+ int free = 0; bool hut = false;
+ for (int j = 0, k = 0; j < MaabaraRows; j++)
+ for (int i = 0; i < MaabaraCols; i++, k++)
+ if (Free(PlotAt(centre, i, j, k), plotR)) { free++; hut |= HutPlot(k, MaabaraHutShare); }
+ return free >= MaabaraMinPlots && hut;
+ }
+ if (!MaabaraSpot(hexCentre, MaabaraReach * m, from, ground, lots, Roomy, out var c)) return (0, 0, c);
+ Vector2 At(float u, float v) => c + Turn(u, v);
int tents = 0, huts = 0, plot = 0;
- float plotR = MaabaraPlotR * m;
for (int j = 0; j < MaabaraRows; j++)
for (int i = 0; i < MaabaraCols; i++, plot++)
{
- bool hut = Mathf.Repeat(phase + plot * 0.618034f, 1f) < hutShare;
+ bool hut = HutPlot(plot, hutShare);
// Wear (sag, creases, stains, washing) draws from its own stream per plot, so the layout stream above is
// the one the camp always had and the hut share still changes what a plot holds, never which plots.
var wear = new KitRandom(id, 100UL + (ulong)plot);
var p = At((i - (MaabaraCols - 1) * 0.5f) * MaabaraPitchU * m, (j - (MaabaraRows - 1) * 0.5f) * MaabaraPitchV * m)
- + new Vector2(wear.Range(-0.4f, 0.4f), wear.Range(-0.4f, 0.4f)) * m; // pegged by eye: the grid reads, not ruled
+ + new Vector2(wear.Range(-0.4f, 0.4f), wear.Range(-0.4f, 0.4f)) * m; // pegged by eye: the grid reads, not ruled (PlotAt)
float pyaw = yaw + rnd.Range(-3f, 3f); // pitched by hand: straight rows, not ruled ones
if (!Free(p, plotR)) continue;
lots.Add(new Lot { c = p, r = plotR, id = id, group = 0 });
@@ -156,7 +201,7 @@ namespace Statecraft.Game.Map.Kits
// tests water, lots and routes but not slope or grid marks, so the spot its Claim (4 m) will take is found first on
// a copy of the lots and must be Free as a tent's is (review #557).
var tower = At(-((MaabaraCols - 1) * 0.5f * MaabaraPitchU + 10f) * m, 0f);
- if (rnd.Chance(0.5f) && OffTowns(tower, 20f * m, ground) && !ground.OnToken(tower, 20f * m))
+ if (rnd.Chance(0.5f) && OffTowns(tower, 20f * m, ground) && !ground.OnToken(tower, 20f * m, from))
{
var probe = new Lots();
foreach (var l in lots.List) probe.Add(l);
@@ -467,15 +512,20 @@ namespace Statecraft.Game.Map.Kits
}
}
- /// <summary>The camp's centre: the dry spot nearest <paramref name="want"/> (rings of half a reach) in the hex
+ /// <summary>The camp's centre: the dry spot nearest <paramref name="want"/> (rings an eighth of a reach apart) in the hex
/// <paramref name="want"/> stands in, whose inner half stays off every town's plots, that is gentle and whose whole
- /// reach is clear of the unit tokens (Encampments' tests) and of the camps built before it. The player picks the hex,
+ /// reach is clear of the unit tokens present on or after <paramref name="from"/> (Encampments' tests; T67) and of the
+ /// camps built before it, and that is <paramref name="roomy"/> (the owner's minimum camp). The player picks the hex,
/// so the camp stands in it, where selection and the info panel point (review #557). False when there is none: the
/// camp is then drawn as its box.</summary>
- static bool MaabaraSpot(Vector2 want, float reach, KitGround ground, Lots lots, out Vector2 at)
+ static bool MaabaraSpot(Vector2 want, float reach, System.DateTime from, KitGround ground, Lots lots, System.Func<Vector2, bool> roomy,
+ out Vector2 at)
{
- // From any point of a hex the whole hex lies within two circumradii.
- float step = reach * 0.5f, max = 2f * ground.HexSizeM;
+ // From any point of a hex the whole hex lies within two circumradii. The rings are an eighth of a reach apart (450 m
+ // at the house scale), not half of one (1.8 km): the ma'abarot stood at the edges of the towns (T67, issue #32), and
+ // in the big towns' hexes the free ground at a town's edge fell between the coarse rings, so the camp was its box.
+ // The inner half that must stay off the towns is unchanged.
+ float step = reach * 0.125f, clear = reach * 0.5f, max = 2f * ground.HexSizeM;
var hex = ground.Hex(want.x, want.y);
for (int ring = 0; ring * step <= max; ring++)
{
@@ -484,8 +534,8 @@ namespace Statecraft.Game.Map.Kits
{
float a = 2f * Mathf.PI * k / around;
var p = want + new Vector2(Mathf.Cos(a), Mathf.Sin(a)) * (ring * step);
- if (!ground.Inside(p.x, p.y) || ground.Hex(p.x, p.y) != hex || ground.Water(p.x, p.y) || !OffTowns(p, step, ground) || ground.Slope(p.x, p.y, 600f) > 0.12f
- || ground.OnToken(p, reach) || !lots.Free(p, reach)) continue;
+ if (!ground.Inside(p.x, p.y) || ground.Hex(p.x, p.y) != hex || ground.Water(p.x, p.y) || !OffTowns(p, clear, ground) || ground.Slope(p.x, p.y, 600f) > 0.12f
+ || ground.OnToken(p, reach, from) || !lots.Free(p, reach) || !roomy(p)) continue;
at = p; return true;
}
}
diff --git a/unity/Assets/Scripts/Map/MapScene.cs b/unity/Assets/Scripts/Map/MapScene.cs
index 33b8523c3..081fa7c44 100644
--- a/unity/Assets/Scripts/Map/MapScene.cs
+++ b/unity/Assets/Scripts/Map/MapScene.cs
@@ -211,8 +211,10 @@ namespace Statecraft.Game.Map
public IReadOnlyList<(Vector2 centre, float radius)> UnitClearings { get; private set; } = new List<(Vector2, float)>();
/// <summary>The unit tokens that stand outside the towns (centre x, z; ring radius m), as the kits get them
- /// (KitGround.Tokens): the transit camps PlacementLayer builds later keep off them too. Empty before Build.</summary>
- public IReadOnlyList<(Vector2 centre, float radius)> UnitTokens { get; private set; } = new List<(Vector2, float)>();
+ /// (KitGround.Tokens), with the day the token's window ends (its anchor's `to`, exclusive): the transit camps
+ /// PlacementLayer builds later keep off those still present on the camp's date (KitGround.DatedTokens). Empty before
+ /// Build.</summary>
+ public IReadOnlyList<(Vector2 centre, float radius, DateTime until)> UnitTokens { get; private set; } = new List<(Vector2, float, DateTime)>();
/// <summary>The last Build's kit numbers (buildings, vertices, trees, build time), or null without kits.</summary>
public Kits.KitLayer.Stats KitStats { get; private set; }
@@ -345,6 +347,7 @@ namespace Statecraft.Game.Map
(lon, lat) => { var w = Frame.ToWorld(lon, lat, 0); return new Vector2(w.x, w.z); }, hexSizeM);
var clearings = new List<(Vector2 centre, float radius)>();
var unitRings = new List<(Vector2 centre, float radius)>();
+ var datedRings = new List<(Vector2 centre, float radius, DateTime until)>();
// The units' showcase trio gets the same clearing at its spot, off the railways and roads, so its base stands
// clear of the kits (review of #559).
if (ShowcaseClearing ?? Units.UnitShowcase.Requested()) clearings.Add(Units.UnitShowcase.Clearing(this));
@@ -356,12 +359,16 @@ namespace Statecraft.Game.Map
{
var c = new Vector2((float)kv.Value.X, (float)kv.Value.Z);
if (kv.Value.InTown && !clearings.Exists(x => x.centre == c)) clearings.Add((c, unitGround.ClearingRadius));
- else if (!kv.Value.InTown) unitRings.Add((c, unitGround.RingRadius(kv.Value.Compact)));
+ else if (!kv.Value.InTown)
+ {
+ unitRings.Add((c, unitGround.RingRadius(kv.Value.Compact)));
+ datedRings.Add((c, unitGround.RingRadius(kv.Value.Compact), Units.UnitData.Day(kv.Key.To)));
+ }
}
}
UnitClearings = clearings;
DiagLog.BootPhase("units placed"); // issue #321: the routes' corridors, the footprints and the unit spots
- UnitTokens = unitRings;
+ UnitTokens = datedRings;
if (kitsOn)
{
// ?kitscale=, ?housescale=, ?treescale= in the WebGL player: the same layout at another symbolic scale (city
diff --git a/unity/Assets/Scripts/Map/PlacementLayer.cs b/unity/Assets/Scripts/Map/PlacementLayer.cs
index 9b40ced63..584ea2438 100644
--- a/unity/Assets/Scripts/Map/PlacementLayer.cs
+++ b/unity/Assets/Scripts/Map/PlacementLayer.cs
@@ -74,13 +74,13 @@ namespace Statecraft.Game.Map
/// and water tower stands on (the disc round it) to <paramref name="holes"/>.</summary>
HashSet<string> Camps(List<Placement> list, Content content, MapScene map, List<(Vector2 centre, float radius)> holes)
{
- var camps = new List<(string id, Vector2 at)>();
+ var camps = new List<(string id, Vector2 at, System.DateTime from)>();
foreach (var p in list)
{
var hex = p.Action == MapActions.TransitCamp ? content.HexAt(p.Q, p.R) : null;
if (hex == null) continue;
var w = map.Frame.ToWorld(hex.Lon, hex.Lat, 0);
- camps.Add(($"{p.Action}_{p.Q}_{p.R}", new Vector2(w.x, w.z)));
+ camps.Add(($"{p.Action}_{p.Q}_{p.R}", new Vector2(w.x, w.z), p.Date));
}
var drawn = new HashSet<string>();
if (camps.Count == 0) return drawn;
@@ -103,15 +103,16 @@ namespace Statecraft.Game.Map
}
/// <summary>The ground a camp is built on: the map's terrain with every kit's footprint (towns, 1948 localities,
- /// Bedouin camps: MapScene.KitFootprints), the railways' and roads' corridors and the units' clearings and tokens (as
- /// KitLayer.Build is given them), so a camp keeps off all of them.</summary>
+ /// Bedouin camps: MapScene.KitFootprints), the railways' and roads' corridors and the units' clearings (as KitLayer.Build
+ /// is given them), so a camp keeps off all of them, and the units' tokens with their dates, so a camp keeps off those
+ /// present on or after its own date (KitGround.DatedTokens; T67, owner 15 October 2026: "Yes, date-aware").</summary>
internal static KitGround CampGround(MapScene map)
{
var ground = new KitGround(map.Terrain, map.Frame, map.Hexes, map.ElevMinM);
foreach (var f in map.KitFootprints) ground.Footprints.Add(f);
foreach (var (line, half) in map.RouteCorridors) ground.AddCorridor(line, half);
foreach (var c in map.UnitClearings) ground.AddCorridor(new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius);
- ground.Tokens.AddRange(map.UnitTokens);
+ ground.DatedTokens.AddRange(map.UnitTokens);
return ground;
}
}
diff --git a/unity/Assets/Tests/EditMode/KitTests.cs b/unity/Assets/Tests/EditMode/KitTests.cs
index 1775f5ccd..712022c4b 100644
--- a/unity/Assets/Tests/EditMode/KitTests.cs
+++ b/unity/Assets/Tests/EditMode/KitTests.cs
@@ -665,7 +665,7 @@ public class KitTests
/// <summary>Review (issue #32): the trees planted at map build do not stand in a ma'abara built later. While the camp's kit
/// is drawn no tree drawn has its crown on the camp's ground (the disc round each tent, hut, communal hut and water
/// tower); housing in its place, or the kits off (the camp is its box), gives them back. Safed's camp lands among the
- /// hill olives (it was Rosh Pinna's until main's units file left that hex no ground for a camp: see
+ /// hill olives (it was Rosh Pinna's until main's units file left that hex no ground for a camp with no date: see
/// AMaabaraKeepsOffTokensGridMarksAndSteepGround).</summary>
[Test]
public void NoTreeStandsInAMaabara()
@@ -705,7 +705,9 @@ public class KitTests
/// on a unit token, on a hex edge's grid mark or on steep ground, so a token on the camp's own hex moves it off. Safed's
/// camp stands on hilly ground by a hex edge, where those rules refuse plots a build without them fills (review #557: on
/// flat Revivim the test passed with the rules removed). It was Rosh Pinna until main's units file placed Carmeli's
- /// Operation Brosh token beside it (July 1948), whose ring leaves the camp no ground in that hex, so it is a box there.</summary>
+ /// Operation Brosh token beside it (July 1948), whose ring leaves a camp with no date no ground in that hex, so it is
+ /// a box there. A camp of 1950 keeps off only the tokens present from its date
+ /// (RoshPinnasCampOf1950IsAKitOfTentsAndHutsAgain).</summary>
[Test]
public void AMaabaraKeepsOffTokensGridMarksAndSteepGround()
{
@@ -741,7 +743,9 @@ public class KitTests
/// <summary>Review #557: a camp stands in the hex the player built it on, where selection and the info panel point. Over
/// the settlement hexes each camp's centre and the whole footprint of every structure it places (tents, huts, the
/// communal hut, the water tower) map back to its own hex, or the camp has no kit and is drawn as its box. Its
- /// tents, huts and water tower keep off the grid marks and steep ground (the water tower too: review #557, should-fix 3).</summary>
+ /// tents, huts and water tower keep off the grid marks and steep ground (the water tower too: review #557, should-fix 3).
+ /// The camps are built on 26 August 1950, as the game builds them (date-aware tokens, T67), and each kit has the owner's
+ /// minimum: SettlementKits.MaabaraMinPlots plots, one of them a hut.</summary>
[Test]
public void AMaabaraStandsInItsOwnHex()
{
@@ -754,11 +758,15 @@ public class KitTests
foreach (var hex in c.SettlementHexes)
{
var at = c.HexAt(hex.Q, hex.R)!; var w = map.Frame.ToWorld(at.Lon, at.Lat, 0);
- var camp = new List<(string id, Vector2 at)> { ($"{Statecraft.Sim.MapActions.TransitCamp}_{hex.Q}_{hex.R}", new Vector2(w.x, w.z)) };
+ var camp = new List<(string id, Vector2 at, System.DateTime from)>
+ { ($"{Statecraft.Sim.MapActions.TransitCamp}_{hex.Q}_{hex.R}", new Vector2(w.x, w.z), new System.DateTime(1950, 8, 26)) };
var built = SettlementKits.Maabarot(camp, g, out var placed)[0];
if (built.mesh == null) { boxes.Add(hex.Id); continue; }
kits++;
Object.DestroyImmediate(built.mesh);
+ TestContext.WriteLine($"{hex.Id}: {built.tents} tents, {built.huts} huts, {placed.Count} structures, {(built.at - new Vector2(w.x, w.z)).magnitude:F0} m from the hex centre");
+ Assert.GreaterOrEqual(built.tents + built.huts, SettlementKits.MaabaraMinPlots, hex.Id + "'s camp has the owner's minimum of plots");
+ Assert.Greater(built.huts, 0, hex.Id + "'s camp has a hut");
(int, int) HexOf(Vector2 p)
{
var (lon, lat) = map.Frame.ToLonLat(new Vector3(p.x, 0f, p.y));
@@ -792,6 +800,117 @@ public class KitTests
Assert.Greater(kits, 0, "some camp finds ground in its own hex");
}
+ /// <summary>A transit camp the player builds on <paramref name="id"/>'s hex on 26 August 1950, rendered by a placement
+ /// layer: whether it is drawn as its kit (Kit.mat) rather than its marker box.</summary>
+ static bool DrawnAsKit(MapScene map, Statecraft.Sim.Content c, string id)
+ {
+ var hex = c.SettlementHexes.Single(s => s.Id == id);
+ var layer = new GameObject("Placements").AddComponent<PlacementLayer>();
+ layer.Render(new[] { new Statecraft.Sim.Placement(Statecraft.Sim.MapActions.TransitCamp, hex.Q, hex.R, new System.DateTime(1950, 8, 26)) }, c, map);
+ bool kit = layer.transform.GetChild(0).GetComponent<MeshRenderer>().sharedMaterial == AssetDatabase.LoadAssetAtPath<Material>("Assets/Materials/Kit.mat");
+ layer.Render(new Statecraft.Sim.Placement[0], c, map); // frees the camp's mesh
+ Object.DestroyImmediate(layer.gameObject);
+ return kit;
+ }
+
+ /// <summary>The centre of <paramref name="id"/>'s hex on the ground plane (world x, z), where PlacementLayer asks for the
+ /// camp the player builds on it.</summary>
+ static Vector2 HexCentre(MapScene map, Statecraft.Sim.Content c, string id)
+ {
+ var hex = c.SettlementHexes.Single(s => s.Id == id);
+ var at = c.HexAt(hex.Q, hex.R)!; var w = map.Frame.ToWorld(at.Lon, at.Lat, 0);
+ return new Vector2(w.x, w.z);
+ }
+
+ /// <summary>T67 (owner, 15 October 2026: "Yes, date-aware"): a camp keeps clear only of the unit tokens present while it
+ /// stands, from its own date on. Camps are built from 1950, and Carmeli's Operation Brosh token by Rosh Pinna stands
+ /// 9-18 July 1948 only (content/map/units_1948.yaml), so Rosh Pinna's camp of 1950 is a kit of tents and huts again, on
+ /// its hex's centre. With no date it keeps off that 1948 token too: then it is a box with the coarse rings, or a few
+ /// tents at the hex's far side with the fine ones.</summary>
+ [Test]
+ public void RoshPinnasCampOf1950IsAKitOfTentsAndHutsAgain()
+ {
+ var map = OpenMap();
+ var c = Statecraft.Sim.ContentLoader.Load(Statecraft.Game.Paths.Content);
+ Assert.IsTrue(DrawnAsKit(map, c, "rosh_pinna"), "Rosh Pinna's camp of 1950 is drawn as its kit");
+ var at = HexCentre(map, c, "rosh_pinna");
+ var g = PlacementLayer.CampGround(map);
+ var built = SettlementKits.Maabarot(new List<(string id, Vector2 at, System.DateTime from)> { ("transit_camp_rosh_pinna", at, new System.DateTime(1950, 8, 26)) }, g)[0];
+ var undated = SettlementKits.Maabarot(new List<(string id, Vector2 at)> { ("transit_camp_rosh_pinna", at) }, g)[0];
+ TestContext.WriteLine($"1950: {built.tents} tents, {built.huts} huts, {(built.at - at).magnitude:F0} m from the hex centre; "
+ + $"no date: {undated.tents} tents, {undated.huts} huts, {(undated.at - at).magnitude:F0} m");
+ foreach (var k in new[] { built, undated }) if (k.mesh != null) Object.DestroyImmediate(k.mesh);
+ Assert.Greater(built.tents, 0, "tents"); Assert.Greater(built.huts, 0, "and huts");
+ Assert.Less(undated.tents + undated.huts, built.tents + built.huts, "with no date the 1948 token still takes the camp's ground");
+ }
+
+ /// <summary>T67: a token present on the camp's date still moves every tent, hut, communal hut and water tower off its ring;
+ /// one whose window ended before that date, on the same spot, changes nothing.</summary>
+ [Test]
+ public void ACampKeepsClearOfTheTokensPresentAtItsDate()
+ {
+ var map = OpenMap();
+ var c = Statecraft.Sim.ContentLoader.Load(Statecraft.Game.Paths.Content);
+ var g = PlacementLayer.CampGround(map);
+ var camp = new List<(string id, Vector2 at, System.DateTime from)> { ("transit_camp_rosh_pinna", HexCentre(map, c, "rosh_pinna"), new System.DateTime(1950, 8, 26)) };
+ var built = SettlementKits.Maabarot(camp, g)[0];
+ Assert.IsNotNull(built.mesh, "Rosh Pinna's camp of 1950 is a kit"); Object.DestroyImmediate(built.mesh);
+ float lot = 4f * KitScale.Houses; // a plot's lot (SettlementKits.MaabaraPlotR)
+ var token = built.at + new Vector2(lot, 0f); // on the camp's own ground
+ g.DatedTokens.Add((token, 300f, new System.DateTime(1949, 1, 1)));
+ var past = SettlementKits.Maabarot(camp, g)[0];
+ Assert.AreEqual((built.tents, built.huts, built.at), (past.tents, past.huts, past.at), "a token gone before the camp's date changes nothing");
+ if (past.mesh != null) Object.DestroyImmediate(past.mesh);
+
+ g.DatedTokens.Add((token, 300f, new System.DateTime(1951, 1, 1)));
+ var moved = SettlementKits.Maabarot(camp, g, out var clear)[0];
+ if (moved.mesh != null) Object.DestroyImmediate(moved.mesh);
+ TestContext.WriteLine($"with a token present in 1950: {moved.tents} tents, {moved.huts} huts, {clear.Count} structures");
+ Assert.AreNotEqual(built.at, moved.at, "the token present in 1950 moved the camp");
+ Assert.Greater(clear.Count, 0, "the camp found other ground");
+ foreach (var p in clear)
+ Assert.Greater((p.C - token).magnitude, 300f + 0.5f * Mathf.Min(p.W, p.D), $"{p.Kind} at ({p.C.x:F0}, {p.C.y:F0}) on the token present in 1950");
+ }
+
+ /// <summary>T67 (issue #32; owner: "Yes, a follow-up"): the ma'abarot stood at the edges of the towns. A camp's centre is
+ /// looked for on rings an eighth of its reach apart (450 m at the house scale), not half of it (1.8 km), so a camp finds
+ /// the free ground at a town's edge in its hex: Degania Alef, a box with the coarse rings, gets its kit. Every structure
+ /// still stands wholly in the hex and off the towns, routes and steep ground (AMaabaraStandsInItsOwnHex,
+ /// MaabarotAreSeededAndStandOnFreeDryGround). Gaza's edge has room for 4 tents only, under the owner's minimum, so it
+ /// stays its box (ACampIsAtLeastSixPlotsAndAHutOrItsBox).</summary>
+ [Test]
+ public void ACampFindsTheGroundAtATownsEdge()
+ {
+ var map = OpenMap();
+ var c = Statecraft.Sim.ContentLoader.Load(Statecraft.Game.Paths.Content);
+ Assert.IsTrue(DrawnAsKit(map, c, "degania_alef"), "Degania Alef's camp is drawn as its kit");
+ }
+
+ /// <summary>Owner, 15 October 2026 ("Yes, min 6 plots + a hut"): a ma'abara is at least SettlementKits.MaabaraMinPlots
+ /// plots, one of them a hut, or its search goes on further out in its hex, and it is its box only when nowhere in the
+ /// hex has room. With the nearest free centre alone, Lod's and Ramla's camps of 1950 were 3 tents and no hut, Gaza's 4
+ /// (second review of #646).</summary>
+ [Test]
+ public void ACampIsAtLeastSixPlotsAndAHutOrItsBox()
+ {
+ var map = OpenMap();
+ var c = Statecraft.Sim.ContentLoader.Load(Statecraft.Game.Paths.Content);
+ var g = PlacementLayer.CampGround(map);
+ foreach (var id in new[] { "lod", "ramla", "gaza" })
+ {
+ var at = HexCentre(map, c, id);
+ var hex = c.SettlementHexes.Single(s => s.Id == id); // the game's seed id (PlacementLayer), so the game's layout
+ var built = SettlementKits.Maabarot(new List<(string id, Vector2 at, System.DateTime from)>
+ { ($"{Statecraft.Sim.MapActions.TransitCamp}_{hex.Q}_{hex.R}", at, new System.DateTime(1950, 8, 26)) }, g)[0];
+ TestContext.WriteLine($"{id}: {(built.mesh == null ? "box" : $"{built.tents} tents, {built.huts} huts, {(built.at - at).magnitude:F0} m from the hex centre")}");
+ if (id == "lod") Assert.IsNotNull(built.mesh, "Lod's camp of 1950 is a kit, not its box (second review of #646)");
+ if (built.mesh == null) continue;
+ Object.DestroyImmediate(built.mesh);
+ Assert.GreaterOrEqual(built.tents + built.huts, SettlementKits.MaabaraMinPlots, id + ": at least the minimum of plots");
+ Assert.Greater(built.huts, 0, id + ": a hut");
+ }
+ }
+
/// <summary>Review I2: the populations come from content/map/settlement_population_1945.yaml through the map inputs.</summary>
[Test]
public void ThePopulationFileLoadsAndRejectsBadRows()