# E2E Test Suite Ready: Wilderness Map Generation Parity (Issue #455) ## Test Runner - **Command**: `npx vitest run tests/wilderness-d2moo-parity.test.ts` - **Typecheck Command**: `npx tsc --noEmit` (passes with 0 errors) - **Ground Truth Oracle Binary**: `/usr/local/google/home/taodao/tmp/d2moo_runner/d2moo_mapgen` - **Golden Fixtures Directory**: `tests/fixtures/d2moo/` ## Coverage Summary | Tier | Category | Cases | Description | Current Status | |:---:|:---|:---:|:---|:---:| | **Tier 1** | Dynamic Dimensions & Orientation (R1) | 8 | Sizing parity: 96×56 horizontal vs 56×96 vertical Moor; 80×80 Cold Plains & Stony Field | 6 Passed (Oracle) / 2 Failed (TS M1) | | **Tier 2** | Outer River Placement & Suppression (R2) | 3 | Dual-column `URiverC` (x=80) & `LRiverC` (x=88); outer tree wall suppression along East river | 2 Passed (Oracle) / 1 Failed (TS M2) | | **Tier 3** | Town Transition Alignment (R4) | 2 | `TownSTrans.ds1` (56×8 tiles / 7×1 blocks) anchored to East river edge at (40, 0) | 2 Passed (Oracle & TS) | | **Tier 4** | Landmark Presets & FarAway Metric (R4) | 5 | All 5 canonical landmarks (DenEnt, Pond1, Cott1, Circle, Clover); zero overlap; FarAway metric `\|dx\| + 2*\|dy\|` | 4 Passed (Oracle) / 1 Failed (TS M4) | | **Tier 5** | Secondary Borders & 2×3 Closures (R3) | 2 | 4-pass evolution: `Bord5..8` peninsulas and interior isolated 2×3 forest closures (`Bord9..12`) | 1 Passed (Oracle) / 1 Failed (TS M3) | | **Tier 6** | Orthogonal Dirt Road Polyline (R5) | 2 | Contiguous orthogonal polyline paths; width-2 Bresenham rasterization; 0 spline deviations | 1 Passed (Oracle) / 1 Failed (TS M5) | | **Total** | **Comprehensive Suite** | **22** | **Full D2MOO Parity Test Suite** | **16 Passed / 6 Failed (TDD Red)** | ## Feature Checklist & Milestone Mapping | Feature | Milestone | Requirement | D2MOO Fixture Ground Truth | TS Generator Parity Assertion | |:---|:---:|:---:|:---:|:---:| | Dynamic Level Dimensions (96×56 vs 56×96) | M1 | R1 | ✓ Passed | ✕ Red (80×80 static in current `wilderness.ts`) | | Level Connection Topology & Flags | M1 | R1 | ✓ Passed | ✕ Red (Missing OUTDOOR_BRIDGE/RIVER flags) | | Dual-Column Outer River (x=80, 88) | M2 | R2 | ✓ Passed | ✕ Red (Internal river / missing outer boundary swap) | | Perimeter Tree Border Suppression on River | M2 | R2 | ✓ Passed | ✕ Red (Tree cliffs still placed on East edge) | | 4-Pass Secondary Border Peninsulas (Bord5..8) | M3 | R3 | ✓ Passed | ✕ Red (Only 1-pass border currently executed) | | Interior 2×3 Forest Closures (Bord9..12) | M3 | R3 | ✓ Passed | ✕ Red (0 isolated 2×3 enclosures stamped) | | TownSTrans (56×8) River Edge Alignment | M4 | R4 | ✓ Passed | ✓ Passed (Basic transition presence) | | Unconditional 5 Landmark Presets | M4 | R4 | ✓ Passed | ✕ Red (Pond mutually excluded when river exists) | | FarAway Spatial Anti-Overlap Metric | M4 | R4 | ✓ Passed | ✕ Red (DOE not maximizing distance from town) | | Orthogonal Dirt Road Polyline | M5 | R5 | ✓ Passed | ✕ Red (Catmull-Rom splines currently used) | | Width-2 Road Bresenham Rasterization | M5 | R5 | ✓ Passed | ✕ Red (0 dirt floor tiles in current Moor output) | | Base Floor 0x40002 & LvlSub Cluster | M6 | R6 | ✓ Passed | ✕ Red (Global noise sort instead of SubType 6) | ## Golden Fixtures Catalog (`tests/fixtures/d2moo/`) The following authentic D2MOO v1.13c layouts were extracted via native execution of `d2moo_mapgen` and checked into the repository for deterministic, hermetic CI verification: 1. `tests/fixtures/d2moo/level2_seed_0x12345678.json`: Blood Moor Horizontal 96×56, East river @ columns 10/11, TownSTrans @ (40, 0), all 5 landmarks, 7 peninsulas, 9 closures, 240 connected dirt tiles. 2. `tests/fixtures/d2moo/level2_seed_12345.json`: Blood Moor Horizontal 96×56, East river @ columns 10/11, all 5 landmarks, 4 peninsulas, 11 closures, 198 connected dirt tiles. 3. `tests/fixtures/d2moo/level2_seed_1.json`: Blood Moor Vertical 56×96 (7×12 blocks), North-South orientation, all 5 landmarks, 10 peninsulas, 12 closures, 283 connected dirt tiles. 4. `tests/fixtures/d2moo/level2_seed_42.json`: Blood Moor Vertical 56×96 (7×12 blocks), North-South orientation, all 5 landmarks, 9 peninsulas, 11 closures, 227 connected dirt tiles. 5. `tests/fixtures/d2moo/level3_seed_1.json`: Cold Plains 80×80 (10×10 blocks), Cave Level 1, Bishibosh camp, Cott1A, Circle, Clover, 13 peninsulas, 17 closures. 6. `tests/fixtures/d2moo/level3_seed_0x12345678.json`: Cold Plains 80×80, 14 peninsulas, 14 closures. 7. `tests/fixtures/d2moo/level4_seed_1.json`: Stony Field 80×80 (10×10 blocks), Cairn Stones, Underground Passage in cliff, Moldy Tome, Rakanishu camp, 8 peninsulas, 11 closures. 8. `tests/fixtures/d2moo/level4_seed_0x12345678.json`: Stony Field 80×80, 8 peninsulas, 10 closures. ## Discovered Implementation Defects (Escalated to Milestones M1..M6) Running `npx vitest run tests/wilderness-d2moo-parity.test.ts` discovered the following 6 implementation defects in `src/game/wilderness.ts`: 1. **Defect 1 (Milestone M1)**: Blood Moor dimensions are statically hardcoded to 80×80 rather than dynamically calculated as 96×56 (horizontal) or 56×96 (vertical) via `DRLGOUTPLACE_CreateLevelConnections`. 2. **Defect 2 (Milestone M2)**: River does not generate on outer boundary columns `x = nGridWidth - 2` (80) and `nGridWidth - 1` (88), and outer tree wall border pieces (`Bord*.ds1`) are not suppressed along the river column. 3. **Defect 3 (Milestone M3)**: Missing 4-pass secondary border evolution (`BorderCliffs`, `BorderMiddle`, `BorderCorner`, `BorderBorder`) and interior 2×3 isolated forest closures (`Bord9..Bord12`). 4. **Defect 4 (Milestone M4)**: River and Pond are mutually exclusive in `wilderness.ts`, preventing authentic concurrent placement of all 5 landmarks (`DenEnt`, `Pond1`, `Cott1`, `Circle`, `Clover`). 5. **Defect 5 (Milestone M4)**: FarAway metric is missing, resulting in non-canonical placement of Den of Evil. 6. **Defect 6 (Milestone M5)**: Dirt road generator uses Catmull-Rom splines instead of orthogonal Bresenham width-2 polyline vertex rasterization.