Update PLAN.md: mark Phase 2 as done

This commit is contained in:
Samuel Bouchet 2026-04-10 15:35:55 +02:00
parent 3120d9835e
commit d1926c2b4d

32
PLAN.md
View file

@ -7,30 +7,18 @@
- Relay chain mechanic with shared relay points (collision-free alternating)
- Transfer system: production → pieces → demands, 4-adjacency, participation tracking
- Victory/defeat: all demands met vs deadline expired
- 57 tests passing: unit, solvability, full-level (Levels 1-3)
### Key findings from Phase 1
## Phase 2: Cargo-type aware transfers (DONE)
- **Transfer direction bug fixed**: receiver priority in piece-to-piece transfers now
prefers pieces farther from production (pushes cargo forward, not backward).
- **GDD stock corrections**: Level 2 needs 6R+1B (GDD had 4R+1B), Level 3 simplified
to single cargo type with 6R+1K (GDD had 4R+1B+2K for dual-cargo, which is infeasible).
- **Cross-route contamination**: TransferResolver has no cargo-type filtering — adjacent
pieces from different routes transfer cargo regardless of type. On a 6x6 board, two
diagonal routes cannot avoid cross-adjacency. Dual-cargo levels require engine support.
## Phase 2: Cargo-type aware transfers
**Goal**: Enable multi-route, multi-cargo-type levels on small boards.
- Add optional cargo-type filter to pieces (or routes), so a piece configured for Wood
ignores adjacent Stone and vice-versa.
- Alternative: transfer resolver checks if cargo type matches the demand reachable from
the receiver's relay chain (more complex, automatic).
- Simplest approach: production only gives to pieces whose relay chain leads toward a
compatible demand. Requires route/chain tracking.
- Test: reintroduce Level 3 dual-cargo variant (Wood + Stone crossing 6x6 board with
L-shaped wall).
- `CargoFilter` property on `PieceState`: optional `CargoType?` restricting accepted cargo
- Auto-assigned at placement via relay chain tracing (adjacency to production, then shared
relay points with filtered pieces)
- `TransferResolver` enforces filter: receivers with mismatched `CargoFilter` are skipped
- Forward-direction sorting uses cargo-type-aware `MinDistanceToProduction` to avoid
wrong sorting when multiple productions exist
- Level 3 restored to dual-cargo (Wood+Stone) with 10R+2K stock
- GDD stock corrections: Level 2 = 6R+1B, Level 3 = 10R+2K
- 60 tests passing including 2 new CargoFilter tests
## Phase 3: Surplus stock and puzzle difficulty tuning