Problem statement
Main Street currently stores street cards in a 10-slot array but adjacency/synergy still behaves like a linear strip. The scene now renders a 2x5 board, so adjacency should be distance-based on that grid.
Users
- Players: expect nearby cards on the 2x5 board to synergize consistently with visual layout.
- Designers/QA: need deterministic, testable adjacency that matches board geometry.
- Developers: need reusable mapping helpers from slot index to grid cell and distance-based neighbor calculation.
Success criteria
- Adjacency uses 2x5 grid coordinates (5 columns x 2 rows) instead of linear neighbors.
- Default synergy range (range=1) counts orthogonal neighbors by Manhattan distance (up/down/left/right), no diagonals.
- Extended range from upgrades (
synergyRangeBonus) expands Manhattan radius correctly.
- Existing APIs remain stable for callers (
neighbors, computeSynergyBonus, computeBusinessIncome, computeIncome, applyIncome).
- Unit tests cover edge/corner/middle cells, range extension, and asymmetry when only one business has upgraded range.
- Main Street regression suite passes (
npm test and npm run build).
- Documentation explains the grid-distance adjacency model and migration notes for future balancing.
Constraints
- Keep the
streetGrid storage shape as a 10-slot array for compatibility.
- Preserve deterministic behavior and avoid randomization changes.
- Do not introduce breaking changes to scene or transcript formats.
Implementation approach
- Implement index<->cell mapping helpers inside
MainStreetAdjacency.ts.
- Recompute
neighbors(index, range) from Manhattan distance over 2x5 coordinates.
- Update adjacency tests in
tests/main-street/adjacency.test.ts to match the new geometry.
- Update docs (
docs/main-street/prd-milestone-4.md) with the grid-distance rule.
Related work
- Parent milestone: Main Street: PRD Milestone 4 -- Visual Polish, Animation, and Audio (CG-0MM4RF91E1LR5RSY)
- Discovered from: Unify card dimensions across UI (CG-0MO4NFMY4005DK66)
Problem statement
Main Street currently stores street cards in a 10-slot array but adjacency/synergy still behaves like a linear strip. The scene now renders a 2x5 board, so adjacency should be distance-based on that grid.
Users
Success criteria
synergyRangeBonus) expands Manhattan radius correctly.neighbors,computeSynergyBonus,computeBusinessIncome,computeIncome,applyIncome).npm testandnpm run build).Constraints
streetGridstorage shape as a 10-slot array for compatibility.Implementation approach
MainStreetAdjacency.ts.neighbors(index, range)from Manhattan distance over 2x5 coordinates.tests/main-street/adjacency.test.tsto match the new geometry.docs/main-street/prd-milestone-4.md) with the grid-distance rule.Related work