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: GDD Phase 4 PR 2, corridors built segment by segment (refs #786) (#870)

Beri20dbc72d4e7f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d135fb906..11c61edf3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,20 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB
## [Unreleased]
### Added
+- GDD Phase 4 PR 2: corridors (refs #786, #384). Halutz units build the Burma Road (four segments, one between each pair
+ of its sourced waypoints), the 1949 Haifa–Tel Aviv rail link (the Yarkon link, one segment) and the Tel Aviv–Netanya
+ road (four segments) with `PioneerWork(unit, build_road | build_rail, corridor:N)`, any segment in any order, one unit
+ per segment (R-COR-001 to R-COR-003; owner, 17 October 2026, #782). `content/corridors.yaml` holds the corridors;
+ `tools/corridor_hexes.py` derives each segment's hexes from the traced route and a CI test keeps them in step. Segment
+ Money and turns are labelled design values (road IL 2m and 6 turns, rail IL 4m and 6 turns). The map gains the rail
+ link's route (`yarkon_rail_link`, from 20 September 1949) and the Tel Aviv–Netanya road (`tlv_netanya_road`, from 28
+ July 1950), drawn as straight draft lines between the five places *The Jerusalem Post* names (`trace: straight`;
+ owner, 18 October 2026, #786). Only the routes drawn at the game's start keep the settlement kits off, so the later
+ routes clear no town's houses or trees (owner, #786: the floors are kept). The unit tokens keep off only the routes
+ drawn while a token stands, so the two later routes move no 1948 token. The reference player builds segments once
+ every yishuv, ready field and camp site is taken; on the current minister-scaled historical run it reaches none by
+ 1952, so the goldens do not move. Transportation scales segment progress with fractional work carried as on sites;
+ base prices and durations stay unchanged. Veteran progress and a halutz's service follow R-VET-001 and R-VET-002.
- An event option can unlock a city project (GDD Phase 7 PR 2, D-H2): a `projects.yaml` kind marked `locked: true` is
refused by StartProject until an option with `unlock_projects` naming it has applied. The loader refuses an unknown
kind or one that is not locked, and a sensitive option may not unlock (R-EFX-008, R-EFX-005; refs #806). No real
diff --git a/content/corridors.yaml b/content/corridors.yaml
new file mode 100644
index 000000000..4b5ff9997
--- /dev/null
+++ b/content/corridors.yaml
@@ -0,0 +1,62 @@
+# GDD v0.1 corridors (docs/GDD.md "Pioneer work": build road, build railroad; docs/gdd/corridors.md; Phase 4 PR 2, #786).
+# A corridor is built segment by segment by halutz units (R-COR-001 to R-COR-003); the state holds each segment's progress
+# only. The owner took the plan's recommendations on 17 October 2026 (#782): the Burma Road on its traced line (Q-COR-1),
+# one segment between each pair of consecutive sourced waypoints (Q-COR-2), and the 1949 Haifa to Tel Aviv rail link as
+# the Yarkon link alone, since no source read gives the line of the bypass west of Tulkarm (Q-RAIL-1; research_notes/
+# gdd-phase-4-sourcing.md). The Tel Aviv to Netanya road (Q-COR-3) is not on the 1946 map and no source read gives its
+# 1950 line, so the owner decided (18 October 2026, #786) that it is drawn as straight draft lines between the five places
+# The Jerusalem Post names (route tlv_netanya_road, `trace: straight`): four segments.
+#
+# Fields:
+# route the route id in map/routes_1948.yaml whose traced line the corridor follows (map-only; the sim reads the hexes)
+# segments in order along the route; `to` is the route waypoint the segment ends at (the first starts at the route's
+# first waypoint). Waypoint names stay map data: on screen a segment is the corridor's name and its number
+# (Q-SENS-1). `hexes` are GENERATED by tools/corridor_hexes.py from the traced line (do not edit by hand;
+# tools/tests/test_corridor_hexes.py fails when they drift).
+# The Money and turns per segment are labelled design values in rules.yaml mvp: (Q-COR-6). The loader reads this file
+# only when eras.yaml systems.loop is gdd.
+corridors:
+ - id: burma_road
+ kind: road
+ name: Burma Road
+ name_he: דרך בורמה
+ route: burma_road
+ segments:
+ - { to: Bayt Jiz, hexes: [[-3, 22], [-3, 23]] }
+ - { to: Bayt Susin, hexes: [[-3, 23]] }
+ - { to: Bayt Mahsir, hexes: [[-3, 23], [-2, 22], [-3, 23], [-2, 23]] }
+ - { to: Saris, hexes: [[-2, 23]] }
+ sources:
+ # The route's line and its completion on 14 June 1948 (routes_1948.yaml burma_road, with that file's checked date).
+ # G1 (owner, 14 October 2026, #384) put the Burma Road in the MVP.
+ - { url: "https://en.wikipedia.org/wiki/Burma_Road_(Israel)", checked: 2026-10-11 }
+ status: draft
+ - id: tlv_haifa_rail
+ kind: rail
+ name: Haifa–Tel Aviv rail link
+ # For the native reviewer (#564): "the Haifa to Tel Aviv rail link" (the 1949 Yarkon link).
+ name_he: קישור הרכבת חיפה–תל אביב
+ route: yarkon_rail_link
+ segments:
+ - { to: Tel Aviv North railway station, hexes: [[-2, 19], [-2, 18]] }
+ sources:
+ # Israel Railways, 50 Years of Israel Railways (1998), p. 15: the two sections laid in the summer of 1949 and the
+ # service from 20 September 1949 (research_notes/gdd-phase-4-sourcing.md, section 2).
+ - { url: "https://web.archive.org/web/20140327112217/http://www.rail.co.il/HE/Fun/Museum/Documents/50Years.pdf", checked: 2026-10-15 }
+ status: draft
+ - id: tlv_netanya_road
+ kind: road
+ name: Tel Aviv–Netanya road
+ # For the native reviewer (#564): "the Tel Aviv–Netanya road" (the coastal road opened on 28 July 1950).
+ name_he: כביש תל אביב–נתניה
+ route: tlv_netanya_road
+ segments:
+ - { to: Herzliya, hexes: [[-3, 19], [-2, 18]] }
+ - { to: Rishpon, hexes: [[-2, 18], [-1, 17]] }
+ - { to: Wadi Falik (Nahal Poleg), hexes: [[-1, 17], [-1, 16]] }
+ - { to: Netanya, hexes: [[-1, 16], [0, 15]] }
+ sources:
+ # The Jerusalem Post, 30 July 1950, pp. 1 and 3: the opening on 28 July 1950 and the five places the road passed
+ # (research_notes/gdd-phase-4-sourcing.md, section 3). The line between them is the owner's straight draft (#786).
+ - { url: "https://archive.org/details/per_jerusalem-post_the-jerusalem-post_1950-07-30_26_7318", checked: 2026-10-15 }
+ status: draft
diff --git a/content/map/route_paths_1948.tsv b/content/map/route_paths_1948.tsv
index 042a8f75e..8e80ffb27 100644
--- a/content/map/route_paths_1948.tsv
+++ b/content/map/route_paths_1948.tsv
@@ -3,8 +3,8 @@
# and rerun the tool. The runtime form the map reads at boot (map-only, outside the content hash).
#route id kind status from to length_km on_symbol max_gap_m point_count points
meta version 3
-meta yaml_check 254700474
-meta routes 19
+meta yaml_check 1351806899
+meta routes 21
route jaffa_jerusalem_railway rail draft 1920-10-05 79.4 1.0 65 113 34.76117 32.05894;34.76409 32.05996;34.76949 32.0605;34.77448 32.0603;34.77742 32.05924;34.78086 32.05571;34.78638 32.04568;34.79255 32.03932;34.81436 32.02349;34.83771 32.00775;34.84893 31.99572;34.8713 31.97509;34.88636 31.95755;34.88673 31.95516;34.88565 31.95368;34.87321 31.94354;34.87112 31.94135;34.86992 31.93914;34.8708 31.93573;34.87298 31.93191;34.87781 31.9283;34.88083 31.9234;34.88626 31.91762;34.88954 31.90869;34.88909 31.90734;34.88636 31.90467;34.87678 31.89781;34.87057 31.88903;34.87168 31.87982;34.87147 31.87482;34.86603 31.86169;34.86775 31.85101;34.87009 31.84463;34.87058 31.84073;34.86979 31.82851;34.86722 31.81997;34.86949 31.81555;34.87025 31.8114;34.87181 31.80857;34.87557 31.80583;34.88764 31.79956;34.89363 31.79506;34.90035 31.78828;34.92253 31.76821;34.92847 31.76507;34.93797 31.75898;34.94668 31.759;34.95347 31.75656;34.95884 31.756;34.97276 31.75634;34.98381 31.75799;35.00674 31.75687;35.01071 31.75768;35.01722 31.76211;35.03203 31.76215;35.03544 31.7646;35.03876 31.7659;35.0477 31.76358;35.05046 31.75846;35.05232 31.75727;35.0651 31.76556;35.0675 31.76593;35.06883 31.76475;35.06934 31.76031;35.06539 31.75626;35.06483 31.75461;35.06613 31.75284;35.06934 31.7512;35.0737 31.75011;35.07778 31.75009;35.08386 31.75723;35.08588 31.75852;35.08703 31.7586;35.08797 31.75729;35.08624 31.75413;35.08606 31.7517;35.08691 31.75108;35.09144 31.7511;35.09289 31.75045;35.09369 31.74963;35.09485 31.74558;35.0958 31.7445;35.10339 31.74279;35.11714 31.73811;35.11861 31.7385;35.12205 31.74277;35.12356 31.74337;35.12516 31.74331;35.12622 31.74156;35.1248 31.73751;35.12586 31.73527;35.12727 31.73454;35.12892 31.73445;35.13344 31.73692;35.13546 31.73692;35.13697 31.73577;35.13836 31.73204;35.13999 31.7312;35.14144 31.73175;35.15582 31.74346;35.16043 31.74566;35.16454 31.74553;35.1731 31.74401;35.17851 31.74412;35.18192 31.74515;35.1869 31.74832;35.19691 31.75147;35.19855 31.75147;35.20436 31.74975;35.20594 31.74999;35.21073 31.75343;35.21583 31.75941;35.22466 31.76678
route kantara_main_line_south rail draft 1946 102.5 0.99 97 106 34.8755 31.94583;34.85647 31.94164;34.84493 31.94101;34.83788 31.93628;34.83139 31.93335;34.81811 31.93296;34.81475 31.92788;34.81331 31.91992;34.81009 31.91508;34.80842 31.9107;34.80337 31.90815;34.79081 31.89542;34.78637 31.89251;34.77953 31.88947;34.76356 31.87633;34.74713 31.86554;34.72107 31.8437;34.71295 31.83287;34.7051 31.82449;34.70018 31.81622;34.69304 31.80776;34.68667 31.79855;34.67908 31.79188;34.67078 31.78289;34.66478 31.77247;34.66476 31.77104;34.66776 31.76448;34.66696 31.76118;34.66343 31.75479;34.66284 31.75435;34.65236 31.75308;34.65118 31.75209;34.64526 31.74122;34.63381 31.72352;34.61521 31.69725;34.61254 31.69087;34.60678 31.68569;34.60549 31.68164;34.60529 31.67166;34.60389 31.67115;34.58877 31.67053;34.5874 31.66999;34.58724 31.66867;34.58805 31.66744;34.59896 31.66077;34.60022 31.65899;34.59968 31.65625;34.59564 31.64929;34.59557 31.64656;34.59706 31.63678;34.59465 31.63269;34.5905 31.62816;34.58473 31.6229;34.5791 31.61876;34.57812 31.61072;34.57035 31.59179;34.56867 31.58935;34.56352 31.58467;34.5611 31.58174;34.55798 31.58041;34.55715 31.58052;34.55643 31.57968;34.55603 31.57904;34.55627 31.57341;34.54561 31.55758;34.53515 31.54645;34.52255 31.53754;34.51649 31.53214;34.5101 31.5299;34.50219 31.52832;34.48311 31.51676;34.47609 31.51181;34.4657 31.50761;34.46364 31.50719;34.4628 31.50601;34.46266 31.50351;34.46458 31.49846;34.45976 31.49304;34.4537 31.48804;34.44529 31.48272;34.43482 31.47347;34.4278 31.46977;34.41818 31.46277;34.41574 31.46034;34.41146 31.45422;34.40586 31.44884;34.38021 31.42685;34.37118 31.41743;34.36077 31.40994;34.35722 31.4056;34.3496 31.39291;34.34069 31.38172;34.33788 31.37664;34.32567 31.36532;34.31324 31.34922;34.31124 31.34515;34.30399 31.34404;34.30001 31.33851;34.28154 31.3186;34.27795 31.31347;34.26673 31.30334;34.26553 31.29969;34.26534 31.28923;34.26436 31.2789;34.26318 31.27672;34.25855 31.27246
route eastern_railway rail draft 1915 62.8 0.99 114 69 34.8755 31.94583;34.87938 31.94791;34.88741 31.9538;34.89447 31.96052;34.89701 31.9638;34.89951 31.9691;34.9021 31.98026;34.90296 31.98665;34.90556 31.99305;34.91548 32.01115;34.92223 32.01796;34.92509 32.02191;34.92851 32.03092;34.93275 32.03659;34.93409 32.03951;34.93514 32.04554;34.93522 32.05602;34.93344 32.06619;34.93323 32.09143;34.93553 32.11937;34.93319 32.12488;34.93243 32.13781;34.93403 32.14811;34.93762 32.15889;34.94349 32.16711;34.94779 32.17195;34.95517 32.1847;34.95618 32.1883;34.95543 32.19825;34.95811 32.20598;34.96048 32.20971;34.96819 32.21761;34.97086 32.22158;34.97969 32.24019;34.98528 32.25489;34.99084 32.26556;34.99322 32.27276;35.00063 32.28791;35.00307 32.29026;35.00837 32.29369;35.01296 32.30576;35.01461 32.30788;35.01882 32.30917;35.02419 32.30977;35.02548 32.31063;35.02613 32.3119;35.02535 32.31286;35.01651 32.31478;35.01369 32.31589;35.01196 32.31906;35.0108 32.3261;35.00841 32.33135;35.00484 32.34445;35.00266 32.35715;35.00008 32.36384;35.00082 32.36949;35.00256 32.37608;35.00245 32.37961;34.99682 32.39174;34.9936 32.39447;34.98082 32.40251;34.97732 32.4089;34.97446 32.4203;34.96666 32.43166;34.96297 32.43441;34.95436 32.43846;34.95042 32.44256;34.94959 32.44441;34.94966 32.44612
@@ -24,5 +24,7 @@ route jerusalem_jericho_road road draft 1946 32.1 0.96 439 58 35.22569 31.77933
route tiberias_metula_road road draft 1946 58.1 0.91 418 68 35.5333 32.79442;35.5347 32.79877;35.53443 32.79938;35.5301 32.80216;35.52206 32.80947;35.51652 32.8195;35.51035 32.82659;35.50947 32.82961;35.5091 32.83631;35.5112 32.84125;35.52729 32.86386;35.53054 32.86931;35.53135 32.87008;35.53704 32.87211;35.54324 32.87688;35.5453 32.88023;35.54743 32.88644;35.54815 32.88771;35.54938 32.88827;35.54938 32.88926;35.54468 32.89726;35.54073 32.90223;35.54129 32.90344;35.54597 32.90579;35.54717 32.908;35.5443 32.91347;35.54335 32.91767;35.54277 32.93459;35.54487 32.94166;35.54313 32.94898;35.54158 32.95958;35.54332 32.96352;35.55158 32.97443;35.55511 32.98097;35.56398 33.00276;35.56361 33.00437;35.56096 33.00866;35.56213 33.0135;35.56791 33.01741;35.5697 33.02098;35.57069 33.02558;35.57107 33.03424;35.57067 33.04831;35.57396 33.0701;35.57266 33.0837;35.57341 33.09084;35.57343 33.09915;35.57092 33.12213;35.56822 33.13337;35.56943 33.14627;35.56953 33.15855;35.56847 33.16965;35.56558 33.17735;35.56508 33.18709;35.56536 33.19029;35.56739 33.19637;35.56935 33.21646;35.57048 33.21911;35.57522 33.22585;35.58054 33.24196;35.58022 33.24335;35.57778 33.24568;35.57213 33.2485;35.56961 33.25645;35.56981 33.26356;35.57424 33.27074;35.57577 33.27765;35.57536 33.27881
route gaza_beersheba_road road draft 1946 45.7 0.96 358 55 34.46076 31.50912;34.47082 31.50312;34.47832 31.49745;34.48678 31.48862;34.49413 31.48278;34.50074 31.48077;34.51565 31.47893;34.52217 31.47653;34.53546 31.46778;34.55457 31.4573;34.56223 31.45227;34.57343 31.44743;34.58375 31.44173;34.59115 31.43592;34.59975 31.43088;34.60654 31.42227;34.61073 31.41522;34.61335 31.40248;34.61381 31.39021;34.61443 31.38667;34.61648 31.38162;34.61798 31.37574;34.62574 31.36641;34.64298 31.34962;34.64656 31.34717;34.65213 31.3447;34.65326 31.34334;34.65456 31.3398;34.65938 31.33669;34.67004 31.33302;34.67413 31.33319;34.68023 31.33475;34.68994 31.33366;34.69523 31.33394;34.69658 31.33321;34.70012 31.32881;34.7032 31.32372;34.70385 31.32133;34.70374 31.31355;34.70853 31.30754;34.70998 31.30094;34.71155 31.29774;34.71528 31.29493;34.72196 31.29137;34.72622 31.28793;34.73484 31.27907;34.73726 31.27572;34.73971 31.27084;34.74254 31.26831;34.75433 31.2616;34.76189 31.25557;34.77332 31.25226;34.78395 31.24652;34.78499 31.24626;34.78538 31.24664
route beersheba_auja_road road draft 1946 69.9 0.97 261 77 34.78538 31.24664;34.78695 31.24386;34.79402 31.23727;34.79753 31.23201;34.80098 31.22072;34.80203 31.21544;34.80401 31.21001;34.80492 31.20399;34.80684 31.19738;34.80706 31.18043;34.80472 31.164;34.80613 31.15516;34.80491 31.14671;34.80542 31.13519;34.80651 31.1299;34.80798 31.1266;34.81171 31.12141;34.82035 31.11128;34.82177 31.108;34.82207 31.10204;34.82303 31.10092;34.82794 31.09776;34.82993 31.09167;34.83409 31.08549;34.83908 31.07546;34.83842 31.06632;34.83379 31.06149;34.83102 31.0565;34.80519 31.0366;34.79032 31.02098;34.78129 31.01459;34.77774 31.01282;34.77578 31.01246;34.76346 31.01561;34.76158 31.01531;34.7609 31.01406;34.75921 31.00408;34.76199 30.99334;34.76134 30.99179;34.75216 30.98452;34.72421 30.971;34.71105 30.96099;34.70396 30.9572;34.69683 30.95518;34.6775 30.95208;34.67385 30.9485;34.66057 30.94707;34.65502 30.9457;34.65323 30.94433;34.64789 30.93636;34.64092 30.93199;34.6349 30.92653;34.63194 30.92465;34.62888 30.92364;34.62487 30.9232;34.61728 30.92787;34.60679 30.93019;34.60518 30.92916;34.60133 30.92297;34.59443 30.91981;34.58566 30.91813;34.58336 30.91617;34.57899 30.91098;34.57525 30.90814;34.5551 30.90038;34.55032 30.8995;34.54487 30.90086;34.53995 30.90142;34.52619 30.90204;34.52124 30.90158;34.50057 30.89494;34.4856 30.8939;34.48196 30.89325;34.44598 30.88287;34.43721 30.88089;34.43465 30.87916;34.43364 30.8777
+route yarkon_rail_link rail draft 1949-09-20 6.1 0.97 65 11 34.88133 32.09675;34.87998 32.09246;34.87867 32.09156;34.87627 32.09107;34.86514 32.09223;34.83516 32.09323;34.83234 32.09435;34.82869 32.09776;34.82921 32.09875;34.82887 32.09903;34.83121 32.10155
+route tlv_netanya_road road draft 1950-07-28 27.7 0.0 27694 5 34.78 32.0958;34.8343 32.17;34.8244 32.2006;34.8357 32.2681;34.8567 32.3286
service jaffa_jerusalem_railway 1950-03-02 34.87556 31.94583 35.22471 31.76685
-meta body_check -1423678488
+meta body_check -49274032
diff --git a/content/map/route_paths_1948.yaml b/content/map/route_paths_1948.yaml
index 36c59e5c5..154d9f922 100644
--- a/content/map/route_paths_1948.yaml
+++ b/content/map/route_paths_1948.yaml
@@ -1701,3 +1701,35 @@ routes:
- [34.43721, 30.88089]
- [34.43465, 30.87916]
- [34.43364, 30.87770]
+- id: yarkon_rail_link
+ kind: rail
+ status: draft
+ from: '1949-09-20'
+ on_symbol: 0.97
+ max_gap_m: 65
+ length_km: 6.1
+ points:
+ - [34.88133, 32.09675]
+ - [34.87998, 32.09246]
+ - [34.87867, 32.09156]
+ - [34.87627, 32.09107]
+ - [34.86514, 32.09223]
+ - [34.83516, 32.09323]
+ - [34.83234, 32.09435]
+ - [34.82869, 32.09776]
+ - [34.82921, 32.09875]
+ - [34.82887, 32.09903]
+ - [34.83121, 32.10155]
+- id: tlv_netanya_road
+ kind: road
+ status: draft
+ from: '1950-07-28'
+ on_symbol: 0.00
+ max_gap_m: 27694
+ length_km: 27.7
+ points:
+ - [34.78000, 32.09580]
+ - [34.83430, 32.17000]
+ - [34.82440, 32.20060]
+ - [34.83570, 32.26810]
+ - [34.85670, 32.32860]
diff --git a/content/map/routes_1948.yaml b/content/map/routes_1948.yaml
index 0e2c5356e..6a4b176e0 100644
--- a/content/map/routes_1948.yaml
+++ b/content/map/routes_1948.yaml
@@ -469,3 +469,59 @@ routes:
checked: '2026-10-11'
- url: https://www.openhistoricalmap.org/way/202064413
checked: '2026-10-11'
+# --- Built 1949: GDD Phase 4 corridors (#786; owner, 17 October 2026, #782: Q-RAIL-1) -------------------------------
+# Later than the 1946 map, so it traces on the map's tracks (`trace: track`) between the places the sources name, as the
+# Burma Road does. Its sources carry the date of the research note that read them, research_notes/gdd-phase-4-sourcing.md
+# (15 October 2026); no person has re-read them for this file, so it stays draft.
+- id: yarkon_rail_link
+ name: Petah Tikva–Tel Aviv North rail link (1949)
+ kind: rail
+ trace: track
+ from: '1949-09-20'
+ status: draft
+ note: The new track Israel Railways laid in the summer of 1949 from the Rosh HaAyin–Petah Tikva branch west along the
+ Yarkon to a new Tel Aviv North station (renamed Bnei Brak after 1954), about 7 km. With the bypass west of Tulkarm it
+ carried the Haifa–Tel Aviv passenger service from 20 September 1949, the date the map shows it from (Israel Railways,
+ 50 Years of Israel Railways, 1998, p. 15).
+ to_verify:
+ - Built after the 1946 map, so the trace follows the tracks the map shows between the two stations, not the 1949
+ alignment; where the new track left the branch is not given by any source read.
+ - The bypass west of Tulkarm is not drawn: no source read gives its line (research_notes/gdd-phase-4-sourcing.md).
+ via:
+ - {name: Petah Tikva railway station (1921), lon: 34.8813, lat: 32.0968, url: 'https://he.wikipedia.org/wiki/%D7%AA%D7%97%D7%A0%D7%AA_%D7%94%D7%A8%D7%9B%D7%91%D7%AA_%D7%94%D7%94%D7%99%D7%A1%D7%98%D7%95%D7%A8%D7%99%D7%AA_%D7%A9%D7%9C_%D7%A4%D7%AA%D7%97_%D7%AA%D7%A7%D7%95%D7%95%D7%94'}
+ - {name: Tel Aviv North railway station, lon: 34.831, lat: 32.1029, url: 'https://en.wikipedia.org/wiki/Bnei_Brak_railway_station'}
+ sources:
+ - url: https://web.archive.org/web/20140327112217/http://www.rail.co.il/HE/Fun/Museum/Documents/50Years.pdf
+ checked: '2026-10-15'
+ - url: https://en.wikipedia.org/wiki/Bnei_Brak_railway_station
+ checked: '2026-10-15'
+# --- Built 1950: the Tel Aviv–Netanya road (#786; owner, 17 October 2026, #782: Q-COR-3) ---------------------------------
+# Not on the 1946 map, and no source read gives its 1950 line, so the owner decided (18 October 2026, #786, Q-COR-3 (b))
+# that it is drawn as straight draft lines between the five places The Jerusalem Post of 30 July 1950 names
+# (`trace: straight`, research_notes/gdd-phase-4-sourcing.md, section 3). Its sources carry the date of that note
+# (15 October 2026); no person has re-read them for this file, so it stays draft.
+- id: tlv_netanya_road
+ name: Tel Aviv–Netanya road (1950)
+ kind: road
+ trace: straight
+ from: '1950-07-28'
+ status: draft
+ note: The coastal road from the northern end of the Yarkon bridge in Tel Aviv by Herzliya to Netanya, 26 km, opened by
+ Golda Myerson on 28 July 1950; an 8 km stretch at Wadi Falik was still unfinished, with a detour (The Jerusalem Post,
+ 30 July 1950, pp. 1 and 3).
+ to_verify:
+ - 'Drawn as straight lines between the five named places (owner, 18 October 2026, #786), not the built line; no source
+ read gives the 1950 alignment.'
+ - The points are the places' Wikipedia points, not the road's; which Yarkon bridge it started at and where it crossed
+ Nahal Poleg are not given by any source read.
+ via:
+ - {name: Yarkon bridge (Tel Aviv), lon: 34.7800, lat: 32.0958, url: 'https://en.wikipedia.org/wiki/Yarkon_River'}
+ - {name: Herzliya, lon: 34.8343, lat: 32.1700, url: 'https://he.wikipedia.org/wiki/%D7%94%D7%A8%D7%A6%D7%9C%D7%99%D7%94'}
+ - {name: Rishpon, lon: 34.8244, lat: 32.2006, url: 'https://he.wikipedia.org/wiki/%D7%A8%D7%A9%D7%A4%D7%95%D7%9F'}
+ - {name: Wadi Falik (Nahal Poleg), lon: 34.8357, lat: 32.2681, url: 'https://en.wikipedia.org/wiki/Poleg'}
+ - {name: Netanya, lon: 34.8567, lat: 32.3286, url: 'https://en.wikipedia.org/wiki/Netanya'}
+ sources:
+ - url: https://archive.org/details/per_jerusalem-post_the-jerusalem-post_1950-07-30_26_7318
+ checked: '2026-10-15'
+ - url: https://archive.org/details/per_jerusalem-post_the-jerusalem-post_1950-07-28_26_7317
+ checked: '2026-10-15'
diff --git a/content/rules.yaml b/content/rules.yaml
index 7eeb86694..a025c5a51 100644
--- a/content/rules.yaml
+++ b/content/rules.yaml
@@ -48,14 +48,15 @@ mvp:
# factor, EffectsSystem.Multiplier) scales each GDD system. Q-MIN-1's mapping, "each with its office's sourced remit
# in a comment": the Ministry of Labour ran housing and public construction; the Ministry of Agriculture, the fields
# and the new settlements; the Ministry of Immigration, the immigrants' housing (the offices and their terms are the
- # sourced rows of offices.yaml; the remits are as the decision names them). Corridors (Transportation) and military
- # training (Defense) join the map when their integrations land (#870, #742).
+ # sourced rows of offices.yaml; the remits are as the decision names them). Transportation scales corridor work
+ # (Q-MIN-1); military training (Defense) joins the map with #742.
minister_systems:
housing_construction: labour_minister
industry_construction: labour_minister
field_work: agriculture_minister
yishuv_work: agriculture_minister
absorption: immigration_minister
+ corridors: transportation_minister
# The day the cities start taking arrivals (R-CITY-003; Q-ARRV-3, owner, 15 October 2026, #375): the census day of their
# start values, 8 November 1948 (CBS Statistical Abstract of Israel No. 14, Table 11, pp. 30-31). The census already
# counts the people who arrived from 15 May, so the cities take none before it; the national head count takes them all.
@@ -78,6 +79,12 @@ mvp:
dry_swamp_turns: 12 # DESIGN VALUE: owner-set balance, not a historical figure (D-D6, Q-SWAMP-1: turns draining the Hula takes)
dry_swamp_cost: 4 # DESIGN VALUE: owner-set balance, not a historical figure (D-D6, Q-SWAMP-1: IL millions, paid at the start)
field_food_per_turn: 1 # DESIGN VALUE: owner-set balance, not a historical figure (D-D10, Q-FIELD-3: Food units a plowed field adds each turn)
+ # Q-COR-6 (agents propose design values, owner, 15 October 2026, #375; taken with the plan on 17 October 2026, #782): a
+ # road segment as the Mefalsim build, a rail segment twice its Money at the same pace. Not historical figures.
+ road_segment_turns: 6 # DESIGN VALUE: owner-set balance, not a historical figure (D-D7, Q-COR-6: turns a road segment takes)
+ road_segment_cost: 2 # DESIGN VALUE: owner-set balance, not a historical figure (D-D7, Q-COR-6: IL millions, paid at the start)
+ rail_segment_turns: 6 # DESIGN VALUE: owner-set balance, not a historical figure (D-D7, Q-COR-6: turns a rail segment takes)
+ rail_segment_cost: 4 # DESIGN VALUE: owner-set balance, not a historical figure (D-D7, Q-COR-6: IL millions, paid at the start)
objective_points: 100 # DESIGN VALUE: owner-set balance, not a historical figure (D-B6: points per objective)
objective_bonus_per_month: 5 # DESIGN VALUE: owner-set balance, not a historical figure (D-B2: points per month early)
objective_bonus_cap: 60 # DESIGN VALUE: owner-set balance, not a historical figure (D-B2: the most bonus points)
diff --git a/docs/gdd/corridors.md b/docs/gdd/corridors.md
index 4ecd04eeb..d17ac7102 100644
--- a/docs/gdd/corridors.md
+++ b/docs/gdd/corridors.md
@@ -7,22 +7,24 @@ As a player of the MVP, I want my pioneer units to lay the Tel Aviv-Haifa railwa
## Rules
- A corridor is a project with per-segment progress, drawn by `RouteLayer` from the sim's progress, in a new `corridors.yaml` (the plan [S2]).
-- The MVP's decided corridors are the Tel Aviv-Haifa railway (GDD [S1]) and the Burma Road (G1 [S5]). Any further road is the owner's decision D-D7, open (the plan recommends two to three roads [S2]).
+- The MVP builds the Haifa-Tel Aviv rail link (GDD [S1]; `Q-RAIL-1` [S8]) and the Burma Road (G1 [S5]). The rail link is the 1949 Yarkon link alone, from the Petah Tikva branch to Tel Aviv North: no source read gives the line of the bypass west of Tulkarm, so by the owner's rule it is left out [S8][S9]. The owner also chose the Tel Aviv-Netanya road (`Q-COR-3`, [S8]). The 1946 map does not show it and no source read gives its 1950 line, so it is drawn as straight draft lines between the five places *The Jerusalem Post* names, four segments [S10].
- The location roster adds required map anchors, including Hulda, Latrun, Sha'ar HaGai and Jerusalem for the Jerusalem connection. Optional authoring at the Rosh HaAyin immigrant camp does not make a required route waypoint optional, and naming a front or regional hub adds no automatic road project [S6].
- Location placement and corridor geometry are separate authoring data. Moving a named endpoint preserves its identity, reports affected segment/site bindings and requires explicit dependency resolution without silently rewriting a sourced route [S7].
-- Corridor work is multi-turn, with one project per pioneer unit at a time (D-D6 [S2]). Segment counts, costs and durations are balance values the owner sets; until then they are placeholders in the dev and test overlay, never in `content/` [S2].
+- A corridor is split into one segment between each pair of consecutive sourced waypoints of its route, so the Burma Road and the Tel Aviv-Netanya road have four segments each and the rail link one (`Q-COR-2`, [S8]). A segment's hexes are the hexes its stretch of the traced line crosses (`tools/corridor_hexes.py`). On screen a segment is the corridor's name and its number, never a waypoint's name (`Q-SENS-1`, [S8]).
+- `PioneerWork(unit, build_road | build_rail, corridor:N)` starts any unbuilt segment that no other unit holds, in any order, so several units can build one corridor at once; the unit works from where it stands (`Q-COR-4`, `Q-COR-5` [S8]). One project per pioneer unit at a time (D-D6 [S2]). The kind's cost is paid in full at the start and borrowed if the Treasury is short; `StopWork` loses the progress and returns no Money (`Q-COR-6`, [S8]). A corridor is complete when every segment is built (R-COR-001 to R-COR-003).
+- The Money and turns per segment are labelled design values in `rules.yaml` (`Q-COR-6`, [S8]): a road segment IL 2m and 6 turns, a rail segment IL 4m and 6 turns.
+- A built corridor needs no upkeep, rolling stock or staff and yields no Money or Food in the MVP (`Q-COR-7`, [S8]).
- Completing the Tel Aviv-Haifa railway completes the railway part of the third objective, "Establish key infrastructure" (GDD "MVP scope" [S1]). The completion card's reference date is the owner's open decision D-B3 [S2]; one option is the Haifa-Tel Aviv passenger service that opened on 20 September 1949 [S3].
- The Burma Road corridor to Jerusalem is the Burma Road part of the third objective: the owner decided on 14 October 2026 that it is in the MVP (G1 [S5], GDD "MVP scope" [S1]). Its completion card's reference date is the opening of the Road of Valour, which replaced the Burma Road track, on 7 December 1948 [S4].
-- Nir Am's infrastructure-protection rule is part of the third objective: the Negev water line that began there must stay in Israeli hands until the armistice with Egypt on 24 February 1949. Its card tells the pipeline's 1947–48 history from sources, with `checked:` dates and a person's fact check. Its points are a labelled design value for the balance pass; no value is selected here. **Then decided (owner, 18 Oct 2026, "Part of objective 3"; [#1006](https://github.com/eyalgolan/statecraft-israel/issues/1006#issuecomment-6254333583))** [S8]. (unitless)
+- Nir Am's infrastructure-protection rule is part of the third objective: the Negev water line that began there must stay in Israeli hands until the armistice with Egypt on 24 February 1949. Its card tells the pipeline's 1947–48 history from sources, with `checked:` dates and a person's fact check. Its points are a labelled design value for the balance pass; no value is selected here. **Then decided (owner, 18 Oct 2026, "Part of objective 3"; [#1006](https://github.com/eyalgolan/statecraft-israel/issues/1006#issuecomment-6254333583))** [S11]. (unitless)
- One military camp and one Hakhshara exist at the start, and pioneers build further camps (D-D5 [S2]); building a camp is one of the GDD's pioneer actions (GDD "Pioneer work" [S1]).
## Data touched
-- `corridors.yaml` (new): corridor and segment definitions with progress.
-- `Projects.cs` (new, Phase 1) and the project's save lines: corridor progress.
-- `Corridors.cs` (new) and `tools/routes_1948.py` (extended): the Phase 4 corridor model and route data (the plan, Phase 4 Touches [S2]).
-- `RouteLayer` (Unity): draws corridor progress.
-- `sites.yaml` (new, Phase 1): corridor endpoints.
+- `content/corridors.yaml` (new, #786): each corridor's kind, names, map route and segments, with sources; the state holds each segment's progress (`corr{}` in the hash, only when a segment is started).
+- `Corridors.cs` (new) and `Projects.cs`: the orders, step 5's progress after the sites, and `StopWork`.
+- `content/map/routes_1948.yaml`: the new `yarkon_rail_link` route and the `tlv_netanya_road` route (`trace: straight`, drawn as straight lines between its waypoints), traced into `route_paths_1948.yaml` and baked into the `.tsv` and the route ribbons; `tools/corridor_hexes.py` derives the segment hexes from the traced line.
+- `RouteLayer` (Unity): drawing by progress comes with Phase 4 PR 8; until then the new route draws by its `from` date, as every route does.
## Done when
@@ -31,7 +33,7 @@ As a player of the MVP, I want my pioneer units to lay the Tel Aviv-Haifa railwa
## Out of scope
-- The corridor list itself beyond the Burma Road (D-D7), segment costs and durations, and road and rail effects on movement (D-G2).
+- Drawing corridors from progress (Phase 4 PR 8), the objective's railway and Burma Road parts and their cards (Phase 4 PR 7), and road and rail effects on movement (Phase 5, D-G2).
## Sources
@@ -42,7 +44,10 @@ As a player of the MVP, I want my pioneer units to lay the Tel Aviv-Haifa railwa
- [S5] Owner decisions, G1 (the Burma Road in the MVP, 14 October 2026), docs/oss/DECISIONS.md
- [S6] MVP map priorities and transport anchors, docs/locations.md
- [S7] Internal map-authoring requirements, docs/gdd/map-editor.md; route geometry and bake pipeline, docs/routes.md
-- [S8] [Owner decision on Nir Am's objective](https://github.com/eyalgolan/statecraft-israel/issues/1006#issuecomment-6254333583), 18 October 2026, checked 2026-10-18.
+- [S8] Owner decision of 17 October 2026, "take all of the plan's recommendations" (Phase 4 PR 0), https://github.com/eyalgolan/statecraft-israel/issues/782 ; the recommendations are in docs/superpowers/plans/2026-10-15-gdd-phase-4.md, PR 0
+- [S9] Research note, the 1949 rail link and the Tulkarm bypass, research_notes/gdd-phase-4-sourcing.md, section 2
+- [S10] Owner decision of 18 October 2026, Q-COR-3 (b): "the Tel Aviv–Netanya line is drawn as straight draft lines between the five sourced places", https://github.com/eyalgolan/statecraft-israel/issues/786#issuecomment-6249500143 , checked 2026-10-18; its waypoints, research_notes/gdd-phase-4-sourcing.md, section 3
+- [S11] [Owner decision on Nir Am's objective](https://github.com/eyalgolan/statecraft-israel/issues/1006#issuecomment-6254333583), 18 October 2026, checked 2026-10-18.
## Open questions
@@ -50,3 +55,4 @@ As a player of the MVP, I want my pioneer units to lay the Tel Aviv-Haifa railwa
- Decided (owner, 17 Oct 2026, #782): the railway is the 1949 Haifa to Tel Aviv link: the Rosh HaAyin to Tel Aviv North link along the Yarkon and the bypass west of Tulkarm. If Task 2.0 finds no source for the bypass's alignment, the corridor is the Yarkon link alone. The card's reference date is 20 September 1949, worded "Haifa to Tel Aviv rail service restored" [S3] (D-B3).
- Decided (owner, 17 Oct 2026, #782): one segment between each pair of consecutive sourced waypoints. A road segment costs IL 2m and takes 6 turns; a rail segment costs IL 4m and takes 6 turns. The numbers are labelled design values (D-D7).
- Decided (owner, 15 Oct 2026, "Take all recommendations", #375; Phase 5 plan Q-MOVE-2): "Roads and rail cheaper", and "Only the corridors Phase 4 builds count" (D-G2). Phase 4 Q-COR-7 (owner, 17 Oct 2026, #782) adds that a built road or railway counts for movement in Phase 5.
+- Decided (owner, 18 Oct 2026, #786, Q-COR-3 (b)): the Tel Aviv-Netanya road is drawn as straight draft lines between the five sourced places, with no source for its 1950 line; its segments' hexes are derived from those lines [S10].
diff --git a/docs/routes.md b/docs/routes.md
index f1487bec7..6e6568473 100644
--- a/docs/routes.md
+++ b/docs/routes.md
@@ -55,6 +55,10 @@ month) is skipped alone, with a warning.
symbol: the red main road, or the black railway (thick, with white dashes). A thin dark line costs 4 for a railway
(curves drawn thinner, as in the Sorek canyon). Any other pixel costs 40.
- The 1,050 mm narrow-gauge Jezreel Valley line is drawn thin, so it traces as a `track`.
+- A route with `trace: straight` is not traced: its line is its waypoints joined by straight lines. Only the 1950 Tel
+ Aviv–Netanya road uses it: the 1946 map does not show it and no source read gives its line, so the owner decided it is
+ drawn as straight draft lines between the five places the sources name (18 October 2026, #786). Its `on_symbol` is 0,
+ and the tracer's quality checks skip it.
- A waypoint first snaps to its symbol within 1.5 km. A waypoint off the line (a town circle, its name, a modern
town's point such as Ashkelon's for al-Majdal) is reached by an out-and-back spur, which the tool cuts.
- The chain is smoothed over 15 pixels, resampled every 40 m, smoothed again and simplified at 35 m.
@@ -105,6 +109,8 @@ is inside it (review C1):
| road | Tel Aviv–Haifa | 1937 | The Hadera–Haifa section's date (OpenHistoricalMap), to-verify. |
| road | Haifa–Acre–Ras an-Naqura | 1933 | OpenHistoricalMap way dates. |
| track | Burma Road | 1948-06-14 | Completed on 14 June 1948. The first jeep attempt failed on the night of 30–31 May; a second got through on 31 May – 1 June. Drawn along the 1946 tracks (to-verify). It is hidden at the 15 May start. |
+| rail | Petah Tikva–Tel Aviv North rail link | 1949-09-20 | The 1949 Yarkon link (#786): new track from the Petah Tikva branch to a new Tel Aviv North station, which with the Tulkarm bypass carried the Haifa–Tel Aviv service from 20 September 1949. Drawn along the 1946 tracks (to-verify); the bypass is not drawn, no source gives its line. A GDD Phase 4 corridor (`content/corridors.yaml`). |
+| road | Tel Aviv–Netanya road | 1950-07-28 | Opened on 28 July 1950 (*The Jerusalem Post*, 30 July 1950), from the northern end of the Yarkon bridge by Herzliya, Rishpon and Wadi Falik to Netanya; an 8 km stretch at Wadi Falik was still unfinished. A Phase 4 corridor (#786). Straight draft lines between those five places (`trace: straight`, owner, 18 October 2026, #786), not the built line (to-verify). |
**Left out, on purpose.**
- The Afula–Nablus–Tulkarm branch: its service ended in 1932 and 1938 (Palestine Railways article). Freight on the
@@ -327,13 +333,18 @@ does (#320, docs/visual-v1.md).
same few tens of milliseconds both ways from run to run.
**Kits keep off the routes** (settlement kits and trees, #179).
-- `MapScene` reads the routes before building the kits, and hands `KitLayer.Build` every route's corridor
- (`RouteLayer.Corridors`): half the drawn width plus `CorridorMarginM` (100 m; 40 m for roads, `RoadCorridorMarginM`).
+- `MapScene` reads the routes before building the kits, and hands `KitLayer.Build` the corridor of every route drawn at
+ the game's start (`RouteLayer.KitRoutes`, `RouteLayer.Corridors`; `MapScene.KitRouteCorridors`, which the kit tests mirror): half the drawn width plus `CorridorMarginM` (100 m;
+ 40 m for roads, `RoadCorridorMarginM`).
- `KitGround.OnRoute` (a 2 km segment grid) keeps building lots, landmarks and tree crowns out of these corridors.
B9 still keeps trees out of building lots.
-- Every route gets its corridor, whatever its date: the kits are built once, not per date, so the Burma Road's corridor
- stays clear from the start.
-- `RouteTests.NoKitBuildingOrTreeStandsOnARoute` checks every lot and tree against every segment by brute force.
+- Only the routes drawn on 15 May 1948 get a kit corridor (owner, 18 October 2026, #786: the kit floors are kept, not
+ lowered). The kits are built once, not per date, so a later route (the Burma Road, the 1949 rail link, the 1950 Tel
+ Aviv–Netanya road) clears no town's houses or trees from the start, and draws over them when it appears. The units
+ keep off every route drawn while a token stands (`RouteLayer.UnitRoutes`, `MapScene.RouteCorridors`): the Burma Road
+ still, the 1949 rail link and the 1950 road not, as they open after the last token leaves the map.
+- `RouteTests.NoKitBuildingOrTreeStandsOnARoute` checks every lot and tree against every segment of those routes by
+ brute force, and logs what the later routes draw over.
## Measurements
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index e819531da..bb30977f2 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -112,9 +112,9 @@ R-SITE-003: Each turn, in ordinal site id order, every site being built has one
## Veteran pioneers
-R-VET-001: In step 5, after its site's progress, a halutz unit whose site is being built gains one turn of service, the turn the site is built included; an idle unit gains none. At `veteran_halutz_service` turns of service it becomes a `veteran_halutz` at the end of that turn, keeping its id, hex, service and project, and a cause says so. A veteran gains no more service. A unit's service is written into the state hash only when it is not 0 (D-D9; Q-VET-1, owner, 17 October 2026, #782).
+R-VET-001: In step 5, after its site's or segment's progress (R-COR-002), a halutz unit whose site or corridor segment is being built gains one turn of service, the turn it is built included; an idle unit gains none. At `veteran_halutz_service` turns of service it becomes a `veteran_halutz` at the end of that turn, keeping its id, hex, service and project, and a cause says so. A veteran gains no more service. A unit's service is written into the state hash only when it is not 0 (D-D9; Q-VET-1, owner, 17 October 2026, #782).
-R-VET-002: A veteran's site being built has `veteran_progress` turns less to go each turn, against a halutz's 1; one with that many or fewer left is built that turn. A veteran does the same pioneer work as a halutz (R-SITE-001) (D-D9; Q-VET-2, owner, 17 October 2026, #782).
+R-VET-002: A veteran's site or corridor segment being built has `veteran_progress` turns less to go each turn, against a halutz's 1; one with that many or fewer left is built that turn. A veteran does the same pioneer work as a halutz (R-SITE-001) (D-D9; Q-VET-2, owner, 17 October 2026, #782).
R-SITE-004: Every designated site has one or more kinds from a fixed list: `yishuv`, `field`, `swamp`, `military_camp` and `hakhshara` (Phase 4, Q-FIELD-1, Q-SWAMP-1, Q-CAMP-3). A pioneer action is accepted only at a site of its kind; any other is refused with the state unchanged and the Attention refunded. A yishuv site has a founding date inside the MVP's years and no other kind has one. A camp site (`military_camp` or `hakhshara`) names a city of `cities.yaml`, the city it trains for (Q-CAMP-1), and no other kind names one. The loader refuses any other row, naming the file and field.
@@ -142,6 +142,16 @@ R-UNIT-001: A military unit is a group at formation scale, one token per formati
R-UNIT-002: A unit's side, strength, order and order target are written into the state hash only when they are not at their default ("" or 0), after its service (R-LOOP-002's rule), so a halutz unit's hash text, and every golden, is unchanged.
+## Corridors
+
+Corridor work is step 5 too, after the sites (Phase 4 PR 2, #786; owner, 17 October 2026, #782: the plan's Q-COR-1 to Q-COR-7 and Q-RAIL-1). `content/corridors.yaml` holds each corridor's kind (`road` or `rail`), names, map route and segments; a segment's hexes are derived from the route's traced line by `tools/corridor_hexes.py`. The Money and turns per segment are labelled design values in `rules.yaml` `mvp:` (Q-COR-6). On screen a segment is its corridor's name and its number ("Burma Road, segment 2"), never a waypoint's name (Q-SENS-1). The MVP's corridors are the Burma Road (four segments), the 1949 Haifa–Tel Aviv rail link (one) and the Tel Aviv–Netanya road (four, on straight draft lines between its five sourced places; owner, 18 October 2026, #786, Q-COR-3 (b)). A segment point in a hex the grid counts as sea (the coast) counts in its nearest land neighbour, as a shore town does.
+
+R-COR-001: `PioneerWork(unit, build_road | build_rail, corridor:N)` starts segment N (from 1) of a corridor whose kind the action builds (`build_road` a road, `build_rail` a railway), when the segment is neither being built nor built, with a halutz unit that has no other project (D-D6). Segments may be started in any order, one unit per segment, so several units can build one corridor at once (Q-COR-4); the unit works from where it stands (Q-COR-5). The Treasury pays the kind's `road_segment_cost` or `rail_segment_cost` at once and borrows the shortfall (R-MONEY-003). It is refused, with the state unchanged and the Attention refunded, for a busy unit, an unknown corridor or segment number, a kind the action does not build, or a segment being built or built; the legacy loop refuses it before charging Attention. Its Attention cost is 0 (D-A6).
+
+R-COR-002: Each turn, after the sites, in ordinal corridor id order and then segment order, every segment being built gains `progress x m` of a turn of work (R-MIN-002), where progress is 1 or `veteran_progress` with a veteran (R-VET-002) and m is Transportation's multiplier, counting the turn of the order. Whole turns apply at once; the fraction is carried on the segment and hashed as 16 hexadecimal digits of its IEEE bit pattern only while non-zero, as in R-SITE-003. A segment whose progress reaches its kind's `road_segment_turns` or `rail_segment_turns` is built, on the turn's end date, and its unit is idle again. Corridors with a segment being built or built are written into the state hash only when there are some.
+
+R-COR-003: A corridor is complete when every one of its segments is built, in any order. `StopWork(unit)` on a unit building a segment ends it as R-SITE-002 does for a site: the segment is unbuilt and free again, the unit is idle, and the progress and the Money paid are lost (D-A3). A built corridor needs no upkeep and yields nothing in the MVP (Q-COR-7).
+
## Movement
Phase 5 PR 5 (#744). The numbers are design values this PR proposed (Q-MOVE-1, Q-MOVE-3; owner, 15 October 2026, #375: "Take all recommendations") and the owner accepted them on 19 October 2026 (https://github.com/eyalgolan/statecraft-israel/pull/1073#issuecomment-6259021508).
@@ -236,7 +246,7 @@ D-H3's first slice in the GDD loop (GDD Phase 7 PR 4, #808): each office's compe
R-MIN-001: Each GDD system named in `mvp.minister_systems` reads its office's cabinet multiplier on the turn's date - the holder's competence factor times the budget factor, `EffectsSystem.Multiplier` - through `EffectsSystem.GddSystemMultiplier` (Q-MIN-1). A system the map does not name is neutral (1.0), and a multiplier within 1e-9 of 1.0 reads as exactly 1.0, so float noise never stalls a neutral system. The loader refuses a map entry whose office `offices.yaml` does not define.
-R-MIN-002: The multiplier scales output and progress a turn (Q-MIN-2): a site being built adds `progress x m` of a turn's work (yishuv and field work, R-SITE-003; a veteran's `veteran_progress` is the progress), a city project adds `1 x m` (housing and industry construction, R-PROJ-003), and absorption houses `floor(refugees x m)` groups a turn (R-CITY-004). The base price and the stated duration stay unchanged. The rounding rule is one: the integer part of the work applies at once, the fraction is carried on the record (R-SITE-003), so no fraction of a turn's work is lost and no whole group is housed early; the hash of a build with no carry is unchanged.
+R-MIN-002: The multiplier scales output and progress a turn (Q-MIN-2): a site being built adds `progress x m` of a turn's work (yishuv and field work, R-SITE-003; a veteran's `veteran_progress` is the progress), a city project adds `1 x m` (housing and industry construction, R-PROJ-003), a corridor segment adds `progress x m` under Transportation (R-COR-002; 1 or a veteran's `veteran_progress`), and absorption houses `floor(refugees x m)` groups a turn (R-CITY-004). The base price and the stated duration stay unchanged. The rounding rule is one: the integer part of the work applies at once, the fraction is carried on the record (R-SITE-003), so no fraction of a turn's work is lost and no whole group is housed early; the hash of a build with no carry is unchanged.
R-MIN-003: When the office does not exist on the date - ended, or not yet created - the system reads the multiplier of the office's named successor, or is neutral (1.0) with none (Q-MIN-3); the absent-holder 0.5 of `EffectsSystem.Multiplier` stays the rule for an office that exists but has no holder on the date.
diff --git a/docs/units.md b/docs/units.md
index c8143330d..f234206e1 100644
--- a/docs/units.md
+++ b/docs/units.md
@@ -245,7 +245,9 @@ The candidates are tried in three rounds:
A spot is clear when:
- the ring's disc stays off every settlement footprint (the kits' discs, times 1.1);
- an army token's three figure spots (always three, so the spot does not change with the call-up), or a parked
- aircraft's centre, are on land and at least 700 m beyond every railway and road corridor;
+ aircraft's centre, are on land and at least 700 m beyond every railway and road corridor drawn while a token
+ stands (a route opened after the last anchor's window, the 1949 rail link or the 1950 Tel Aviv–Netanya road, takes no
+ spot; #786);
- a ship has a sea hex;
- no other anchor whose window overlaps holds the hex.
diff --git a/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs b/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs
new file mode 100644
index 000000000..52bcd8095
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using Statecraft.Sim;
+
+/// <summary>content/corridors.yaml (GDD Phase 4 PR 2, #786): each corridor's kind, names and segments, each an ordered list
+/// of land hexes on the map, one step at a time, and each segment starting where the last one ends. The hexes are derived
+/// from the traced route by tools/corridor_hexes.py; tools/tests/test_corridor_hexes.py checks they match it (Review focus
+/// 3). The Money and turns are design values in rules.yaml mvp: (Q-COR-6). Only the GDD loop reads the file.</summary>
+public class CorridorsContentTests
+{
+ static Content Load(Dictionary<string, string>? extra = null) => ContentLoader.Load(Fixture.Write(Fixture.Gdd(extra)));
+
+ [Fact]
+ public void TheGddFixtureLoadsItsCorridorsAndRules()
+ {
+ var c = Load();
+ Assert.Equal(new[] { "road_a", "rail_a" }, c.Corridors.Select(x => x.Id));
+ var road = c.Corridors[0];
+ Assert.Equal(("road", "Road A", "כביש א", 2), (road.Kind, road.Name, road.NameHe, road.Segments.Count));
+ Assert.Equal(new[] { new[] { 2, 0 }, new[] { 3, 0 } }, road.Segments[0].Hexes.Select(h => h.ToArray()));
+ var m = c.RulesAt(c.Eras[0].From).Mvp!;
+ Assert.Equal((3, 1.5, 2, 3.0), (m.RoadSegmentTurns, m.RoadSegmentCost, m.RailSegmentTurns, m.RailSegmentCost));
+ }
+
+ [Fact]
+ public void TheLegacyLoopReadsNoCorridors()
+ {
+ var c = ContentLoader.Load(Fixture.Write(new Dictionary<string, string> { ["corridors.yaml"] = Fixture.GddCorridors }));
+ Assert.Empty(c.Corridors);
+ }
+
+ /// <summary>The owner's answers of 17 October 2026 (#782): the Burma Road on its traced line, one segment between each pair
+ /// of its five waypoints (Q-COR-1, Q-COR-2), and the 1949 rail link as the Yarkon link alone (Q-RAIL-1); and of 18 October
+ /// 2026 (#786, Q-COR-3 (b)): the Tel Aviv–Netanya road as straight draft lines between its five sourced places, four
+ /// segments.</summary>
+ [Fact]
+ public void TheMvpHasTheBurmaRoadTheRailLinkAndTheNetanyaRoad()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ Assert.Equal(new[] { ("burma_road", "road", 4), ("tlv_haifa_rail", "rail", 1), ("tlv_netanya_road", "road", 4) },
+ c.Corridors.Select(x => (x.Id, x.Kind, x.Segments.Count)));
+ var m = c.Rules.Mvp!;
+ Assert.Equal((6, 2.0, 6, 4.0), (m.RoadSegmentTurns, m.RoadSegmentCost, m.RailSegmentTurns, m.RailSegmentCost)); // Q-COR-6
+ }
+
+ [Fact]
+ public void SegmentsAreContiguousLandHexes()
+ {
+ var c = ContentLoader.Load(RealContentTests.ContentRoot());
+ foreach (var x in c.Corridors)
+ {
+ int[]? prev = null;
+ foreach (var seg in x.Segments)
+ {
+ Assert.NotEmpty(seg.Hexes);
+ foreach (var h in seg.Hexes) Assert.True(c.HexAt(h[0], h[1])?.Land, $"{x.Id}: ({h[0]}, {h[1]})");
+ foreach (var h in seg.Hexes)
+ {
+ if (prev != null) Assert.True(MapActions.Distance(prev[0], prev[1], h[0], h[1]) <= 1, $"{x.Id}: a gap before ({h[0]}, {h[1]})");
+ prev = h.ToArray();
+ }
+ }
+ }
+ }
+
+ [Fact]
+ public void TheCorridorsFileHoldsNoBalanceValue()
+ {
+ var text = File.ReadAllText(Path.Combine(RealContentTests.ContentRoot(), "corridors.yaml"));
+ Assert.DoesNotMatch(@"(?m)^[^#\n]*\b\w*(turns|cost)\w*\s*:", text);
+ }
+
+ static string Cor(string replace, string with) => Fixture.GddCorridors.Replace(replace, with);
+ static string Rules(string mvp) => Fixture.Files["rules.yaml"].Replace("map_action: 1 }", Fixture.GddCosts) + mvp;
+
+ public static IEnumerable<object[]> BadRows() => new List<object[]>
+ {
+ new object[] { "corridors.yaml", Cor("id: rail_a", "id: road_a"), "corridors[road_a].id", "duplicate id" },
+ new object[] { "corridors.yaml", Cor("kind: rail", "kind: canal"), "corridors[rail_a].kind", "unknown kind 'canal' (road, rail)" },
+ new object[] { "corridors.yaml", Cor("name: Road A", "name: ' '"), "corridors[road_a].name", "required" },
+ new object[] { "corridors.yaml", Cor("name_he: כביש א", "name_he: ''"), "corridors[road_a].name_he", "required" },
+ new object[] { "corridors.yaml", Cor("route: road_a", "route: ''"), "corridors[road_a].route", "required" },
+ new object[] { "corridors.yaml", Cor("segments: [{ to: Y, hexes: [[2, 1], [3, 1]] }]", "segments: []"), "corridors[rail_a].segments", "at least one segment" },
+ new object[] { "corridors.yaml", Cor("hexes: [[2, 1], [3, 1]]", "hexes: []"), "corridors[rail_a].segments[1].hexes", "at least one hex" },
+ new object[] { "corridors.yaml", Cor("hexes: [[2, 1], [3, 1]]", "hexes: [[2, 1], [3]]"), "corridors[rail_a].segments[1].hexes", "[q, r] pairs" },
+ new object[] { "corridors.yaml", Cor("hexes: [[2, 1], [3, 1]]", "hexes: [[0, 0], [1, 0]]"), "corridors[rail_a].segments[1].hexes", "hex q=0 r=0 is not a land hex" },
+ new object[] { "corridors.yaml", Cor("hexes: [[2, 1], [3, 1]]", "hexes: [[1, 1], [3, 1]]"), "corridors[rail_a].segments[1].hexes", "hex q=3 r=1 is not next to q=1 r=1" },
+ new object[] { "corridors.yaml", Cor("hexes: [[3, 0], [4, 0]]", "hexes: [[1, 1]]"), "corridors[road_a].segments[2].hexes", "hex q=1 r=1 is not next to q=3 r=0" },
+ new object[] { "corridors.yaml", Cor(" status: draft\n", " status: done\n"), "corridors[road_a].status", "unknown status 'done'" },
+ new object[] { "corridors.yaml", Cor(", checked: 2026-10-15", ""), "corridors[road_a].sources[0]", "url and checked date" },
+ new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("road_segment_turns: 3", "road_segment_turns: 0")), "mvp.road_segment_turns", "must be >= 1" },
+ new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("rail_segment_turns: 2", "rail_segment_turns: 0")), "mvp.rail_segment_turns", "must be >= 1" },
+ new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("road_segment_cost: 1.5", "road_segment_cost: -1")), "mvp.road_segment_cost", "must be a finite number >= 0" },
+ new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("rail_segment_cost: 3", "rail_segment_cost: .nan")), "mvp.rail_segment_cost", "must be a finite number >= 0" },
+ };
+
+ [Theory]
+ [MemberData(nameof(BadRows))]
+ public void ABadValueFailsNamingTheFileAndField(string file, string text, string field, string message)
+ {
+ var ex = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string> { [file] = text }));
+ Assert.Equal(file, ex.File);
+ Assert.Equal(field, ex.Field);
+ Assert.Contains(message, ex.Message);
+ }
+
+ [Fact]
+ public void TheGddLoopNeedsTheCorridorsFile()
+ {
+ var o = Fixture.Gdd();
+ o.Remove("corridors.yaml");
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(o)));
+ Assert.Equal("corridors.yaml", ex.File);
+ Assert.Contains("missing file", ex.Message);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/CorridorsTests.cs b/sim/Statecraft.Sim.Tests/CorridorsTests.cs
new file mode 100644
index 000000000..69eaaa18e
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/CorridorsTests.cs
@@ -0,0 +1,347 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Statecraft.Sim;
+using Statecraft.Sim.Reference;
+
+/// <summary>GDD Phase 4 PR 2 (#786): building corridors segment by segment (R-COR-001 to R-COR-003). The owner took the
+/// plan's recommendations on 17 October 2026 (#782): any unbuilt segment in any order, one unit per segment (Q-COR-4), the
+/// unit works from where it stands (Q-COR-5), the cost is paid in full at the start and borrowed if short, and stopping
+/// loses the progress and returns no Money (Q-COR-6).</summary>
+public class CorridorsTests
+{
+ /// <summary>The GDD fixture with road_a (two segments, 3 turns and IL 1.5m each) and rail_a (one segment, 2 turns and
+ /// IL 3m).</summary>
+ static Content Town() => ContentLoader.Load(Fixture.Write(Fixture.Gdd()));
+
+ static StepResult Step(Content c, GameState s, params Command[] commands) => Simulation.Step(c, s, commands);
+
+ static GameState WithHalutzim(Content c, int n, out int[] ids)
+ {
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ ids = new int[n];
+ for (int i = 0; i < n; i++) { ids[i] = s.NextId++; s.Units.Add(ids[i], new Unit(ids[i], "halutz", 1, 0)); }
+ return s;
+ }
+
+ static PioneerWork Road(int unit, string target = "road_a:1") => new PioneerWork(unit, Corridors.BuildRoad, target);
+
+ // R-COR-001
+ [Fact]
+ public void StartingASegmentCommitsTheUnitAndPaysTheKindsCost()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 1, out var id);
+ var r = Step(c, s, Road(id[0], "road_a:2"));
+ Assert.Empty(r.Rejected);
+ var seg = r.State.Corridors["road_a"].Segments[1]!;
+ Assert.Equal(((int?)id[0], 1, (DateTime?)null), (seg.Unit, seg.Progress, seg.BuiltOn)); // this turn is the first build turn
+ Assert.Null(r.State.Corridors["road_a"].Segments[0]);
+ Assert.True(Projects.IsBusy(r.State, id[0]));
+ Assert.Equal(Step(c, s).State.Treasury - 1.5, r.State.Treasury, 9);
+ Assert.Contains(r.Why, x => x.System == "map" && x.Message == "Road A, segment 2: a group of halutzim began building, cost IL 1.5m");
+ var rail = Step(c, s, new PioneerWork(id[0], Corridors.BuildRail, "rail_a:1"));
+ Assert.Empty(rail.Rejected);
+ Assert.Equal(Step(c, s).State.Treasury - 3, rail.State.Treasury, 9); // the rail kind's cost
+ }
+
+ public static IEnumerable<object[]> Refusals() => new List<object[]>
+ {
+ new object[] { "busy at a site", "That group of halutzim is already building Site A" },
+ new object[] { "busy on a segment", "That group of halutzim is already building Rail A, segment 1" },
+ new object[] { "unknown corridor", "There is no such corridor segment" },
+ new object[] { "segment 0", "There is no such corridor segment" },
+ new object[] { "segment 3", "There is no such corridor segment" },
+ new object[] { "no segment", "There is no such corridor segment" },
+ new object[] { "held", "Road A, segment 1 is already being built" },
+ new object[] { "built", "Road A, segment 1 is already built" },
+ new object[] { "rail on a road", "Road A is not a railway" },
+ new object[] { "road on a rail", "Rail A is not a road" },
+ };
+
+ // R-COR-001: each refusal leaves the state as a step with no order would, so Attention is refunded too.
+ [Theory]
+ [MemberData(nameof(Refusals))]
+ public void TheRefusalsChangeNothing(string limit, string reason)
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 2, out var id);
+ Command order = Road(id[0]);
+ switch (limit)
+ {
+ case "busy at a site": s.Sites["site_a"] = new SiteWork("site_a", id[0], 2, null); break;
+ case "busy on a segment": s.Corridors["rail_a"] = new CorridorWork("rail_a", new SegmentWork?[] { new SegmentWork(id[0], 1, null) }); break;
+ case "unknown corridor": order = Road(id[0], "nowhere:1"); break;
+ case "segment 0": order = Road(id[0], "road_a:0"); break;
+ case "segment 3": order = Road(id[0], "road_a:3"); break;
+ case "no segment": order = Road(id[0], "road_a"); break;
+ case "held": s.Corridors["road_a"] = new CorridorWork("road_a", new SegmentWork?[] { new SegmentWork(id[1], 1, null), null }); break;
+ case "built": s.Corridors["road_a"] = new CorridorWork("road_a", new SegmentWork?[] { new SegmentWork(null, 3, new DateTime(1948, 8, 15)), null }); break;
+ case "rail on a road": order = new PioneerWork(id[0], Corridors.BuildRail, "road_a:1"); break;
+ case "road on a rail": order = Road(id[0], "rail_a:1"); break;
+ }
+ var r = Step(c, s, order);
+ Assert.Equal(reason, Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).State.Hash(), r.State.Hash());
+ }
+
+ // R-COR-001: the legacy loop refuses the order before Corridors sees it.
+ [Fact]
+ public void TheLegacyLoopRefusesARoadOrder()
+ {
+ var c = ContentLoader.Load(Fixture.Write());
+ var s = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);
+ var r = Step(c, s, Road(1, "burma_road:1"));
+ Assert.Equal("That order is not available in this game", Assert.Single(r.Rejected).Reason);
+ Assert.Equal(Step(c, s).State.Hash(), r.State.Hash());
+ }
+
+ // R-COR-002 (Review focus 2: a segment's progress reaches its turns once)
+ [Fact]
+ public void ASegmentIsBuiltOnceAfterItsTurns()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 1, out var id);
+ var r = Step(c, s, Road(id[0])); // turn T: progress 1 of 3
+ r = Step(c, r.State); // T+1: 2 of 3
+ Assert.Equal(2, r.State.Corridors["road_a"].Segments[0]!.Progress);
+ Assert.True(Projects.IsBusy(r.State, id[0]));
+ r = Step(c, r.State); // T+2: built, on the turn's end date
+ var seg = r.State.Corridors["road_a"].Segments[0]!;
+ Assert.Equal(((int?)null, 3, (DateTime?)r.State.Date), (seg.Unit, seg.Progress, seg.BuiltOn));
+ Assert.False(Projects.IsBusy(r.State, id[0]));
+ Assert.Contains(r.Why, x => x.System == "map" && x.Message == "Road A, segment 1 built");
+ var after = Step(c, r.State).State; // nothing more happens to a built segment
+ Assert.Equal(seg.Canonical(), after.Corridors["road_a"].Segments[0]!.Canonical());
+ Assert.False(Corridors.IsComplete(c, after, "road_a"));
+ }
+
+ // R-VET-002 on a segment (#868's rule; the plan's PR 6 names Corridors.cs): a veteran's segment gains veteran_progress
+ // turns of progress a turn, and one with that many or fewer left is built that turn. A veteran gains no more service.
+ [Fact]
+ public void AVeteranBuildsASegmentFaster()
+ {
+ var c = Town(); // road_a: 3 turns a segment; veteran_progress 2
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ var id = s.NextId++;
+ s.Units.Add(id, new Unit(id, "veteran_halutz", 1, 0, 4));
+ var r = Step(c, s, Road(id)); // turn T: 2 of 3
+ Assert.Empty(r.Rejected);
+ Assert.Equal(2, r.State.Corridors["road_a"].Segments[0]!.Progress);
+ r = Step(c, r.State); // T+1: built, at 3 of 3
+ var seg = r.State.Corridors["road_a"].Segments[0]!;
+ Assert.Equal(((int?)null, 3, (DateTime?)r.State.Date), (seg.Unit, seg.Progress, seg.BuiltOn));
+ Assert.Equal(("veteran_halutz", 4), (r.State.Units[id].Type, r.State.Units[id].Service));
+ }
+
+ // R-VET-001 on a segment: a halutz whose segment progressed gains a turn of service, and at veteran_halutz_service it
+ // becomes a veteran at the end of that turn, keeping its segment, which then gains veteran_progress a turn.
+ [Fact]
+ public void WorkOnASegmentCountsAsService()
+ {
+ var c = Town(); // veteran_halutz_service 4
+ var s = WithHalutzim(c, 1, out var id);
+ s.Units[id[0]] = new Unit(id[0], "halutz", 1, 0, 2);
+ var r = Step(c, s, Road(id[0])); // turn T: 1 of 3, service 3
+ Assert.Equal(("halutz", 3), (r.State.Units[id[0]].Type, r.State.Units[id[0]].Service));
+ r = Step(c, r.State); // T+1: 2 of 3 (a halutz's progress), service 4: promoted
+ Assert.Equal(("veteran_halutz", 4), (r.State.Units[id[0]].Type, r.State.Units[id[0]].Service));
+ Assert.Equal(2, r.State.Corridors["road_a"].Segments[0]!.Progress);
+ Assert.True(Projects.IsBusy(r.State, id[0]));
+ Assert.Contains(r.Why, x => x.System == "map" && x.Message == "A group of halutzim became veteran pioneers");
+ r = Step(c, r.State); // T+2: built
+ Assert.NotNull(r.State.Corridors["road_a"].Segments[0]!.BuiltOn);
+ Assert.Equal(4, r.State.Units[id[0]].Service);
+ }
+
+ // R-UNIT-002's fields survive a segment turn and the promotion, as on a site (Projects.Advance).
+ [Fact]
+ public void ASegmentTurnKeepsTheUnitsSideStrengthAndOrder()
+ {
+ var c = Town(); // veteran_halutz_service 4
+ var s = WithHalutzim(c, 1, out var id);
+ s.Units[id[0]] = new Unit(id[0], "halutz", 1, 0, 3, "israel", 5, "hold", "x");
+ var u = Step(c, s, Road(id[0])).State.Units[id[0]]; // service 4: promoted
+ Assert.Equal(("veteran_halutz", "israel", 5, "hold", "x"), (u.Type, u.Side, u.Strength, u.Order, u.OrderTarget));
+ }
+
+ // R-COR-001, R-COR-003 (Q-COR-4: any order, one unit per segment)
+ [Fact]
+ public void TwoUnitsBuildOneCorridorInParallel()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 2, out var id);
+ var r = Step(c, s, Road(id[0], "road_a:2"), Road(id[1], "road_a:1"));
+ Assert.Empty(r.Rejected);
+ Assert.False(Corridors.IsComplete(c, r.State, "road_a"));
+ r = Step(c, Step(c, r.State).State);
+ Assert.True(Corridors.IsComplete(c, r.State, "road_a"));
+ Assert.All(r.State.Corridors["road_a"].Segments, x => Assert.NotNull(x!.BuiltOn));
+ }
+
+ // R-COR-003
+ [Fact]
+ public void ACorridorWithAGapIsNotComplete()
+ {
+ var c = Town();
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ Assert.False(Corridors.IsComplete(c, s, "road_a")); // nothing started
+ s.Corridors["road_a"] = new CorridorWork("road_a", new SegmentWork?[] { null, new SegmentWork(null, 3, new DateTime(1948, 8, 15)) });
+ Assert.False(Corridors.IsComplete(c, s, "road_a"));
+ s.Corridors["road_a"] = new CorridorWork("road_a", new SegmentWork?[] { new SegmentWork(1, 2, null), new SegmentWork(null, 3, new DateTime(1948, 8, 15)) });
+ Assert.False(Corridors.IsComplete(c, s, "road_a"));
+ s.Corridors["rail_a"] = new CorridorWork("rail_a", new SegmentWork?[] { new SegmentWork(null, 3, new DateTime(1948, 8, 15)) });
+ Assert.True(Corridors.IsComplete(c, s, "rail_a"));
+ }
+
+ // R-COR-003 with R-SITE-002's rule (D-A3): the progress is lost and the Money stays paid.
+ [Fact]
+ public void StoppingLosesTheSegmentsProgressAndReturnsNoMoney()
+ {
+ var c = Town();
+ var started = Step(c, WithHalutzim(c, 1, out var id), Road(id[0])).State;
+ var stopped = Step(c, started, new StopWork(id[0]));
+ Assert.Empty(stopped.Rejected);
+ Assert.Empty(stopped.State.Corridors); // no segment of road_a is left with a record
+ Assert.False(Projects.IsBusy(stopped.State, id[0]));
+ Assert.Equal(Step(c, started).State.Treasury, stopped.State.Treasury, 9);
+ Assert.Contains(stopped.Why, x => x.System == "map" && x.Message == "Road A, segment 1: the halutzim stopped building; the Money spent is not returned");
+ var again = Step(c, stopped.State, Road(id[0]));
+ Assert.Empty(again.Rejected);
+ Assert.Equal(1, again.State.Corridors["road_a"].Segments[0]!.Progress);
+ }
+
+ // R-COR-001: a short Treasury borrows the shortfall (Q-MONEY-3, as for sites).
+ [Fact]
+ public void AShortTreasuryBorrows()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 1, out var id);
+ s.Treasury = 0.5;
+ s.Debt = 3;
+ var why = new List<Cause>();
+ Assert.Null(Projects.Start(c, s, id[0], Corridors.BuildRoad, "road_a:1", why));
+ Assert.Equal((0.0, 4.0), (s.Treasury, s.Debt));
+ Assert.Contains(why, x => x.System == "economy" && x.Target == "debt" && x.Message == "Borrowed IL 1.0m to build a corridor segment");
+ }
+
+ // R-COR-002: corridors advance after sites, in ordinal corridor id, then segment index.
+ [Fact]
+ public void CorridorsAdvanceInIdThenSegmentOrderAfterSites()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 3, out var id);
+ s.Sites["site_a"] = new SiteWork("site_a", id[0], 1, null);
+ s.Corridors["road_a"] = new CorridorWork("road_a", new SegmentWork?[] { new SegmentWork(id[1], 2, null), null });
+ s.Corridors["rail_a"] = new CorridorWork("rail_a", new SegmentWork?[] { new SegmentWork(id[2], 1, null) });
+ var built = Step(c, s).Why.Where(x => x.System == "map").Select(x => x.Message).ToList();
+ Assert.Equal(new[] { "Site A founded", "Rail A, segment 1 built", "Road A, segment 1 built" }, built);
+ }
+
+ // R-COR-001
+ [Fact]
+ public void TheOrderSurvivesASave()
+ {
+ var c = Town();
+ var g = GameSession.New(c, 1, Mode.Historical);
+ g.Step(new Command[] { new Train("town_a", "halutz", 1) });
+ g.Step(new Command[0]);
+ g.Step(new Command[0]);
+ var id = Assert.Single(g.State.Units.Keys);
+ g.Step(new Command[] { new PioneerWork(id, Corridors.BuildRail, "rail_a:1") });
+ var text = g.Save.Write();
+ Assert.Contains($"\npioneer {id} build_rail rail_a%3A1\n", text); // the save escapes the colon
+ var loaded = GameSession.Load(c, text, out _).State;
+ Assert.Equal(g.State.Hash(), loaded.Hash());
+ Assert.Single(loaded.Corridors);
+ }
+
+ // R-COR-001: the reference player's stated policy (D-A7): yishuv sites first (then ready fields and camp sites, none in
+ // this fixture), then the lowest unbuilt, unclaimed segment of the lowest-id corridor, with the action its kind takes.
+ [Fact]
+ public void TheReferencePlayerTakesTheLowestFreeSegmentOnceTheSitesAreTaken()
+ {
+ var c = Town();
+ var s = WithHalutzim(c, 3, out var id);
+ s.Treasury = 10;
+ var orders = ReferencePlayer.Commands(c, s).OfType<PioneerWork>().Select(p => (p.Unit, p.Action, p.Site)).ToList();
+ Assert.Equal(new[] { (id[0], Projects.BuildYishuv, "site_a"), (id[1], Corridors.BuildRail, "rail_a:1"), (id[2], Corridors.BuildRoad, "road_a:1") }, orders);
+ Assert.Empty(Step(c, s, ReferencePlayer.Commands(c, s).ToArray()).Rejected);
+ }
+
+ static Content TransportationTown()
+ {
+ var files = Fixture.Gdd();
+ files["offices.yaml"] = Fixture.Files["offices.yaml"] + @" - id: transportation_minister
+ title: Minister of Transportation
+";
+ files["rules.yaml"] = files["rules.yaml"]
+ .Replace("budget_start: { finance_minister: 1.0 }", "budget_start: { transportation_minister: 1.0, finance_minister: 0.0 }")
+ + @" minister_systems:
+ corridors: transportation_minister
+";
+ return ContentLoader.Load(Fixture.Write(files));
+ }
+
+ // R-MIN-002/R-COR-002: actual Transportation output is fractional work, not rounded away each turn.
+ [Theory]
+ [InlineData(false)]
+ [InlineData(true)]
+ public void TransportationScalesActualSegmentProgress(bool veteran)
+ {
+ var c = TransportationTown();
+ var s = WithHalutzim(c, 1, out var ids);
+ if (veteran) s.Units[ids[0]] = new Unit(ids[0], Projects.VeteranType, 1, 0, 4);
+ Assert.Equal(0.75, EffectsSystem.GddSystemMultiplier(c, s, c.Rules.Mvp!, "corridors"), 9);
+ Assert.Equal(3, c.Rules.Mvp!.RoadSegmentTurns);
+ var first = Step(c, s, Road(ids[0]));
+ Assert.Empty(first.Rejected);
+ s = first.State;
+ Assert.Equal(veteran ? 1 : 0, s.Corridors["road_a"].Segments[0]!.Progress);
+ Assert.Null(s.Corridors["road_a"].Segments[0]!.BuiltOn);
+ // Same integer progress is insufficient state: the actual fraction must reach the hash.
+ Assert.NotEqual(new SegmentWork(ids[0], veteran ? 1 : 0, null).Canonical(),
+ s.Corridors["road_a"].Segments[0]!.Canonical());
+ Assert.Equal(s.Hash(), s.Clone().Hash());
+ var startedHash = s.Hash();
+ var second = Step(c, s);
+ Assert.Equal(startedHash, s.Hash()); // the real step advances a clone, not its input
+ s = second.State;
+ if (!veteran)
+ {
+ Assert.Equal(1, s.Corridors["road_a"].Segments[0]!.Progress); // 0.75 + 0.75 carries through the whole turn
+ Assert.Null(s.Corridors["road_a"].Segments[0]!.BuiltOn);
+ s = Step(c, s).State;
+ Assert.Equal(2, s.Corridors["road_a"].Segments[0]!.Progress);
+ Assert.Null(s.Corridors["road_a"].Segments[0]!.BuiltOn);
+ s = Step(c, s).State;
+ }
+ var built = s.Corridors["road_a"].Segments[0]!;
+ Assert.Equal(3, built.Progress);
+ Assert.Equal(s.Date, built.BuiltOn);
+ Assert.False(Projects.IsBusy(s, ids[0]));
+ Assert.Equal(new SegmentWork(null, 3, s.Date).Canonical(), built.Canonical());
+ }
+
+ [Fact]
+ public void TransportationCarryReplaysAndStoppingDiscardsIt()
+ {
+ var c = TransportationTown();
+ var g = GameSession.New(c, 1, Mode.Historical);
+ g.Step(new Command[] { new Train("town_a", "halutz", 1) });
+ g.Step(Array.Empty<Command>()); g.Step(Array.Empty<Command>());
+ var id = Assert.Single(g.State.Units.Keys);
+ g.Step(new Command[] { Road(id) });
+ Assert.Equal(0, g.State.Corridors["road_a"].Segments[0]!.Progress);
+ var saved = g.Save.Write();
+ var replay = GameSession.Load(c, saved, out _);
+ Assert.Equal(g.State.Hash(), replay.State.Hash());
+ g.Step(Array.Empty<Command>()); replay.Step(Array.Empty<Command>());
+ Assert.Equal(1, g.State.Corridors["road_a"].Segments[0]!.Progress);
+ Assert.Equal(g.State.Hash(), replay.State.Hash());
+ g.Step(new Command[] { new StopWork(id) });
+ Assert.Empty(g.State.Corridors);
+ g.Step(new Command[] { Road(id) });
+ Assert.Equal(0, g.State.Corridors["road_a"].Segments[0]!.Progress);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
index d5c7e2bff..82725cab2 100644
--- a/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
+++ b/sim/Statecraft.Sim.Tests/DesignValuesTests.cs
@@ -42,6 +42,10 @@ public class DesignValuesTests
("rules.yaml", "mvp.dry_swamp_turns"),
("rules.yaml", "mvp.dry_swamp_cost"),
("rules.yaml", "mvp.field_food_per_turn"),
+ ("rules.yaml", "mvp.road_segment_turns"),
+ ("rules.yaml", "mvp.road_segment_cost"),
+ ("rules.yaml", "mvp.rail_segment_turns"),
+ ("rules.yaml", "mvp.rail_segment_cost"),
("rules.yaml", "mvp.objective_points"),
("rules.yaml", "mvp.objective_bonus_per_month"),
("rules.yaml", "mvp.objective_bonus_cap"),
@@ -228,6 +232,7 @@ public class DesignValuesTests
Assert.Equal((0.5, 1.0, 0.5), (c.Rules.AttentionCost["assign_workers"], c.Rules.AttentionCost["train"], c.Rules.AttentionCost["cancel_training"]));
Assert.Equal((0.0, 0.0), (c.Rules.AttentionCost["pioneer_work"], c.Rules.AttentionCost["stop_work"])); // D-A6: unit orders are free
Assert.Equal((6, 2.0), (m.BuildYishuvTurns, m.BuildYishuvCost));
+ Assert.Equal((6, 2.0, 6, 4.0), (m.RoadSegmentTurns, m.RoadSegmentCost, m.RailSegmentTurns, m.RailSegmentCost)); // Q-COR-6
Assert.Equal((100, 5, 60), (m.ObjectivePoints, m.ObjectiveBonusPerMonth, m.ObjectiveBonusCap)); // D-B6, D-B2
Assert.Equal((0.35, 0.15), (m.HousingStartCondition, m.OverflowConditionLoss)); // Q-START-3, Q-HOUSE-1 (D-D1)
Assert.Equal((5, 0.5), (m.DelegationLoyaltyFloor, m.DisloyalEffectShare)); // R-EVT-003, #107 (D-H1)
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index 7f20c1a1d..3db359faa 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -234,6 +234,7 @@ series:
["unit_types.yaml"] = GddUnitTypes,
["sites.yaml"] = GddSites,
["projects.yaml"] = GddProjects,
+ ["corridors.yaml"] = GddCorridors,
};
if (extra != null) foreach (var kv in extra) o[kv.Key] = kv.Value;
return o;
@@ -263,6 +264,10 @@ mvp:
dry_swamp_turns: 3
dry_swamp_cost: 2
field_food_per_turn: 7
+ road_segment_turns: 3
+ road_segment_cost: 1.5
+ rail_segment_turns: 2
+ rail_segment_cost: 3
objective_points: 100
objective_bonus_per_month: 5
objective_bonus_cap: 60
@@ -316,6 +321,32 @@ projects:
/// <summary>A projects.yaml kind that requires vineyards (R-PROJ-005), to add to <see cref="GddProjects"/>. Fixture values.</summary>
public const string Winery = " - { id: winery, name: a winery, cost: 2, turns: 2, capacity: 0, condition: 0, job_slots: 6, requires: vineyards }\n";
+ /// <summary>Two corridors on the fixture's land hexes, in file order: road_a, two segments along r = 0, and rail_a, one
+ /// segment along r = 1. Fixture values, not history.</summary>
+ public const string GddCorridors = @"
+corridors:
+ - id: road_a
+ kind: road
+ name: Road A
+ name_he: כביש א
+ route: road_a
+ segments:
+ - { to: X, hexes: [[2, 0], [3, 0]] }
+ - { to: Y, hexes: [[3, 0], [4, 0]] }
+ sources:
+ - { url: ""https://example.org/road_a"", checked: 2026-10-15 }
+ status: draft
+ - id: rail_a
+ kind: rail
+ name: Rail A
+ name_he: מסילה א
+ route: rail_a
+ segments: [{ to: Y, hexes: [[2, 1], [3, 1]] }]
+ sources:
+ - { url: ""https://example.org/rail_a"", checked: 2026-10-15 }
+ status: draft
+";
+
/// <summary>One designated site on a land hex next to town_a, with no settlement on it. Fixture values, not history.</summary>
public const string GddSites = @"
sites:
diff --git a/sim/Statecraft.Sim.Tests/GddStateTests.cs b/sim/Statecraft.Sim.Tests/GddStateTests.cs
index 9ea1a8391..168a7e29f 100644
--- a/sim/Statecraft.Sim.Tests/GddStateTests.cs
+++ b/sim/Statecraft.Sim.Tests/GddStateTests.cs
@@ -39,6 +39,7 @@ public class GddStateTests
("units[", x => x.Units.Add(1, new Unit(1, "halutz", -3, 19))),
("train[", x => x.Cohorts.Add(2, new Cohort(2, "recruit", "tel_aviv", 3, 2))),
("site{", x => x.Sites["mefalsim"] = new SiteWork("mefalsim", 1, 5, null)),
+ ("corr{", x => x.Corridors["burma_road"] = new CorridorWork("burma_road", new SegmentWork?[] { null, new SegmentWork(1, 2, null) })),
("next=", x => x.NextId = 2),
("obj{", x => x.Objectives["first_new_yishuv"] = new DateTime(1949, 3, 15)),
("score=", x => x.Score = 5),
@@ -92,6 +93,20 @@ public class GddStateTests
Assert.Equal("1:veteran_halutz@0,0/6", new Unit(1, "veteran_halutz", 0, 0, 6).Canonical());
}
+ // R-LOOP-002, R-COR-002: a corridor's segments in index order, each unstarted, being built or built.
+ [Fact]
+ public void ACorridorIsHashedSegmentBySegment()
+ {
+ var w = new CorridorWork("burma_road", new SegmentWork?[] { null, new SegmentWork(4, 2, null), new SegmentWork(null, 3, new DateTime(1948, 12, 15)) });
+ Assert.Equal("burma_road=-;b,4,2;done,1948-12-15", w.Canonical());
+ Assert.Throws<ArgumentException>(() => new SegmentWork(null, 1, null)); // a segment being built has its unit
+ Assert.Throws<ArgumentException>(() => new SegmentWork(0, 1, new DateTime(1949, 3, 15)));
+ string H(CorridorWork x) { var s = new GameState(); s.Corridors[x.Id] = x; return s.Hash(); }
+ var all = new[] { w, new CorridorWork("b", w.Segments.ToArray()), new CorridorWork("burma_road", new SegmentWork?[] { null, new SegmentWork(5, 2, null), w.Segments[2] }),
+ new CorridorWork("burma_road", new SegmentWork?[] { null, new SegmentWork(4, 3, null), w.Segments[2] }), new CorridorWork("burma_road", new SegmentWork?[] { w.Segments[1], null, w.Segments[2] }) };
+ Assert.Equal(all.Length, new HashSet<string>(Array.ConvertAll(all, H)).Count);
+ }
+
// R-SITE-003: a built site holds no unit. Unit ids start at 0, so "no unit" is null, never 0: unit 0 is free once its
// site is built, and a record cannot be built and have a unit, or be building without one.
[Fact]
@@ -140,13 +155,14 @@ public class GddStateTests
a.Units.Add(1, new Unit(1, "halutz", 0, 0));
a.Cohorts.Add(2, new Cohort(2, "recruit", "x", 1, 1));
a.Sites["s"] = new SiteWork("s", 1, 1, null);
+ a.Corridors["c"] = new CorridorWork("c", new SegmentWork?[] { new SegmentWork(1, 1, null) });
a.Objectives["o"] = new DateTime(1949, 1, 1);
a.NextId = 2; a.Score = 3;
var before = a.Hash();
var b = a.Clone();
- b.Cities["y"] = a.Cities["x"]; b.Units.Add(2, a.Units[1]); b.Cohorts.Clear(); b.Sites.Clear(); b.Objectives.Clear(); b.NextId = 9; b.Score = 9;
+ b.Cities["y"] = a.Cities["x"]; b.Units.Add(2, a.Units[1]); b.Cohorts.Clear(); b.Sites.Clear(); b.Corridors.Clear(); b.Objectives.Clear(); b.NextId = 9; b.Score = 9;
Assert.Equal(before, a.Hash());
- Assert.Single(a.Cities); Assert.Single(a.Units); Assert.Single(a.Cohorts); Assert.Single(a.Sites); Assert.Single(a.Objectives);
+ Assert.Single(a.Cities); Assert.Single(a.Units); Assert.Single(a.Cohorts); Assert.Single(a.Sites); Assert.Single(a.Corridors); Assert.Single(a.Objectives);
}
[Fact]
diff --git a/sim/Statecraft.Sim.Tests/MinistersGddTests.cs b/sim/Statecraft.Sim.Tests/MinistersGddTests.cs
index 800fea552..2e2b86357 100644
--- a/sim/Statecraft.Sim.Tests/MinistersGddTests.cs
+++ b/sim/Statecraft.Sim.Tests/MinistersGddTests.cs
@@ -8,7 +8,7 @@ using Xunit;
/// docs/superpowers/plans/2026-10-15-gdd-phase-7.md): R-MIN-001 (each named system reads its office's multiplier,
/// Q-MIN-1), R-MIN-002 (the multiplier scales output and progress per turn, rounded by the one stated rule: floor with
/// carry, so no fraction of a turn or a person enters the state, Q-MIN-2) and R-MIN-003 (an ended office reads its named
-/// successor, or is neutral 1.0 with none, Q-MIN-3). Corridors and military training stay unmapped until #870 and #742.</summary>
+/// successor, or is neutral 1.0 with none, Q-MIN-3). Military training stays unmapped until #742.</summary>
public class MinistersGddTests
{
/// <summary>The base GDD fixture plus the three offices of the slice, each with a budget line, and the
@@ -233,6 +233,7 @@ offices:
["field_work"] = "agriculture_minister",
["yishuv_work"] = "agriculture_minister",
["absorption"] = "immigration_minister",
+ ["corridors"] = "transportation_minister",
}, m);
}
diff --git a/sim/Statecraft.Sim.Tests/MovementTests.cs b/sim/Statecraft.Sim.Tests/MovementTests.cs
index 5724f6f47..045ea2229 100644
--- a/sim/Statecraft.Sim.Tests/MovementTests.cs
+++ b/sim/Statecraft.Sim.Tests/MovementTests.cs
@@ -38,7 +38,11 @@ public class MovementTests
static Content Load(string board, params (string From, string To)[] edits)
{
- var files = Fixture.Gdd(new Dictionary<string, string> { ["unit_types.yaml"] = Types, ["map/hexes.json"] = board });
+ // This custom movement board has no buildable corridors; the shared fixture's corridors belong to its own map.
+ var files = Fixture.Gdd(new Dictionary<string, string>
+ {
+ ["unit_types.yaml"] = Types, ["map/hexes.json"] = board, ["corridors.yaml"] = "corridors: []\n"
+ });
foreach (var (from, to) in edits) files["rules.yaml"] = files["rules.yaml"].Replace(from, to);
return ContentLoader.Load(Fixture.Write(files));
}
diff --git a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
index eab323f10..9bb71a0bb 100644
--- a/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
+++ b/sim/Statecraft.Sim.Tests/PlayerTextTests.cs
@@ -284,7 +284,8 @@ public class PlayerTextTests
bad.Add("money without a unit: " + w.Message);
if (w.System == "map") // "Built a housing project: cost IL 6.0m, Housing +3.0%, ...": every number with its unit
{
- if (Regex.IsMatch(Regex.Replace(Regex.Replace(w.Message, @"\(-?\d+, -?\d+\)", ""), @"[+-]?(IL |\$)\d+\.\dm|[+-]?\d+(\.\d)?%", ""), @"\d"))
+ // A hex "(q, r)" and a corridor's "segment N" (R-COR-001, Q-SENS-1) are names, not amounts.
+ if (Regex.IsMatch(Regex.Replace(Regex.Replace(w.Message, @"\(-?\d+, -?\d+\)|segment \d+", ""), @"[+-]?(IL |\$)\d+\.\dm|[+-]?\d+(\.\d)?%", ""), @"\d"))
bad.Add("map line number without a unit: " + w.Message);
}
else if (indicators.Contains(w.Target) && Regex.IsMatch(Regex.Replace(w.Message, @"[+-]?\d+(\.\d)?%", ""), @"\d"))
diff --git a/sim/Statecraft.Sim.Tests/ProjectsTests.cs b/sim/Statecraft.Sim.Tests/ProjectsTests.cs
index 995e422df..4eb87b2f3 100644
--- a/sim/Statecraft.Sim.Tests/ProjectsTests.cs
+++ b/sim/Statecraft.Sim.Tests/ProjectsTests.cs
@@ -74,7 +74,7 @@ public class ProjectsTests
{
case "unknown unit": order = Build(999); break;
case "busy": s.Sites["site_b"] = new SiteWork("site_b", id, 2, null); break;
- case "unknown action": order = new PioneerWork(id, "build_road", "site_a"); break;
+ case "unknown action": order = new PioneerWork(id, "dig_well", "site_a"); break; // build_road is a corridor action since #786
case "unknown site": order = Build(id, "nowhere"); break;
case "not a yishuv site": order = Build(id, "site_b"); break;
case "being built": s.Sites["site_a"] = new SiteWork("site_a", other, 2, null); break; // question 15: one unit per site
diff --git a/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs b/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
index 0e119055e..0093d4844 100644
--- a/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
+++ b/sim/Statecraft.Sim.Tests/ReferencePlayerTests.cs
@@ -132,10 +132,17 @@ public class ReferencePlayerTests
none.Sites["mefalsim_field"] = SiteWork.Built("mefalsim_field", new DateTime(1949, 6, 15));
var camp = Assert.Single(ReferencePlayer.Commands(Mvp, none).OfType<PioneerWork>());
Assert.Equal((8, "build_camp", "camp_80"), (camp.Unit, camp.Action, camp.Site));
- // Every camp site taken as well: the idle group waits.
+ // Every camp site taken as well: the idle group takes the lowest free corridor segment (R-COR-001).
none.Sites["camp_80"] = SiteWork.Built("camp_80", new DateTime(1949, 6, 15));
none.Sites["tzrifin"] = SiteWork.Built("tzrifin", new DateTime(1949, 6, 15));
- Assert.DoesNotContain(ReferencePlayer.Commands(Mvp, none), x => x is PioneerWork);
+ var road = Assert.Single(ReferencePlayer.Commands(Mvp, none).OfType<PioneerWork>());
+ Assert.Equal((8, "build_road", "burma_road:1"), (road.Unit, road.Action, road.Site));
+ Assert.Empty(Simulation.Step(Mvp, none, ReferencePlayer.Commands(Mvp, none)).Rejected);
+ // Two idle groups: each takes the next free segment.
+ none.Sites["reim"] = SiteWork.Built("reim", new DateTime(1949, 12, 15));
+ none.Sites["reim_field"] = SiteWork.Built("reim_field", new DateTime(1949, 12, 15));
+ Assert.Equal(new[] { (7, "burma_road:1"), (8, "burma_road:2") },
+ ReferencePlayer.Commands(Mvp, none).OfType<PioneerWork>().Select(p => (p.Unit, p.Site)));
var poor = s.Clone();
poor.Treasury = 0;
Assert.Contains(ReferencePlayer.Commands(Mvp, poor), x => x is PioneerWork);
diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.cs
index b898e0a31..90ba6c397 100644
--- a/sim/Statecraft.Sim/Content.cs
+++ b/sim/Statecraft.Sim/Content.cs
@@ -548,6 +548,14 @@ namespace Statecraft.Sim
/// <summary>Food units a plowed field adds to the national stock each turn, in step 6 (R-FIELD-002; Q-FIELD-3). Required
/// in the GDD loop, so a missing key is never read as 0.</summary>
public int? FieldFoodPerTurn { get; set; }
+ /// <summary>Turns a road segment takes, counting the turn it was ordered in (R-COR-002; Q-COR-6, a design value).</summary>
+ public int RoadSegmentTurns { get; set; }
+ /// <summary>IL millions a road segment costs, paid in full when it starts (R-COR-001; Q-COR-6, a design value).</summary>
+ public double RoadSegmentCost { get; set; }
+ /// <summary>Turns a rail segment takes (R-COR-002; Q-COR-6, a design value).</summary>
+ public int RailSegmentTurns { get; set; }
+ /// <summary>IL millions a rail segment costs (R-COR-001; Q-COR-6, a design value).</summary>
+ public double RailSegmentCost { get; set; }
/// <summary>Points for each completed objective (R-OBJ-002; D-B6, #456).</summary>
public int? ObjectivePoints { get; set; }
/// <summary>Bonus points for each calendar month an objective is completed before its reference date's month (R-OBJ-002; D-B2, #456).</summary>
@@ -664,6 +672,33 @@ namespace Statecraft.Sim
string? reviewedOn;
}
+ /// <summary>A corridor (corridors.yaml, GDD Phase 4 PR 2): a road or a railway the pioneers build segment by segment
+ /// (R-COR-001 to R-COR-003). Sourced facts and the derived hexes only: the Money and turns are rules (MvpRules).</summary>
+ public sealed class CorridorDef
+ {
+ public string Id { get; set; } = "";
+ /// <summary>road or rail: which action builds it (build_road, build_rail) and which rules price it.</summary>
+ public string Kind { get; set; } = "";
+ public string Name { get; set; } = "";
+ public string NameHe { get; set; } = "";
+ /// <summary>The map route (map/routes_1948.yaml) the corridor follows. Map-only: the sim reads the hexes, and
+ /// tools/tests/test_corridor_hexes.py checks the route exists and the hexes are its traced line's.</summary>
+ public string Route { get; set; } = "";
+ /// <summary>In order along the route; numbered from 1 in orders and on screen (corridor:segment).</summary>
+ public List<SegmentDef> Segments { get; set; } = new List<SegmentDef>();
+ public List<Source> Sources { get; set; } = new List<Source>();
+ public string Status { get; set; } = "";
+ }
+
+ /// <summary>One segment of a corridor: the hexes its stretch of the traced line crosses, in order, ending at the route
+ /// waypoint <see cref="To"/> (map data, never shown: Q-SENS-1).</summary>
+ public sealed class SegmentDef
+ {
+ public string To { get; set; } = "";
+ /// <summary>[q, r] pairs, generated by tools/corridor_hexes.py.</summary>
+ public List<List<int>> Hexes { get; set; } = new List<List<int>>();
+ }
+
/// <summary>One start value of a city (cities.yaml), with what it is (R-CITY-006): `sourced` (read from the source named),
/// `derived` (computed from sourced values), `wikipedia-only` (an owner-accepted Wikipedia figure) or `design` (a
/// labelled design value, not a historical figure; R-LOOP-005). The first three name their sources, with checked dates,
@@ -1151,6 +1186,8 @@ namespace Statecraft.Sim
public List<Site> Sites = new List<Site>();
/// <summary>The GDD city project kinds (projects.yaml), in file order. Empty in the legacy loop.</summary>
public List<ProjectKind> ProjectKinds = new List<ProjectKind>();
+ /// <summary>The corridors (corridors.yaml), in file order; empty in the legacy loop.</summary>
+ public List<CorridorDef> Corridors = new List<CorridorDef>();
/// <summary>The objectives (objectives.yaml), ordered by id. Read in both loops, since their cards are events; only the
/// GDD loop completes them. Empty when the content has no objectives.yaml.</summary>
public List<Objective> Objectives = new List<Objective>();
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index 24e2b7430..44644a0b4 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -51,6 +51,7 @@ namespace Statecraft.Sim
sealed class UnitTypesFile { public List<UnitType> Types { get; set; } = new List<UnitType>(); }
sealed class SitesFile { public List<Site> Sites { get; set; } = new List<Site>(); }
sealed class ProjectsFile { public List<ProjectKind> Projects { get; set; } = new List<ProjectKind>(); }
+ sealed class CorridorsFile { public List<CorridorDef> Corridors { get; set; } = new List<CorridorDef>(); }
sealed class ObjectivesFile { public List<Objective> Objectives { get; set; } = new List<Objective>(); }
public const string HexesFile = "map/hexes.json";
@@ -372,6 +373,7 @@ namespace Statecraft.Sim
c.UnitTypes = Read<UnitTypesFile>(readFile, "unit_types.yaml").Types;
c.Sites = Read<SitesFile>(readFile, "sites.yaml").Sites; // sourced facts (Phase 1 PR 5)
c.ProjectKinds = Read<ProjectsFile>(readFile, "projects.yaml").Projects; // design values (Phase 3 PR 4)
+ c.Corridors = Read<CorridorsFile>(readFile, "corridors.yaml").Corridors; // sourced, hexes derived (Phase 4 PR 2)
ValidateGdd(c, settlementIds);
}
EventRules.ValidateStructured(c); // R-EFX-006: after the GDD records it names are read
@@ -1156,6 +1158,10 @@ namespace Statecraft.Sim
if (!(m.DrySwampCost >= 0 && IsFinite(m.DrySwampCost.Value))) throw new ContentException(file, "mvp.dry_swamp_cost", "must be a finite number >= 0");
if (m.FieldFoodPerTurn == null) throw new ContentException(file, "mvp.field_food_per_turn", "required when eras.yaml systems.loop is gdd");
if (m.FieldFoodPerTurn < 0) throw new ContentException(file, "mvp.field_food_per_turn", "must be >= 0");
+ if (m.RoadSegmentTurns < 1) throw new ContentException(file, "mvp.road_segment_turns", "must be >= 1");
+ if (!(m.RoadSegmentCost >= 0 && IsFinite(m.RoadSegmentCost))) throw new ContentException(file, "mvp.road_segment_cost", "must be a finite number >= 0");
+ if (m.RailSegmentTurns < 1) throw new ContentException(file, "mvp.rail_segment_turns", "must be >= 1");
+ if (!(m.RailSegmentCost >= 0 && IsFinite(m.RailSegmentCost))) throw new ContentException(file, "mvp.rail_segment_cost", "must be a finite number >= 0");
// R-FOOD-001 to R-FOOD-003: required, so a missing key is never read as 0 (a stock term of 0, or no stock).
if (m.KFood == null) throw new ContentException(file, "mvp.k_food", "required when eras.yaml systems.loop is gdd");
if (!(m.KFood >= 0 && m.KFood <= 1)) throw new ContentException(file, "mvp.k_food", "must be between 0 and 1");
@@ -1239,6 +1245,7 @@ namespace Statecraft.Sim
ValidateObjectiveSites(c);
ValidateEventSites(c);
ValidateProjects(c);
+ ValidateCorridors(c);
}
/// <summary>An event's site (R-SWAMP-002): a designated swamp site, whose works the event is about. Only the GDD loop
@@ -1276,6 +1283,47 @@ namespace Statecraft.Sim
}
}
+ /// <summary>The corridors (corridors.yaml, Phase 4 PR 2): a known kind, names, a route id, and segments whose hexes are
+ /// land hexes of the map, each one step from the last, the first of a segment one step from (or on) the last of the one
+ /// before (Review focus 2: no corridor with a gap). That the route exists in map/routes_1948.yaml and the hexes are its
+ /// traced line's is checked by tools/tests/test_corridor_hexes.py: the sim does not read the map-only route files.</summary>
+ static void ValidateCorridors(Content c)
+ {
+ const string cf = "corridors.yaml";
+ Unique(cf, "corridors", c.Corridors.Select(x => x.Id));
+ foreach (var x in c.Corridors)
+ {
+ var at = $"corridors[{x.Id}]";
+ if (x.Kind != Corridors.Road && x.Kind != Corridors.Rail) throw new ContentException(cf, at + ".kind", $"unknown kind '{x.Kind}' (road, rail)");
+ Named(cf, at + ".name", x.Name);
+ Named(cf, at + ".name_he", x.NameHe);
+ if (string.IsNullOrWhiteSpace(x.Route)) throw new ContentException(cf, at + ".route", "required: the map route the corridor follows");
+ if (x.Segments.Count == 0) throw new ContentException(cf, at + ".segments", "needs at least one segment");
+ List<int>? prev = null;
+ for (int i = 0; i < x.Segments.Count; i++)
+ {
+ var sat = FormattableString.Invariant($"{at}.segments[{i + 1}].hexes");
+ var hexes = x.Segments[i].Hexes;
+ if (hexes.Count == 0) throw new ContentException(cf, sat, "needs at least one hex");
+ foreach (var h in hexes)
+ {
+ if (h == null || h.Count != 2) throw new ContentException(cf, sat, "must be [q, r] pairs");
+ var hex = c.HexAt(h[0], h[1]);
+ if (hex == null || !hex.Land)
+ throw new ContentException(cf, sat, FormattableString.Invariant($"hex q={h[0]} r={h[1]} is not a land hex in {HexesFile}"));
+ if (prev != null && MapActions.Distance(prev[0], prev[1], h[0], h[1]) > 1)
+ throw new ContentException(cf, sat, FormattableString.Invariant($"hex q={h[0]} r={h[1]} is not next to q={prev[0]} r={prev[1]}"));
+ prev = h;
+ }
+ }
+ if (x.Sources.Count == 0) throw new ContentException(cf, at + ".sources", "required: a corridor is a historical fact");
+ for (int i = 0; i < x.Sources.Count; i++)
+ if (x.Sources[i] == null || string.IsNullOrWhiteSpace(x.Sources[i].Url) || x.Sources[i].Checked == default)
+ throw new ContentException(cf, FormattableString.Invariant($"{at}.sources[{i}]"), "needs a url and checked date");
+ Status(cf, at + ".status", x.Status);
+ }
+ }
+
/// <summary>An objective's site (R-OBJ-001): a designated site of kind yishuv, whose sourced founding date is the
/// objective's reference date, so the card and the site cannot disagree. Only the GDD loop reads sites.yaml, so only
/// it can check this; EventRules checks the rest of objectives.yaml in both loops.</summary>
diff --git a/sim/Statecraft.Sim/Corridors.cs b/sim/Statecraft.Sim/Corridors.cs
new file mode 100644
index 000000000..702d7ce1a
--- /dev/null
+++ b/sim/Statecraft.Sim/Corridors.cs
@@ -0,0 +1,130 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+
+namespace Statecraft.Sim
+{
+ /// <summary>The GDD v0.1 corridors (docs/GDD.md "Pioneer work": build road, build railroad; docs/gdd/corridors.md; Phase 4
+ /// PR 2, #786): a halutz unit builds one segment of a corridor (corridors.yaml) over several turns, one project per unit
+ /// (D-D6). The owner took the plan's recommendations on 17 October 2026 (#782): any unbuilt segment in any order, one unit
+ /// per segment (Q-COR-4); the unit works from where it stands (Q-COR-5); the cost is paid in full at the start and
+ /// borrowed if short, and stopping loses the progress and returns no Money (Q-COR-6); a built corridor needs no upkeep and
+ /// yields nothing (Q-COR-7). A segment is named on screen by its corridor's name and its number (Q-SENS-1). Runs only when
+ /// eras.yaml systems.loop is gdd; Projects dispatches to it.</summary>
+ public static class Corridors
+ {
+ public const string BuildRoad = "build_road";
+ public const string BuildRail = "build_rail";
+ /// <summary>The corridor kinds (corridors.yaml kind).</summary>
+ public const string Road = "road";
+ public const string Rail = "rail";
+
+ /// <summary>Whether <paramref name="action"/> is a corridor action.</summary>
+ public static bool IsAction(string action) => action == BuildRoad || action == BuildRail;
+
+ /// <summary>A segment's on-screen name: the corridor's name and the segment's number, from 1 ("Burma Road, segment 2").</summary>
+ public static string SegmentName(CorridorDef d, int index) => d.Name + ", segment " + (index + 1).ToString(CultureInfo.InvariantCulture);
+
+ /// <summary>The segment <paramref name="unit"/> is building, as (corridor, 0-based index), or null (D-D6).</summary>
+ public static (CorridorWork Work, int Index)? WorkOf(GameState s, int unit)
+ {
+ foreach (var w in s.Corridors.Values)
+ for (int i = 0; i < w.Segments.Count; i++)
+ if (w.Segments[i] is SegmentWork x && x.BuiltOn == null && x.Unit == unit) return (w, i);
+ return null;
+ }
+
+ /// <summary>R-COR-001: an idle halutz unit (Projects.Start has checked the unit) starts an unbuilt, unclaimed segment
+ /// <paramref name="target"/> ("corridor:N", N from 1) of a corridor whose kind <paramref name="action"/> builds. The
+ /// Treasury pays the kind's cost now and borrows what it lacks. Refused, state untouched, for an unknown corridor or
+ /// segment, a kind the action does not build, or a segment being built or built.</summary>
+ internal static string? Start(Content c, GameState s, int unit, string action, string target, List<Cause> why)
+ {
+ var colon = target.LastIndexOf(':');
+ var def = colon < 0 ? null : c.Corridors.FirstOrDefault(x => x.Id == target.Substring(0, colon));
+ if (def == null || !int.TryParse(target.Substring(colon + 1), NumberStyles.None, CultureInfo.InvariantCulture, out var n)
+ || n < 1 || n > def.Segments.Count)
+ return "There is no such corridor segment";
+ var wantRail = action == BuildRail;
+ if ((def.Kind == Rail) != wantRail) return wantRail ? $"{def.Name} is not a railway" : $"{def.Name} is not a road";
+ var index = n - 1;
+ var name = SegmentName(def, index);
+ s.Corridors.TryGetValue(def.Id, out var work);
+ if (work?.Segments[index] is SegmentWork seg)
+ return seg.BuiltOn == null ? $"{name} is already being built" : $"{name} is already built";
+ var r = c.RulesAt(s.Date).Mvp!; // the loader requires it in the GDD loop
+ var cost = def.Kind == Rail ? r.RailSegmentCost : r.RoadSegmentCost;
+ EconomySystem.PayOrBorrow(c, s, cost, "to build a corridor segment", why);
+ // As for sites (R-SITE-001): the turn of the order is the first build turn. The segment starts at 0, step 5 of this
+ // turn's resolve gives it its first turn of progress, and with 6 turns an order on turn T is built at the end of T+5.
+ var started = new SegmentWork(unit, 0, null);
+ s.Corridors[def.Id] = work == null
+ ? new CorridorWork(def.Id, Enumerable.Range(0, def.Segments.Count).Select(i => i == index ? started : null).ToArray())
+ : work.With(index, started)!;
+ why.Add(new Cause("map", def.Id, 1, $"{name}: a group of halutzim began building, cost {PlayerText.Money(c, "treasury", cost)}"));
+ return null;
+ }
+
+ /// <summary>R-COR-003 with R-SITE-002's rule (D-A3): the unit's segment loses its record, so it is unbuilt and free
+ /// again, and the unit is idle. The progress and the Money spent are lost. Returns false when the unit builds no
+ /// segment.</summary>
+ internal static bool Stop(Content c, GameState s, int unit, List<Cause> why)
+ {
+ if (!(WorkOf(s, unit) is var (work, index))) return false;
+ var rest = work.With(index, null);
+ if (rest == null) s.Corridors.Remove(work.Id); else s.Corridors[work.Id] = rest;
+ var def = c.Corridors.First(x => x.Id == work.Id);
+ why.Add(new Cause("map", work.Id, -1, $"{SegmentName(def, index)}: the halutzim stopped building; the Money spent is not returned"));
+ return true;
+ }
+
+ /// <summary>R-COR-002, step 5 of the turn after the sites: in ordinal corridor id order, then segment index, each segment
+ /// being built gains one turn of progress, or veteran_progress with a veteran (R-VET-002), scaled by Transportation
+ /// (R-MIN-002), with the fraction carried as on a site. One whose progress reaches its
+ /// kind's turns is built on <paramref name="next"/>, the turn's end date, and its unit is idle again. Then the unit, a
+ /// halutz, gains a turn of service, and at veteran_halutz_service becomes a veteran_halutz (R-VET-001), as on a site.</summary>
+ public static void Advance(Content c, GameState s, DateTime next, List<Cause> why)
+ {
+ var r = c.RulesAt(s.Date).Mvp!;
+ foreach (var w in s.Corridors.Values.ToList())
+ {
+ var def = c.Corridors.First(x => x.Id == w.Id);
+ var turns = def.Kind == Rail ? r.RailSegmentTurns : r.RoadSegmentTurns;
+ var cur = w;
+ for (int i = 0; i < cur.Segments.Count; i++)
+ {
+ if (!(cur.Segments[i] is SegmentWork x) || x.BuiltOn != null) continue;
+ var u = s.Units[x.Unit!.Value]; // a segment being built always names its unit (SegmentWork)
+ // Capped at the kind's turns, so a built segment's progress reads the same whoever built it.
+ var acc = x.Carry + (u.Type == Projects.VeteranType ? r.VeteranProgress!.Value : 1)
+ * EffectsSystem.GddSystemMultiplier(c, s, r, "corridors");
+ var whole = (int)Math.Floor(acc);
+ acc -= whole;
+ var progress = Math.Min(turns, x.Progress + whole);
+ if (progress < turns) cur = cur.With(i, new SegmentWork(x.Unit, progress, null, acc))!;
+ else
+ {
+ cur = cur.With(i, new SegmentWork(null, progress, next))!;
+ why.Add(new Cause("map", w.Id, 1, $"{SegmentName(def, i)} built"));
+ }
+ // R-VET-001: the segment progressed this turn, so a halutz serves a turn; a veteran counts no further.
+ if (u.Type != "halutz") continue;
+ var service = u.Service + 1;
+ var promoted = service >= r.VeteranHalutzService!.Value;
+ s.Units[u.Id] = new Unit(u.Id, promoted ? Projects.VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget);
+ if (promoted) why.Add(new Cause("map", w.Id, 1, "A group of halutzim became veteran pioneers"));
+ }
+ s.Corridors[w.Id] = cur;
+ }
+ }
+
+ /// <summary>R-COR-003: a corridor is complete when every one of its segments is built, in any order.</summary>
+ public static bool IsComplete(Content c, GameState s, string corridor)
+ {
+ var def = c.Corridors.First(x => x.Id == corridor);
+ return s.Corridors.TryGetValue(corridor, out var w) && w.Segments.Count == def.Segments.Count
+ && w.Segments.All(x => x?.BuiltOn != null);
+ }
+ }
+}
diff --git a/sim/Statecraft.Sim/GameState.cs b/sim/Statecraft.Sim/GameState.cs
index 80878eca8..84bc7849c 100644
--- a/sim/Statecraft.Sim/GameState.cs
+++ b/sim/Statecraft.Sim/GameState.cs
@@ -70,6 +70,9 @@ namespace Statecraft.Sim
public SortedDictionary<string, SiteWork> Sites = new SortedDictionary<string, SiteWork>(StringComparer.Ordinal);
/// <summary>The city projects being built or built, by id (R-PROJ-001). A cancelled project leaves.</summary>
public SortedList<int, CityProject> CityProjects = new SortedList<int, CityProject>();
+ /// <summary>The corridors with a segment being built or built, by corridor id (ordinal; R-COR-001). A corridor with no
+ /// started segment has no record.</summary>
+ public SortedDictionary<string, CorridorWork> Corridors = new SortedDictionary<string, CorridorWork>(StringComparer.Ordinal);
/// <summary>The locked projects.yaml kinds an event option has unlocked (R-EFX-008), by id (ordinal).</summary>
public SortedSet<string> UnlockedProjects = new SortedSet<string>(StringComparer.Ordinal);
/// <summary>The next id a new unit, training cohort or city project takes (they share it). Ids are never reused.</summary>
@@ -114,6 +117,7 @@ namespace Statecraft.Sim
c.Cohorts = new SortedList<int, Cohort>(Cohorts);
c.Sites = new SortedDictionary<string, SiteWork>(Sites, StringComparer.Ordinal);
c.CityProjects = new SortedList<int, CityProject>(CityProjects);
+ c.Corridors = new SortedDictionary<string, CorridorWork>(Corridors, StringComparer.Ordinal);
c.UnlockedProjects = new SortedSet<string>(UnlockedProjects, StringComparer.Ordinal);
c.Objectives = new SortedDictionary<string, DateTime>(Objectives, StringComparer.Ordinal);
c.Settlements = new SortedDictionary<string, SettlementControl>(Settlements, StringComparer.Ordinal);
@@ -204,6 +208,7 @@ namespace Statecraft.Sim
if (Cohorts.Count > 0) Section("train", '[', ']', Cohorts.Values.Select(x => x.Canonical()));
if (Sites.Count > 0) Section("site", '{', '}', Sites.Values.Select(x => x.Canonical()));
if (CityProjects.Count > 0) Section("cproj", '[', ']', CityProjects.Values.Select(x => x.Canonical()));
+ if (Corridors.Count > 0) Section("corr", '{', '}', Corridors.Values.Select(x => x.Canonical()));
if (UnlockedProjects.Count > 0) Section("unlocked", '[', ']', UnlockedProjects);
if (NextId != 0) { Sep(); Nl(); sb.Append("next=").Append(NextId.ToString(CultureInfo.InvariantCulture)); }
if (Objectives.Count > 0)
diff --git a/sim/Statecraft.Sim/GddState.cs b/sim/Statecraft.Sim/GddState.cs
index 24dbff274..42a60a3b0 100644
--- a/sim/Statecraft.Sim/GddState.cs
+++ b/sim/Statecraft.Sim/GddState.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
+using System.Linq;
namespace Statecraft.Sim
{
@@ -244,4 +245,54 @@ namespace Statecraft.Sim
+ (BuiltOn is DateTime on ? "done," + on.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)
: TurnsLeft.ToString(CultureInfo.InvariantCulture) + (Progress == 0 ? "" : "," + BitConverter.DoubleToInt64Bits(Progress).ToString("X16", CultureInfo.InvariantCulture)));
}
+
+ /// <summary>Work on one corridor segment (R-COR-001 to R-COR-003): <see cref="Unit"/> building it with
+ /// <see cref="Progress"/> turns of work done, or, once <see cref="BuiltOn"/> is set, built on that date. Immutable.</summary>
+ public sealed class SegmentWork
+ {
+ /// <summary>The halutz unit building the segment; null once it is built (unit ids start at 0).</summary>
+ public int? Unit { get; }
+ /// <summary>Turns of work done (spec section 2.2: "segment progress").</summary>
+ public int Progress { get; }
+ /// <summary>Fractional work carried to the next turn (R-MIN-002), omitted from the hash while zero.</summary>
+ public double Carry { get; }
+ /// <summary>The end date of the turn the segment was built on; null while it is being built.</summary>
+ public DateTime? BuiltOn { get; }
+
+ /// <summary>A segment being built (<paramref name="builtOn"/> null) needs its unit; a built segment has none.</summary>
+ public SegmentWork(int? unit, int progress, DateTime? builtOn, double carry = 0)
+ {
+ if ((builtOn == null) != (unit != null)) throw new ArgumentException("a segment being built has a unit, and a built segment has none", nameof(unit));
+ Unit = unit; Progress = progress; BuiltOn = builtOn; Carry = carry;
+ }
+
+ /// <summary>"b,UNIT,PROGRESS" while building, with nonzero carry appended as IEEE bits; "done,yyyy-MM-dd" once built.</summary>
+ public string Canonical() => BuiltOn is DateTime on
+ ? "done," + on.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture)
+ : string.Format(CultureInfo.InvariantCulture, "b,{0},{1}", Unit, Progress)
+ + (Carry == 0 ? "" : "," + BitConverter.DoubleToInt64Bits(Carry).ToString("X16", CultureInfo.InvariantCulture));
+ }
+
+ /// <summary>A corridor some of whose segments are being built or built (corridors.yaml; R-COR-001 to R-COR-003): one
+ /// entry per segment of the corridor, in index order, null for a segment not started. A corridor with no started
+ /// segment has no record. Immutable; a change replaces the record.</summary>
+ public sealed class CorridorWork
+ {
+ public string Id { get; }
+ public IReadOnlyList<SegmentWork?> Segments { get; }
+
+ public CorridorWork(string id, SegmentWork?[] segments) { Id = id; Segments = (SegmentWork?[])segments.Clone(); }
+
+ /// <summary>The same corridor with segment <paramref name="index"/> (0-based) replaced; null when no segment is left
+ /// with a record.</summary>
+ public CorridorWork? With(int index, SegmentWork? work)
+ {
+ var a = Segments.ToArray();
+ a[index] = work;
+ return a.All(x => x == null) ? null : new CorridorWork(Id, a);
+ }
+
+ /// <summary>"id=SEG;SEG;...", each segment "-" when not started.</summary>
+ public string Canonical() => Id + "=" + string.Join(";", Segments.Select(x => x?.Canonical() ?? "-"));
+ }
}
diff --git a/sim/Statecraft.Sim/Projects.cs b/sim/Statecraft.Sim/Projects.cs
index a0b35ed9c..fede3d5ba 100644
--- a/sim/Statecraft.Sim/Projects.cs
+++ b/sim/Statecraft.Sim/Projects.cs
@@ -88,8 +88,9 @@ namespace Statecraft.Sim
}
}
- /// <summary>Whether a site being built names <paramref name="unit"/>: the unit has a project (D-D6).</summary>
- public static bool IsBusy(GameState s, int unit) => s.Sites.Values.Any(w => w.BuiltOn == null && w.Unit == unit);
+ /// <summary>Whether a site or a corridor segment being built names <paramref name="unit"/>: the unit has a project
+ /// (D-D6).</summary>
+ public static bool IsBusy(GameState s, int unit) => s.Sites.Values.Any(w => w.BuiltOn == null && w.Unit == unit) || Corridors.WorkOf(s, unit) != null;
/// <summary>R-SITE-001: an idle halutz unit starts <paramref name="action"/> (build_yishuv) at a yishuv site that has no
/// record. The Treasury pays build_yishuv_cost now and borrows what it lacks; the site gets build_yishuv_turns to go; the unit
@@ -106,6 +107,10 @@ namespace Statecraft.Sim
if (!IsPioneer(u.Type)) return "Only halutzim do pioneer work";
var busy = s.Sites.Values.FirstOrDefault(w => w.BuiltOn == null && w.Unit == unit);
if (busy != null) return $"That group of halutzim is already building {PlayerText.Site(c, busy.Site)}";
+ if (Corridors.WorkOf(s, unit) is var (cw, ci))
+ return $"That group of halutzim is already building {Corridors.SegmentName(c.Corridors.First(x => x.Id == cw.Id), ci)}";
+ // Phase 4 PR 2 (#786): build_road and build_rail take a corridor segment, "corridor:N" (R-COR-001).
+ if (Corridors.IsAction(action)) return Corridors.Start(c, s, unit, action, site, why);
if (action != BuildYishuv && action != BuildCamp && action != PlowFields && action != DrySwamp) return "There is no such pioneer work";
var place = c.Sites.FirstOrDefault(x => x.Id == site);
if (place == null) return "There is no such site";
@@ -151,7 +156,7 @@ namespace Statecraft.Sim
{
if (!s.Units.ContainsKey(unit)) return "There is no such unit";
var work = s.Sites.Values.FirstOrDefault(w => w.BuiltOn == null && w.Unit == unit);
- if (work == null) return "That group of halutzim is not building anything";
+ if (work == null) return Corridors.Stop(c, s, unit, why) ? null : "That group of halutzim is not building anything";
s.Sites.Remove(work.Site);
why.Add(new Cause("map", work.Site, -1, $"{PlayerText.Site(c, work.Site)}: the halutzim stopped building; the Money spent is not returned"));
return null;
@@ -190,6 +195,7 @@ namespace Statecraft.Sim
s.Units[u.Id] = new Unit(u.Id, promoted ? VeteranType : u.Type, u.Q, u.R, service, u.Side, u.Strength, u.Order, u.OrderTarget);
if (promoted) why.Add(new Cause("map", w.Site, 1, "A group of halutzim became veteran pioneers"));
}
+ Corridors.Advance(c, s, next, why); // R-COR-002: after the sites (Phase 4 PR 2)
}
/// <summary>The city project at hex (q, r), being built or built, or null (Q-PROJ-2: one project or placement a hex).</summary>
diff --git a/sim/Statecraft.Sim/Reference/ReferencePlayer.cs b/sim/Statecraft.Sim/Reference/ReferencePlayer.cs
index 91ac18e07..0b1fbb93b 100644
--- a/sim/Statecraft.Sim/Reference/ReferencePlayer.cs
+++ b/sim/Statecraft.Sim/Reference/ReferencePlayer.cs
@@ -7,7 +7,7 @@ namespace Statecraft.Sim.Reference
/// <summary>Test policy for the GDD goldens (D-A7): a stated simple policy, not game AI and not historical. It sends
/// HistoricalAI's orders and no AssignWorkers (R-CITY-009's default fills the jobs, and an order would turn it off), then,
/// when no city project is being built, starts a housing project in the city with the most overflow that has a hex for it, then sends each idle halutz
- /// unit to the first available yishuv site (then to the first ready field, then to the first available camp site), then,
+ /// unit to the first available yishuv site (then to the first ready field, then to the first available camp site, then to the lowest free segment of the lowest-id corridor), then,
/// when there is no halutz and none in training, trains one halutz group in
/// the first city with a Hakhshara and a civilian left without work, while the turn's Attention lasts (both orders borrow). It lives in Statecraft.Sim only so Unity can replay the goldens (#394; GoldenRun); no game mode or UI may reach it
/// (ReferencePlayerTests.NoGameModeOrUiReachesIt).</summary>
@@ -62,14 +62,16 @@ namespace Statecraft.Sim.Reference
/// <summary>Sends each idle halutz unit, veterans too, in id order, to the first yishuv site without a record, in ordinal id order,
/// and once every yishuv site has one, to plow the first ready field site without a record (R-FIELD-001), and when there
- /// is none, to build the first camp site without a record (R-CAMP-001), while the turn's Attention lasts. Pioneer work
- /// borrows, so the Treasury does not hold it back.</summary>
+ /// is none, to build the first camp site without a record (R-CAMP-001), and when there is none, to the lowest unbuilt,
+ /// unclaimed segment of the lowest-id corridor (ordinal), with the action its kind takes (R-COR-001), while the turn's
+ /// Attention lasts. Pioneer work borrows, so the Treasury does not hold it back.</summary>
static void Build(Content c, GameState s, List<Command> list, ref double left)
{
var cost = AttentionSystem.Cost(c, s, Projects.PioneerKind);
var taken = new HashSet<string>(s.Sites.Keys, StringComparer.Ordinal);
foreach (var u in s.Units.Values.Where(u => Projects.IsPioneer(u.Type) && !Projects.IsBusy(s, u.Id)))
{
+ if (cost > left + 1e-9) return;
var site = c.Sites.Where(x => x.Kinds.Contains(Projects.YishuvKind) && !taken.Contains(x.Id)).OrderBy(x => x.Id, StringComparer.Ordinal).FirstOrDefault();
var action = Projects.BuildYishuv;
if (site == null)
@@ -83,11 +85,37 @@ namespace Statecraft.Sim.Reference
site = c.Sites.Where(x => Projects.IsCamp(x) && !taken.Contains(x.Id)).OrderBy(x => x.Id, StringComparer.Ordinal).FirstOrDefault();
action = Projects.BuildCamp;
}
- if (site == null || cost > left + 1e-9) return;
- list.Add(new PioneerWork(u.Id, action, site.Id));
- taken.Add(site.Id);
+ if (site != null)
+ {
+ list.Add(new PioneerWork(u.Id, action, site.Id));
+ taken.Add(site.Id);
+ }
+ else
+ {
+ var segment = FreeSegment(c, s, taken);
+ if (segment == null) return;
+ list.Add(new PioneerWork(u.Id, segment.Value.Action, segment.Value.Target));
+ taken.Add(segment.Value.Target);
+ }
left -= cost;
}
}
+
+ /// <summary>The lowest segment, by ordinal corridor id then index, that has no record and is not in
+ /// <paramref name="taken"/> (this turn's orders), as its action and "corridor:N" target; null when there is none.</summary>
+ static (string Action, string Target)? FreeSegment(Content c, GameState s, HashSet<string> taken)
+ {
+ foreach (var d in c.Corridors.OrderBy(x => x.Id, StringComparer.Ordinal))
+ {
+ s.Corridors.TryGetValue(d.Id, out var w);
+ for (int i = 0; i < d.Segments.Count; i++)
+ {
+ var target = d.Id + ":" + (i + 1).ToString(System.Globalization.CultureInfo.InvariantCulture);
+ if (w?.Segments[i] == null && !taken.Contains(target))
+ return (d.Kind == Corridors.Rail ? Corridors.BuildRail : Corridors.BuildRoad, target);
+ }
+ }
+ return null;
+ }
}
}
diff --git a/tools/corridor_hexes.py b/tools/corridor_hexes.py
new file mode 100644
index 000000000..40b9015e8
--- /dev/null
+++ b/tools/corridor_hexes.py
@@ -0,0 +1,161 @@
+# /// script
+# requires-python = ">=3.11"
+# dependencies = ["numpy==2.5.3", "pyyaml==6.0.3"]
+# ///
+"""Derive each corridor segment's hexes from its route's traced line (GDD Phase 4 PR 2, #786).
+
+Usage: uv run tools/corridor_hexes.py [--check]
+Reads content/corridors.yaml (hand-written: each corridor's route and its segments, each ending at a route waypoint),
+content/map/routes_1948.yaml (the waypoints) and content/map/route_paths_1948.yaml (the traced lines), and rewrites the
+`hexes: [...]` of every segment line in corridors.yaml in place, so its comments survive. A segment runs along the
+traced line from the point nearest the previous waypoint (the route's first waypoint for the first segment) to the
+point nearest its own `to` waypoint; its hexes are the hexes that stretch crosses, in order (tools/hexgrid.py's grid),
+sampled every SAMPLE_KM; a point in a sea hex counts in its nearest land neighbour, as a shore town does. Consecutive
+segments share the waypoint's hex. --check writes nothing and exits 1 when the committed hexes differ from a fresh
+derivation (tools/tests/test_corridor_hexes.py runs the same check in CI).
+"""
+from __future__ import annotations
+
+import argparse
+import json
+import math
+import re
+import sys
+from pathlib import Path
+
+import numpy as np
+
+sys.path.insert(0, str(Path(__file__).resolve().parent)) # under python -I the script's folder is not on sys.path
+import hexgrid as hg # noqa: E402
+import yaml12 # noqa: E402
+
+ROOT = Path(__file__).resolve().parents[1]
+CORRIDORS = ROOT / "content" / "corridors.yaml"
+ROUTES = ROOT / "content" / "map" / "routes_1948.yaml"
+PATHS = ROOT / "content" / "map" / "route_paths_1948.yaml"
+HEXES = ROOT / "content" / "map" / "hexes.json"
+
+# A tenth of a kilometre against hexes 8.7 km apart: no hex the line crosses is stepped over.
+SAMPLE_KM = 0.1
+SEGMENT_LINE = re.compile(r"^(\s*- \{ to: )(?P<to>[^,]+)(, hexes: )\[.*\]( \})\s*$")
+
+
+def _project(line_km: list[tuple[float, float]], p: tuple[float, float], start: float) -> float:
+ """The arc length (km) of the point on the line nearest p, searching from arc length `start` on, so a route that
+ passes near one waypoint twice splits in order."""
+ best, best_d, s = start, math.inf, 0.0
+ for (ax, ay), (bx, by) in zip(line_km, line_km[1:]):
+ seg = math.hypot(bx - ax, by - ay)
+ if seg == 0.0:
+ continue
+ t = max(0.0, min(1.0, ((p[0] - ax) * (bx - ax) + (p[1] - ay) * (by - ay)) / seg ** 2))
+ at = s + t * seg
+ d = math.hypot(ax + t * (bx - ax) - p[0], ay + t * (by - ay) - p[1])
+ if at >= start and d < best_d:
+ best, best_d = at, d
+ s += seg
+ return best
+
+
+def _point_at(line_km: list[tuple[float, float]], at: float) -> tuple[float, float]:
+ s = 0.0
+ for (ax, ay), (bx, by) in zip(line_km, line_km[1:]):
+ seg = math.hypot(bx - ax, by - ay)
+ if seg > 0.0 and s + seg >= at:
+ t = (at - s) / seg
+ return ax + t * (bx - ax), ay + t * (by - ay)
+ s += seg
+ return line_km[-1]
+
+
+def derive(corridors: list[dict], routes: list[dict], paths: list[dict], grid: dict) -> dict[str, list[list[list[int]]]]:
+ """corridor id -> one [[q, r], ...] list per segment. Raises ValueError naming the corridor on a bad row."""
+ b, size = grid["bounds"], grid["hex_size_km"]
+ land = {(h["q"], h["r"]) for h in grid["hexes"] if h["land"]}
+ by_route = {r["id"]: r for r in routes}
+ by_path = {p["id"]: p for p in paths}
+ out = {}
+ for c in corridors:
+ cid, rid = c["id"], c.get("route")
+ if rid not in by_route or rid not in by_path:
+ raise ValueError(f"{cid}: route {rid!r} is not traced in routes_1948.yaml and route_paths_1948.yaml")
+ via = {w["name"]: hg.lonlat_to_km(w["lon"], w["lat"], b) for w in by_route[rid]["via"]}
+ line = [hg.lonlat_to_km(lon, lat, b) for lon, lat in by_path[rid]["points"]]
+ ends = [c["segments"][i]["to"] for i in range(len(c["segments"]))]
+ names = [w["name"] for w in by_route[rid]["via"]]
+ if any(e not in via for e in ends) or ends[-1] != names[-1]:
+ raise ValueError(f"{cid}: each segment ends at a waypoint of {rid}, the last at {names[-1]!r}")
+ at = _project(line, via[names[0]], 0.0)
+ segments = []
+ for e in ends:
+ end = _project(line, via[e], at)
+ if end <= at:
+ raise ValueError(f"{cid}: the segment to {e!r} has no length (waypoints out of order?)")
+ n = max(2, int(math.ceil((end - at) / SAMPLE_KM)) + 1)
+ pts = [_point_at(line, at + (end - at) * i / (n - 1)) for i in range(n)]
+ qs, rs = hg.point_to_hex(np.array([p[0] for p in pts]), np.array([p[1] for p in pts]), size)
+ hexes: list[list[int]] = []
+ for p, q, r in zip(pts, qs, rs):
+ if (q, r) not in land:
+ # A shore point in a hex the grid counts as sea (the Tel Aviv-Netanya road along the coast) belongs to
+ # the land neighbour with the nearest centre: hexgrid.settlement_hex's rule for shore towns.
+ options = [(q + dq, r + dr) for dq, dr in hg.NEIGHBOURS if (q + dq, r + dr) in land]
+ if not options:
+ raise ValueError(f"{cid}: the segment to {e!r} crosses hex q={q} r={r}, with no land hex next to it")
+ q, r = min(options, key=lambda h: math.dist(hg.hex_center_km(*h, size), p))
+ if not hexes or hexes[-1] != [q, r]:
+ hexes.append([q, r])
+ segments.append(hexes)
+ at = end
+ out[cid] = segments
+ return out
+
+
+def _flow(hexes: list[list[int]]) -> str:
+ return "[" + ", ".join(f"[{q}, {r}]" for q, r in hexes) + "]"
+
+
+def render(text: str, derived: dict[str, list[list[list[int]]]]) -> str:
+ """corridors.yaml with every segment line's hexes replaced, in file order."""
+ queue = [(cid, i) for cid, segs in derived.items() for i in range(len(segs))]
+ lines, k = [], 0
+ for raw in text.splitlines(keepends=True):
+ m = SEGMENT_LINE.match(raw.rstrip("\n"))
+ if m:
+ if k >= len(queue):
+ raise ValueError("corridors.yaml has more segment lines than segments")
+ cid, i = queue[k]
+ k += 1
+ raw = f"{m.group(1)}{m.group('to')}{m.group(3)}{_flow(derived[cid][i])}{m.group(4)}\n"
+ lines.append(raw)
+ if k != len(queue):
+ raise ValueError("every segment must be one line: '- { to: NAME, hexes: [...] }'")
+ return "".join(lines)
+
+
+def build() -> tuple[str, str]:
+ """(current text, the text with fresh hexes)."""
+ text = CORRIDORS.read_text(encoding="utf-8")
+ doc = yaml12.load(text)
+ derived = derive(doc["corridors"], yaml12.load(ROUTES.read_text(encoding="utf-8"))["routes"],
+ yaml12.load(PATHS.read_text(encoding="utf-8"))["routes"], json.loads(HEXES.read_text()))
+ return text, render(text, derived)
+
+
+def main(argv: list[str] | None = None) -> int:
+ ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0])
+ ap.add_argument("--check", action="store_true", help="fail if the committed hexes are stale; write nothing")
+ args = ap.parse_args(argv)
+ old, new = build()
+ if args.check:
+ if old != new:
+ print("content/corridors.yaml: hexes are stale; run uv run tools/corridor_hexes.py", file=sys.stderr)
+ return 1
+ return 0
+ CORRIDORS.write_text(new, encoding="utf-8")
+ print(f"wrote {CORRIDORS.relative_to(ROOT)}")
+ return 0
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/tools/routes_1948.py b/tools/routes_1948.py
index 08cbb64be..85b7b1c09 100644
--- a/tools/routes_1948.py
+++ b/tools/routes_1948.py
@@ -13,6 +13,9 @@ waypoints the line is the least-cost path over the scanned map, where the cost i
track any dark line (cart tracks, footpaths, the thin narrow-gauge railway symbol): the 1948 Burma Road, which the
1946 map cannot show as a road, and the 1,050 mm lines (a route's `trace` names the symbol when it is not its
kind's).
+A route with `trace: straight` is not traced: its line is its waypoints joined by straight lines, for a road the map
+does not show and no source gives the line of (the 1950 Tel Aviv-Netanya road, owner, 18 October 2026, #786). It reads
+no tile, none of it is on a symbol (on_symbol 0), and its max_gap_m is its whole length.
Each waypoint first snaps to the nearest pixel of its symbol within SNAP_M. The traced pixel chain is simplified
(a SMOOTH_PX moving average, then Douglas-Peucker at SIMPLIFY_M) and written with 5 decimals (about 1 m).
@@ -55,6 +58,7 @@ TILE_CACHE = Path(os.environ.get("STATECRAFT_TILE_CACHE", ROOT / "tools" / ".cac
USER_AGENT = "statecraft-israel-routes/1.0 (+https://github.com/eyalgolan/statecraft-israel)"
KINDS = ("rail", "road", "track")
+TRACES = KINDS + ("straight",) # what `trace` may name: a kind's symbol, or straight lines between the waypoints
SNAP_M = 1500.0 # a waypoint (a town's or a station's coordinates) snaps to its symbol this close
WINDOW_MARGIN_M = 3000.0 # the search window around two waypoints: their box grown by this (or 35% of their distance)
SPUR_M = 130.0 # a trace that comes back this close to where it was cuts the loop (a waypoint off the line)
@@ -361,6 +365,10 @@ def trace_route(route: dict, fetch: bool, preview: Path | None = None) -> list[t
"""The route's lon/lat polyline: least-cost paths between its consecutive waypoints, joined and simplified."""
via = [(float(w["lon"]), float(w["lat"])) for w in route["via"]]
kind = route.get("trace", route["kind"])
+ if kind == "straight":
+ route["_on_symbol"] = 0.0
+ route["_max_gap_m"] = length_km(via) * 1000
+ return via
chain: list[tuple[int, int]] = [] # global pixel (x, y)
on_symbol = total = 0
off: set[tuple[int, int]] = set() # global pixels traced off the symbol
@@ -450,8 +458,8 @@ def validate_routes(doc: dict, bounds: dict) -> None:
if rid in seen:
raise ValueError(f"routes_1948.yaml: duplicate id {rid}")
seen.add(rid)
- if r.get("kind") not in KINDS or r.get("trace", r["kind"]) not in KINDS:
- raise ValueError(f"{rid}: kind (and trace, when given) must be one of {KINDS}")
+ if r.get("kind") not in KINDS or r.get("trace", r["kind"]) not in TRACES:
+ raise ValueError(f"{rid}: kind must be one of {KINDS}, and trace, when given, one of {TRACES}")
if r.get("status") not in STATUSES:
raise ValueError(f"{rid}: status must be one of {STATUSES}")
signoff = review_record.problem(r) # a person's sign-off beside the status (#375)
diff --git a/tools/tests/test_corridor_hexes.py b/tools/tests/test_corridor_hexes.py
new file mode 100644
index 000000000..bc3b7a011
--- /dev/null
+++ b/tools/tests/test_corridor_hexes.py
@@ -0,0 +1,62 @@
+"""content/corridors.yaml's segment hexes are the committed output of tools/corridor_hexes.py (GDD Phase 4 PR 2, #786;
+the plan's Review focus 3: the sim's hexes and the traced route agree)."""
+import json
+from pathlib import Path
+
+import pytest
+
+import corridor_hexes as ch
+import yaml12
+
+ROOT = Path(__file__).resolve().parents[2]
+GRID = json.loads((ROOT / "content" / "map" / "hexes.json").read_text())
+ROUTES = yaml12.load((ROOT / "content" / "map" / "routes_1948.yaml").read_text(encoding="utf-8"))["routes"]
+PATHS = yaml12.load((ROOT / "content" / "map" / "route_paths_1948.yaml").read_text(encoding="utf-8"))["routes"]
+TEXT = (ROOT / "content" / "corridors.yaml").read_text(encoding="utf-8")
+CORRIDORS = yaml12.load(TEXT)["corridors"]
+
+
+def test_committed_hexes_are_up_to_date():
+ old, new = ch.build()
+ assert old == new, "rerun: uv run tools/corridor_hexes.py"
+
+
+def test_moving_one_traced_point_without_rederiving_fails():
+ # Shift the Burma Road's middle point by about 9 km east (one hex): the derivation no longer matches the file.
+ moved = [dict(p) for p in PATHS]
+ burma = next(p for p in moved if p["id"] == "burma_road")
+ pts = [list(x) for x in burma["points"]]
+ mid = len(pts) // 2
+ pts[mid] = [pts[mid][0] + 0.09, pts[mid][1]]
+ burma["points"] = pts
+ assert ch.render(TEXT, ch.derive(CORRIDORS, ROUTES, moved, GRID)) != TEXT
+
+
+def test_every_segment_is_land_and_steps_one_hex_at_a_time():
+ land = {(h["q"], h["r"]) for h in GRID["hexes"] if h["land"]}
+ steps = {(1, 0), (1, -1), (0, -1), (-1, 0), (-1, 1), (0, 1)}
+ for c in CORRIDORS:
+ prev = None
+ for seg in c["segments"]:
+ assert seg["hexes"], c["id"]
+ for q, r in seg["hexes"]:
+ assert (q, r) in land, (c["id"], q, r)
+ chain = ([prev] if prev else []) + [tuple(h) for h in seg["hexes"]]
+ for a, b in zip(chain, chain[1:]):
+ assert a == b or (b[0] - a[0], b[1] - a[1]) in steps, (c["id"], a, b)
+ prev = tuple(seg["hexes"][-1])
+
+
+def test_a_segment_must_end_at_a_waypoint_of_its_route():
+ bad = [dict(CORRIDORS[0], segments=[{"to": "Nowhere", "hexes": []}])]
+ with pytest.raises(ValueError, match="ends at a waypoint"):
+ ch.derive(bad, ROUTES, PATHS, GRID)
+
+
+def test_the_tel_aviv_netanya_road_has_one_segment_between_each_pair_of_its_places():
+ """Q-COR-2 and Q-COR-3 (b) (owner, 18 October 2026, #786): four road segments on the straight draft line, one between
+ each pair of the five sourced places, the last ending at Netanya."""
+ road = next(c for c in CORRIDORS if c["id"] == "tlv_netanya_road")
+ via = [w["name"] for w in next(r for r in ROUTES if r["id"] == "tlv_netanya_road")["via"]]
+ assert (road["kind"], road["route"], road["status"]) == ("road", "tlv_netanya_road", "draft")
+ assert [s["to"] for s in road["segments"]] == via[1:]
diff --git a/tools/tests/test_routes_1948.py b/tools/tests/test_routes_1948.py
index f5012a920..3d4c6154d 100644
--- a/tools/tests/test_routes_1948.py
+++ b/tools/tests/test_routes_1948.py
@@ -16,6 +16,9 @@ BOUNDS = json.loads((ROOT / "content" / "map" / "hexes.json").read_text())["boun
ROUTES = yaml12.load((ROOT / "content" / "map" / "routes_1948.yaml").read_text(encoding="utf-8"))
PATHS = yaml12.load((ROOT / "content" / "map" / "route_paths_1948.yaml").read_text(encoding="utf-8"))["routes"]
BY_ID = {r["id"]: r for r in PATHS}
+# Routes drawn as straight lines between their sourced places (`trace: straight`), not traced on a map symbol: the
+# tracer's quality checks below do not apply to them (#786).
+STRAIGHT = {r["id"] for r in ROUTES["routes"] if r.get("trace") == "straight"}
def test_routes_file_is_valid():
@@ -69,6 +72,8 @@ def test_no_segment_jumps():
the Sharon plain); and the trace itself never bridged more than 800 m off its symbol (max_gap_m, measured by the
tool on the kept line), so no invented chord hides inside a straight."""
for r in PATHS:
+ if r["id"] in STRAIGHT:
+ continue
pts = [tuple(p) for p in r["points"]]
worst = max(rt.km_between(a, b) for a, b in zip(pts, pts[1:]))
assert worst < 7.0, (r["id"], worst)
@@ -77,18 +82,41 @@ def test_no_segment_jumps():
def test_each_trace_follows_its_symbol():
"""At least 85% of every route's traced pixels lie on its own map symbol (the rest: names over the road, towns)."""
- for r in PATHS:
+ for r in (r for r in PATHS if r["id"] not in STRAIGHT):
assert r["on_symbol"] >= 0.85, (r["id"], r["on_symbol"])
def test_display_windows():
"""Every route has a display window; the Burma Road shows from its completion on 14 June 1948 (C1), so it is not on
- the map at the 15 May 1948 start; the rest are on the 1946 map and show from 1946 at the latest."""
+ the map at the 15 May 1948 start, and the 1949 Yarkon rail link (a Phase 4 corridor, #786) from its opening on 20
+ September 1949; the rest are on the 1946 map and show from 1946 at the latest."""
for src in ROUTES["routes"]:
assert BY_ID[src["id"]]["from"] == src["from"] and BY_ID[src["id"]].get("to") == src.get("to")
- if src["id"] != "burma_road":
+ if src["id"] not in ("burma_road", "yarkon_rail_link", "tlv_netanya_road"):
assert rt._as_date(src["from"]) <= rt._as_date("1946"), src["id"]
assert BY_ID["burma_road"]["from"] == "1948-06-14"
+ assert BY_ID["yarkon_rail_link"]["from"] == "1949-09-20"
+ assert BY_ID["tlv_netanya_road"]["from"] == "1950-07-28"
+
+
+def test_the_tel_aviv_netanya_road_is_straight_draft_lines_between_its_five_places():
+ """Owner, 18 October 2026 (#786, Q-COR-3 (b)): the Tel Aviv-Netanya road is drawn as straight draft lines between the
+ five places The Jerusalem Post of 30 July 1950 names, since no source read gives its 1950 line. Its drawn line is
+ exactly those five points, in order."""
+ src = next(r for r in ROUTES["routes"] if r["id"] == "tlv_netanya_road")
+ assert (src["kind"], src.get("trace"), src["status"]) == ("road", "straight", "draft")
+ assert len(src["via"]) == 5
+ assert BY_ID["tlv_netanya_road"]["points"] == [[round(w["lon"], 5), round(w["lat"], 5)] for w in src["via"]]
+ assert STRAIGHT == {"tlv_netanya_road"}
+
+
+def test_a_straight_trace_joins_the_waypoints_without_the_map():
+ """`trace: straight` reads no map tile: the line is the waypoints, and none of it is on a map symbol."""
+ route = {"id": "x", "kind": "road", "trace": "straight",
+ "via": [{"lon": 34.78, "lat": 32.0958}, {"lon": 34.8343, "lat": 32.17}, {"lon": 34.8567, "lat": 32.3286}]}
+ assert rt.trace_route(route, fetch=False) == [(34.78, 32.0958), (34.8343, 32.17), (34.8567, 32.3286)]
+ assert route["_on_symbol"] == 0.0
+ assert route["_max_gap_m"] == pytest.approx(rt.length_km(rt.trace_route(route, fetch=False)) * 1000)
@pytest.mark.parametrize("change, message", [
@@ -218,7 +246,10 @@ def test_no_sawtooth_on_straight_lines():
15% of its points (the rest are real bends: the Sorek canyon, the hill roads, the Jericho descent)."""
for r in PATHS:
n = sawtooth(r["points"])
- assert n <= 0.15 * len(r["points"]), (r["id"], n, len(r["points"]))
+ # #786: the 6 km Yarkon rail link's 11 points turn off the road onto the track to its station in one S-bend
+ # (two kinks), which 15% of 11 would count as a fault; every other route keeps the 15% bar.
+ limit = 2 if r["id"] == "yarkon_rail_link" else 0.15 * len(r["points"])
+ assert n <= limit, (r["id"], n, len(r["points"]))
if r["id"] in ("hadera_haifa_railway", "kantara_main_line_south", "eastern_railway", "haifa_beirut_railway"):
assert n <= 3, (r["id"], n)
diff --git a/unity/Assets/Resources/Routes/RouteRibbons.bytes b/unity/Assets/Resources/Routes/RouteRibbons.bytes
index 3c42b25c3..b51023d23 100644
Binary files a/unity/Assets/Resources/Routes/RouteRibbons.bytes and b/unity/Assets/Resources/Routes/RouteRibbons.bytes differ
diff --git a/unity/Assets/Scripts/Map/MapScene.cs b/unity/Assets/Scripts/Map/MapScene.cs
index 556d5164f..30de7ca3c 100644
--- a/unity/Assets/Scripts/Map/MapScene.cs
+++ b/unity/Assets/Scripts/Map/MapScene.cs
@@ -171,10 +171,14 @@ namespace Statecraft.Game.Map
/// keeps every kit (review of #559).</summary>
public bool? ShowcaseClearing { get; set; }
- /// <summary>The railways' and roads' corridors (RouteLayer.Corridors), every route whatever its date, so the units keep
- /// their figures off them. Empty before Build.</summary>
+ /// <summary>The railways' and roads' corridors (RouteLayer.Corridors) of every route drawn while a unit token stands
+ /// (RouteLayer.UnitRoutes, #786), so the units keep their figures off them. Empty before Build.</summary>
public IReadOnlyList<(List<Vector2> line, float halfWidth)> RouteCorridors { get; private set; } = new List<(List<Vector2>, float)>();
+ /// <summary>The corridors the kits keep off: those of the routes drawn at the game's start (RouteLayer.KitRoutes, #786).
+ /// Empty before Build.</summary>
+ public IReadOnlyList<(List<Vector2> line, float halfWidth)> KitRouteCorridors { get; private set; } = new List<(List<Vector2>, float)>();
+
/// <summary>The units of content/map/units_1948.yaml as the last Build read them (empty before a build, or when the
/// file is missing or malformed). Read only: the units layer draws from this same list (UnitEntriesFor).</summary>
public IReadOnlyList<Units.UnitEntry> UnitEntries { get; private set; } = Array.Empty<Units.UnitEntry>();
@@ -363,7 +367,8 @@ namespace Statecraft.Game.Map
// From the baked runtime form when it matches the YAML (issue #321: boot time), else from the YAML with a warning.
var routes = Routes.RoutePaths.ReadRuntimeOrYaml(inputs.RoutesTsv, inputs.RoutesYaml, (meta.lon0, meta.lon1, meta.lat0, meta.lat1), Debug.LogWarning);
DiagLog.BootPhase("route paths read"); // issue #321: the splits of the units' phase
- RouteCorridors = Routes.RouteLayer.Corridors(Frame, routes);
+ // Only the routes drawn at the start keep the kits off (#786); the units keep off those drawn while they stand.
+ KitRouteCorridors = Routes.RouteLayer.Corridors(Frame, Routes.RouteLayer.KitRoutes(routes));
DiagLog.BootPhase("route corridors");
// The game settlements' and the 1948 localities' discs, as the kits will claim them (review I5: a token placed "off
// the towns" keeps off the villages too). The camps are placed after the units and keep off them instead.
@@ -374,6 +379,9 @@ namespace Statecraft.Game.Map
var unitData = Units.UnitData.ReadOrNone(inputs.UnitsYaml, Debug.LogWarning);
UnitEntries = unitData; unitsYamlRead = inputs.UnitsYaml ?? "";
DiagLog.BootPhase("unit data read");
+ // The end of the last token's window (anchors always have one): a route opened later takes no token's spot (#786).
+ var unitsUntil = unitData.SelectMany(u => u.Anchors).Select(a => Units.UnitData.Day(a.To)).DefaultIfEmpty(DateTime.MaxValue).Max();
+ RouteCorridors = Routes.RouteLayer.Corridors(Frame, Routes.RouteLayer.UnitRoutes(routes, unitsUntil));
var unitHexes = Hexes.hexes.Select(h => new Statecraft.Sim.MapHex { Q = h.q, R = h.r, Lon = h.lon, Lat = h.lat, ElevM = h.elev_m, Land = h.land, Biome = h.biome }).ToList();
UnitHexes = unitHexes;
var unitGround = new Units.UnitGround(SettlementFootprints, RouteCorridors, unitHexes,
@@ -421,7 +429,7 @@ namespace Statecraft.Game.Map
var kits = Kits.KitLayer.Build(list, localitySettlements, localities.Encampments, Terrain, Frame, Hexes, meta.elev_min_m, kitMaterial, treeMaterial,
townModels != null ? townModels : null, // a missing asset reference is Unity's fake null: pass a real null
terrainGo.GetComponent<MapRuntimeAssets>(), markers, out var stats,
- RouteCorridors.Concat(UnitClearings.Select(c => (new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius))).ToList(), kitColumns,
+ KitRouteCorridors.Concat(UnitClearings.Select(c => (new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius))).ToList(), kitColumns,
unitRings);
kits.transform.SetParent(transform, true);
kitProbe = kits.GetComponentInChildren<MeshRenderer>(true);
diff --git a/unity/Assets/Scripts/Map/Routes/RouteLayer.cs b/unity/Assets/Scripts/Map/Routes/RouteLayer.cs
index 0d2facc74..e91295b50 100644
--- a/unity/Assets/Scripts/Map/Routes/RouteLayer.cs
+++ b/unity/Assets/Scripts/Map/Routes/RouteLayer.cs
@@ -92,12 +92,26 @@ namespace Statecraft.Game.Map.Routes
/// lot or crown still keeps about 130 m from the visible dirt.</summary>
public const float RoadCorridorMarginM = 40f;
- /// <summary>Every route's traced line (world x, z; <see cref="World"/>, not cut as <see cref="Drawn"/> is) with the half-width kits must keep clear of: half the drawn width plus
- /// <see cref="CorridorMarginM"/> (<see cref="RoadCorridorMarginM"/> for roads). All routes, whatever their window: the
- /// kits are built once, not per date, so a route that appears later (the Burma Road) has its corridor from the start.</summary>
+ /// <summary>Each route's traced line (world x, z; <see cref="World"/>, not cut as <see cref="Drawn"/> is) with the half-width kits must keep clear of: half the drawn width plus
+ /// <see cref="CorridorMarginM"/> (<see cref="RoadCorridorMarginM"/> for roads). The units keep off every route's; the
+ /// kits only off those of <see cref="KitRoutes"/>.</summary>
public static List<(List<Vector2> line, float halfWidth)> Corridors(GeoFrame frame, IEnumerable<RoutePath> routes) =>
routes.Select(r => (World(frame, r), WidthOf(r.Kind) / 2f + (r.Kind == RoutePaths.Road ? RoadCorridorMarginM : CorridorMarginM))).ToList();
+ /// <summary>The routes whose corridors the kits keep clear: those drawn on the game's first day, <see cref="DefaultDate"/>.
+ /// The kits are built once, not per date, so a later route (the Burma Road, the 1949 rail link, the 1950 Tel Aviv–Netanya
+ /// road) clears no town's houses or trees from the start and draws over them when it appears (owner, 18 October 2026,
+ /// #786: the kit floors are kept, not lowered).</summary>
+ public static IEnumerable<RoutePath> KitRoutes(IEnumerable<RoutePath> routes) =>
+ routes.Where(r => RoutePaths.WindowOf(r).Covers(DefaultDate));
+
+ /// <summary>The routes whose corridors the unit tokens keep clear: those drawn on some day before <paramref name="until"/>,
+ /// the end of the last token's window. A route opened after every token has left the map (the 1949 rail link, the 1950
+ /// Tel Aviv–Netanya road) never stands beside one, so it takes no token's spot (#786: the straight 1950 road crossed
+ /// Tel Aviv and left Kiryati no spot there).</summary>
+ public static IEnumerable<RoutePath> UnitRoutes(IEnumerable<RoutePath> routes, DateTime until) =>
+ routes.Where(r => RoutePaths.WindowOf(r).From < until);
+
public static float WidthOf(string kind) => kind switch
{
RoutePaths.Rail => RailWidthM,
diff --git a/unity/Assets/Scripts/UI/SimBridge.cs b/unity/Assets/Scripts/UI/SimBridge.cs
index 9694716c1..b6df8902c 100644
--- a/unity/Assets/Scripts/UI/SimBridge.cs
+++ b/unity/Assets/Scripts/UI/SimBridge.cs
@@ -124,10 +124,14 @@ namespace Statecraft.Game.UI
?? Unknown("training", t.Track, Content.UnitTypes.Where(x => !string.IsNullOrEmpty(x.Facility)).Select(x => x.Id));
case CancelTraining x:
return Unknown("cohort", x.Cohort.ToString(System.Globalization.CultureInfo.InvariantCulture), State.Cohorts.Keys.Select(k => k.ToString(System.Globalization.CultureInfo.InvariantCulture)));
- // Pioneer work (#378): ids only; the sim refuses a busy unit, a built site or a short Treasury with its own reason.
+ // Pioneer work (#378, corridors #786): ids only; the sim refuses a busy unit, a built site or segment, a kind
+ // mismatch or a short Treasury with its own reason. A corridor action names "corridor:N", N from 1.
case PioneerWork w:
return Unknown("unit", w.Unit.ToString(System.Globalization.CultureInfo.InvariantCulture), State.Units.Keys.Select(k => k.ToString(System.Globalization.CultureInfo.InvariantCulture)))
- ?? Unknown("pioneer_work", w.Action, new[] { Projects.BuildYishuv }) ?? Unknown("site", w.Site, Content.Sites.Select(x => x.Id));
+ ?? Unknown("pioneer_work", w.Action, new[] { Projects.BuildYishuv, Corridors.BuildRoad, Corridors.BuildRail })
+ ?? (Corridors.IsAction(w.Action)
+ ? Unknown("corridor_segment", w.Site, Content.Corridors.SelectMany(x => Enumerable.Range(1, x.Segments.Count).Select(n => x.Id + ":" + n.ToString(System.Globalization.CultureInfo.InvariantCulture))))
+ : Unknown("site", w.Site, Content.Sites.Select(x => x.Id)));
case StopWork w: return Unknown("unit", w.Unit.ToString(System.Globalization.CultureInfo.InvariantCulture), State.Units.Keys.Select(k => k.ToString(System.Globalization.CultureInfo.InvariantCulture)));
// Movement (#744): the unit id only; the sim refuses an unreachable, full or forbidden hex with its own reason.
case Move m: return Unknown("unit", m.Unit.ToString(System.Globalization.CultureInfo.InvariantCulture), State.Units.Keys.Select(k => k.ToString(System.Globalization.CultureInfo.InvariantCulture)));
diff --git a/unity/Assets/Tests/EditMode/KibbutzKitTests.cs b/unity/Assets/Tests/EditMode/KibbutzKitTests.cs
index 9ec3f9d72..85b8fee26 100644
--- a/unity/Assets/Tests/EditMode/KibbutzKitTests.cs
+++ b/unity/Assets/Tests/EditMode/KibbutzKitTests.cs
@@ -61,7 +61,7 @@ public class KibbutzKitTests
{
var map = OpenMap();
var g = new KitGround(map.Terrain, map.Frame, map.Hexes, HeightmapLoader.Load(Statecraft.Game.Paths.StreamingMap).meta.elev_min_m);
- foreach (var c in map.RouteCorridors) g.AddCorridor(c.line, c.halfWidth);
+ foreach (var c in map.KitRouteCorridors) g.AddCorridor(c.line, c.halfWidth); // as the map builds its kits (#786)
foreach (var c in map.UnitClearings) g.AddCorridor(new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius);
var localities = map.Localities.Select(p => p.Settlement).ToList();
var built = SettlementKits.Build(map.Settlements, localities, new List<Localities.Area>(), g);
diff --git a/unity/Assets/Tests/EditMode/KitTests.cs b/unity/Assets/Tests/EditMode/KitTests.cs
index 5a8cce99a..fbb5a541f 100644
--- a/unity/Assets/Tests/EditMode/KitTests.cs
+++ b/unity/Assets/Tests/EditMode/KitTests.cs
@@ -180,13 +180,13 @@ public class KitTests
return doc;
}
- /// <summary>The railways' and roads' corridors as MapScene hands them to the kits.</summary>
+ /// <summary>The railways' and roads' corridors as MapScene hands them to the kits: the routes drawn at the start (#786).</summary>
static IReadOnlyList<(List<Vector2> line, float halfWidth)> Corridors(MapScene map)
{
var inputs = Statecraft.Game.Boot.GameInputs.MapFromDisk(Statecraft.Game.Paths.Content, Statecraft.Game.Paths.StreamingMap);
var b = HeightmapLoader.Load(Statecraft.Game.Paths.StreamingMap).meta;
var routes = Statecraft.Game.Map.Routes.RoutePaths.ReadOrNone(inputs.RoutesYaml, (b.lon0, b.lon1, b.lat0, b.lat1), _ => { });
- return Statecraft.Game.Map.Routes.RouteLayer.Corridors(map.Frame, routes);
+ return Statecraft.Game.Map.Routes.RouteLayer.Corridors(map.Frame, Statecraft.Game.Map.Routes.RouteLayer.KitRoutes(routes));
}
/// <summary>Owner rulings 2026-10-11 and 2026-10-12: the 271 places of 1,000+ people beside the 25 game settlements, as Arab village and
diff --git a/unity/Assets/Tests/EditMode/RouteTests.cs b/unity/Assets/Tests/EditMode/RouteTests.cs
index b998771dc..afa21e2a3 100644
--- a/unity/Assets/Tests/EditMode/RouteTests.cs
+++ b/unity/Assets/Tests/EditMode/RouteTests.cs
@@ -101,7 +101,7 @@ public class RouteTests
using var sha = System.Security.Cryptography.SHA256.Create();
return string.Concat(sha.ComputeHash(bytes.ToArray()).Select(b => b.ToString("x2")));
}
- const string RailMeshHash = "e6b1710041c05f9ce18d1591e5173c003b933308e9cb84fa807e23b015f16fbd"; // #252: full width where only one side leaves the tolerance; #319: cut at the Old City's walls
+ const string RailMeshHash = "7a48e169031f093824b2f85f0f4d451d84ed14514f16ce35fc6390c6a3e9c55b"; // #252: full width where only one side leaves the tolerance; #319: cut at the Old City's walls; #786: the 1949 rail link
[Test]
public void TheMapBuildsRibbonsOnTheGroundAndTheTogglesHideThem()
@@ -349,7 +349,12 @@ public class RouteTests
var groups = RoutesRoot(map).Find(RouteLayer.RibbonsName).GetComponentsInChildren<RouteGroup>(true).ToList();
var burma = groups.Single(g => g.Window.From == new System.DateTime(1948, 6, 14));
Assert.IsFalse(burma.gameObject.activeSelf, "built as at the game's start, 15 May 1948");
- Assert.IsTrue(groups.Where(g => g != burma).All(g => g.gameObject.activeSelf), "the rest are on the 1946 map");
+ var start = new System.DateTime(1948, 5, 15);
+ Assert.IsTrue(groups.Where(g => g != burma && g.Window.From <= start).All(g => g.gameObject.activeSelf), "the rest are on the 1946 map");
+ // #786: the 1949 rail link and the 1950 Tel Aviv–Netanya road (Phase 4 corridors) are the routes built after the
+ // Burma Road, hidden at the start.
+ Assert.IsTrue(groups.Where(g => g.Window.From > start).All(g => g == burma || ((g.Window.From == new System.DateTime(1949, 9, 20)
+ || g.Window.From == new System.DateTime(1950, 7, 28)) && !g.gameObject.activeSelf)));
RouteLayer.ShowAt(map, new System.DateTime(1948, 6, 13));
Assert.IsFalse(burma.gameObject.activeSelf);
RouteLayer.ShowAt(map, new System.DateTime(1948, 6, 14));
@@ -525,9 +530,40 @@ public class RouteTests
finally { Object.DestroyImmediate(map.gameObject); }
}
- /// <summary>Kits and routes together (#179 on main): no kit building, landmark or tree reaches into any route's
- /// corridor, half the drawn width plus RouteLayer.CorridorMarginM, the Burma Road included (the kits are built once,
- /// not per date). Checked by brute force against every segment, independent of KitGround's grid.</summary>
+ /// <summary>Owner, 18 October 2026 (#786: the floors are kept): only the routes drawn at the game's start, 15 May 1948, keep
+ /// the kits off. The kits are built once, not per date, so a later route (the Burma Road, the 1949 rail link, the 1950
+ /// Tel Aviv–Netanya road) clears no town's houses or trees from the start; it draws over them when it appears.</summary>
+ [Test]
+ public void OnlyTheRoutesDrawnAtTheStartKeepTheKitsOff()
+ {
+ var routes = RoutePaths.Parse(CommittedYaml, Bounds);
+ var kept = RouteLayer.KitRoutes(routes).Select(r => r.Id).ToList();
+ CollectionAssert.AreEquivalent(routes.Where(r => RoutePaths.Bound(r.From) <= RouteLayer.DefaultDate).Select(r => r.Id), kept);
+ CollectionAssert.IsSubsetOf(new[] { "jaffa_jerusalem_railway", "tel_aviv_haifa_road", "jaffa_jerusalem_road" }, kept);
+ foreach (var later in new[] { "burma_road", "yarkon_rail_link", "tlv_netanya_road" })
+ CollectionAssert.DoesNotContain(kept, later);
+ }
+
+ /// <summary>#786: the unit tokens keep off the routes drawn while any of them stands (to the end of the last anchor's
+ /// window in units_1948.yaml): the Burma Road, opened in June 1948, still does; the 1949 rail link and the 1950 Tel
+ /// Aviv–Netanya road, opened after the last token leaves, take no spot (the straight 1950 road left Kiryati none in
+ /// Tel Aviv).</summary>
+ [Test]
+ public void TheUnitsKeepOffOnlyTheRoutesDrawnWhileTheyStand()
+ {
+ var routes = RoutePaths.Parse(CommittedYaml, Bounds);
+ var units = Statecraft.Game.Map.Units.UnitData.Parse(File.ReadAllText(Path.Combine(Paths.Content, "map", Statecraft.Game.Map.Units.UnitData.DefaultFileName)));
+ var until = units.SelectMany(u => u.Anchors).Max(a => Statecraft.Game.Map.Units.UnitData.Day(a.To));
+ var kept = RouteLayer.UnitRoutes(routes, until).Select(r => r.Id).ToList();
+ CollectionAssert.IsSubsetOf(new[] { "jaffa_jerusalem_railway", "tel_aviv_haifa_road", "burma_road" }, kept);
+ foreach (var later in new[] { "yarkon_rail_link", "tlv_netanya_road" })
+ CollectionAssert.DoesNotContain(kept, later);
+ Assert.AreEqual(routes.Count - 2, kept.Count, "only the two Phase 4 routes open after the war's last token");
+ }
+
+ /// <summary>Kits and routes together (#179 on main): no kit building, landmark or tree reaches into the corridor of a
+ /// route drawn at the start (RouteLayer.KitRoutes), half the drawn width plus RouteLayer.CorridorMarginM. Checked by
+ /// brute force against every segment, independent of KitGround's grid.</summary>
[Test]
public void NoKitBuildingOrTreeStandsOnARoute()
{
@@ -537,11 +573,12 @@ public class RouteTests
{
map.Build();
Assert.IsNotNull(map.KitStats, "Map.unity builds the kits");
- var routes = RoutePaths.Parse(CommittedYaml, Bounds);
+ var all = RoutePaths.Parse(CommittedYaml, Bounds);
+ var routes = RouteLayer.KitRoutes(all).ToList();
var corridors = RouteLayer.Corridors(map.Frame, routes);
// Plus one segment per unit clearing (a unit token in a town: docs/units.md, "Placement").
Assert.AreEqual(corridors.Sum(c => c.line.Count - 1) + map.UnitClearings.Count, map.KitStats.CorridorSegments, "the map hands every route to the kits");
- Assert.IsTrue(routes.Any(r => r.Id == "burma_road"), "the dated Burma Road keeps its corridor from the start");
+ Assert.IsFalse(routes.Any(r => r.Id == "burma_road"), "a route drawn after the start keeps no kits off (#786)");
// Every corridor clears its drawn ribbon by at least the roads' margin, and the roads' stays main's 250 m (so the
// wider road moves no town kit).
for (int i = 0; i < routes.Count; i++)
@@ -572,6 +609,12 @@ public class RouteTests
return Clearance(new Vector2(p.x, p.z)) < crown - 0.01f;
});
TestContext.WriteLine($"{lots.Count} lots, {trees.Count} trees, {map.KitStats.CorridorSegments} route segments: {badLots} lots and {badTrees} trees on a route");
+ // What the later routes now draw over (#786), for the record: not a failure.
+ var later = RouteLayer.Corridors(map.Frame, all.Where(r => !routes.Contains(r)));
+ float LaterClearance(Vector2 p) => later.Min(c => Enumerable.Range(0, c.line.Count - 1)
+ .Min(i => Statecraft.Game.Map.Kits.KitGround.SegmentDistance(p, c.line[i], c.line[i + 1]) - c.halfWidth));
+ TestContext.WriteLine($"LATER ROUTES {string.Join(",", all.Where(r => !routes.Contains(r)).Select(r => r.Id))}: "
+ + $"{lots.Count(l => LaterClearance(l.centre) < l.radius)} lots and {trees.Count(t => { Vector3 p = t.Item2.GetColumn(3); return LaterClearance(new Vector2(p.x, p.z)) < 0f; })} trees within their corridors");
Assert.AreEqual(0, badLots, "no building or landmark lot reaches a route corridor");
Assert.AreEqual(0, badTrees, "no tree crown reaches a route corridor");
Assert.AreEqual(map.Settlements.Count, lots.Select(l => l.id).Distinct().Count(), "every town still has buildings");
diff --git a/unity/Assets/Tests/EditMode/SimBridgeSiteTests.cs b/unity/Assets/Tests/EditMode/SimBridgeSiteTests.cs
index 58a0992ea..891973729 100644
--- a/unity/Assets/Tests/EditMode/SimBridgeSiteTests.cs
+++ b/unity/Assets/Tests/EditMode/SimBridgeSiteTests.cs
@@ -37,13 +37,25 @@ public class SimBridgeSiteTests
Assert.IsInstanceOf<StopWork>(b.Queued[0]);
}
+ // Corridors (#786): a road or rail order names a segment of corridors.yaml, "corridor:N".
+ [Test]
+ public void ACorridorOrderQueuesInTheSlice()
+ {
+ var (b, id) = WithAHalutz();
+ Assert.IsNull(b.Queue(new PioneerWork(id, Corridors.BuildRoad, "burma_road:4")));
+ Assert.IsNull(b.Queue(new PioneerWork(id, Corridors.BuildRail, "tlv_haifa_rail:1"))); // the same unit: replaces it
+ Assert.AreEqual(1, b.Queued.Count);
+ }
+
[Test]
public void AnUnknownIdIsRefusedAndNothingIsQueued()
{
var t = Text;
var (b, id) = WithAHalutz();
Assert.AreEqual(t.Format("order.unknown", "unit"), b.Queue(new PioneerWork(99, Projects.BuildYishuv, "mefalsim")));
- Assert.AreEqual(t.Format("order.unknown", "pioneer work"), b.Queue(new PioneerWork(id, "build_road", "mefalsim")));
+ Assert.AreEqual(t.Format("order.unknown", "pioneer work"), b.Queue(new PioneerWork(id, "dig_well", "mefalsim")));
+ Assert.AreEqual(t.Format("order.unknown", "corridor segment"), b.Queue(new PioneerWork(id, Corridors.BuildRoad, "burma_road:5")));
+ Assert.AreEqual(t.Format("order.unknown", "corridor segment"), b.Queue(new PioneerWork(id, Corridors.BuildRoad, "mefalsim")));
Assert.AreEqual(t.Format("order.unknown", "site"), b.Queue(new PioneerWork(id, Projects.BuildYishuv, "yeruham")));
Assert.AreEqual(t.Format("order.unknown", "unit"), b.Queue(new StopWork(99)));
Assert.AreEqual(0, b.Queued.Count);
diff --git a/unity/Assets/Tests/EditMode/TownCensusTests.cs b/unity/Assets/Tests/EditMode/TownCensusTests.cs
index a0acef1e2..6ceddeaf8 100644
--- a/unity/Assets/Tests/EditMode/TownCensusTests.cs
+++ b/unity/Assets/Tests/EditMode/TownCensusTests.cs
@@ -39,7 +39,7 @@ public class TownCensusTests
{
g = new KitGround(map.Terrain, map.Frame, map.Hexes, HeightmapLoader.Load(Statecraft.Game.Paths.StreamingMap).meta.elev_min_m);
// The corridors MapScene.Build gives the kits: the routes and the units' clearings.
- foreach (var c in map.RouteCorridors) g.AddCorridor(c.line, c.halfWidth);
+ foreach (var c in map.KitRouteCorridors) g.AddCorridor(c.line, c.halfWidth); // as the map builds its kits (#786)
foreach (var c in map.UnitClearings) g.AddCorridor(new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius);
// With the 1948 localities, as the map builds them (their landmarks claim their hearts before any town's houses).
var localities = map.Localities.Select(p => p.Settlement).ToList();
diff --git a/unity/Assets/Tests/EditMode/TownModelScaleTests.cs b/unity/Assets/Tests/EditMode/TownModelScaleTests.cs
index d4b732ae5..cfb9effa2 100644
--- a/unity/Assets/Tests/EditMode/TownModelScaleTests.cs
+++ b/unity/Assets/Tests/EditMode/TownModelScaleTests.cs
@@ -45,7 +45,7 @@ public class TownModelScaleTests
EditorSceneManager.OpenScene("Assets/Map.unity", OpenSceneMode.Single);
map = UnityEngine.Object.FindFirstObjectByType<MapScene>(); map.Build();
var g = new KitGround(map.Terrain, map.Frame, map.Hexes, map.ElevMinM);
- foreach (var c in map.RouteCorridors) g.AddCorridor(c.line, c.halfWidth);
+ foreach (var c in map.KitRouteCorridors) g.AddCorridor(c.line, c.halfWidth); // as the map builds its kits (#786)
foreach (var c in map.UnitClearings) g.AddCorridor(new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius);
var built = SettlementKits.Build(map.Settlements, map.Localities.Select(p => p.Settlement).ToList(), new List<Localities.Area>(), g, out placed);
foreach (var k in built.Towns) UnityEngine.Object.DestroyImmediate(k.mesh);
diff --git a/unity/Assets/Tests/EditMode/TownModelTests.cs b/unity/Assets/Tests/EditMode/TownModelTests.cs
index 2cf55b001..35c50d9a6 100644
--- a/unity/Assets/Tests/EditMode/TownModelTests.cs
+++ b/unity/Assets/Tests/EditMode/TownModelTests.cs
@@ -35,7 +35,7 @@ public class TownModelTests
static SettlementKits.Result Build(MapScene map, out List<SettlementKits.Placed> placed)
{
var g = new KitGround(map.Terrain, map.Frame, map.Hexes, map.ElevMinM);
- foreach (var c in map.RouteCorridors) g.AddCorridor(c.line, c.halfWidth);
+ foreach (var c in map.KitRouteCorridors) g.AddCorridor(c.line, c.halfWidth); // as the map builds its kits (#786)
foreach (var c in map.UnitClearings) g.AddCorridor(new List<Vector2> { c.centre, c.centre + Vector2.right }, c.radius);
var built = SettlementKits.Build(map.Settlements, map.Localities.Select(p => p.Settlement).ToList(), new List<Localities.Area>(), g, out placed);
foreach (var k in built.Towns) UnityEngine.Object.DestroyImmediate(k.mesh);
diff --git a/unity/Assets/UI/strings.en.yaml b/unity/Assets/UI/strings.en.yaml
index a229ba4c8..ee341af30 100644
--- a/unity/Assets/UI/strings.en.yaml
+++ b/unity/Assets/UI/strings.en.yaml
@@ -126,6 +126,7 @@ order.kind.unit: "unit"
order.kind.pioneer_work: "pioneer work"
order.kind.site: "site"
order.kind.city_project: "city project"
+order.kind.corridor_segment: "corridor segment"
order.invalid: "That order is not valid"
order.failed: "The turn could not run. Your orders were cleared. Give them again."
defence.rung1: "1 Routine threat: border incidents, deterrence upkeep"
diff --git a/unity/Assets/UI/strings.he.yaml b/unity/Assets/UI/strings.he.yaml
index d82b1ecc9..a108695c4 100644
--- a/unity/Assets/UI/strings.he.yaml
+++ b/unity/Assets/UI/strings.he.yaml
@@ -126,6 +126,8 @@ order.kind.pioneer_work: "עבודה חלוצית"
order.kind.site: "אתר"
# A city project (#735; Q-UI-2's approved "מיזם דיור" for housing, with עירוני for any kind). For the native reviewer (#564).
order.kind.city_project: "מיזם עירוני"
+# For the native reviewer (#564): "a segment of a road or a railway" (#786).
+order.kind.corridor_segment: "קטע של כביש או מסילה"
order.invalid: "הפקודה אינה תקפה"
# order.failed: the turn failed and SimBridge.EndTurn cleared the queue, so the player gives the orders again (#622;
# maintainer, 15 October 2026). For the native reviewer (#564).