Repository navigation
Description
Summary
Neon Maze has a single layout, exported as a module-level constant, so every level and every run uses the same maze. The roadmap asks for more maze layouts; the first step is letting the game hold more than one.
Where
games/maze/maze.ts:8to32(LEFTand the exportedMAZE)games/maze/maze.ts:44to49(TUNNEL_ROW,DOOR,HOUSE_EXIT,HOUSE_Y,BONUS_CELL, fixed for that one layout)games/maze/chase.tsandgames/maze/scenes/GameScene.ts(readMAZEand the helpers built on it directly)README.md:370(roadmap item)
Details
export const MAZE: readonly string[] = LEFT.map((row) => row + [...row.slice(0, COLS >> 1)].reverse().join(''));tile, open and find close over that constant, and the landmark cells are separate hand-written constants, so adding a second layout today means editing all of them together.
Impact
Players see the same maze on every level. A second and third layout that rotate as levels are cleared would add variety with no new mechanics.
Suggested fix
- Turn the layout into data: a
Layoutbuilt from its left-half rows, with the landmarks (door, house, tunnel row, bonus cell, runner start) derived from the characters in the grid instead of separate constants. - Make
tile,open,findand the chase helpers take the active layout (or provide auseLayout()setter called at level start). - Add one or two more layouts and pick by
level % layouts.length. - Extend
games/maze/maze.test.tsso every layout passes the existing invariants (mirrored, enclosed, every dot reachable, exactly one door and start).
Trade-off: the level-clear trophies and the daily-style comparisons stay meaningful only if the layout order is fixed, so rotate in order and do not randomize.
Acceptance criteria
- The game has at least two layouts and moves to the next one when a level is cleared
- Every layout passes the invariant tests
- Chaser behavior, the tunnel and the bonus item work on each layout
- The menu's decorative maze still renders
Getting started
- Relevant files:
games/maze/maze.ts,games/maze/maze.test.ts,games/maze/chase.ts,games/maze/scenes/GameScene.ts - How to run tests:
npm test - Related docs:
CONTRIBUTING.md, the roadmap inREADME.md
Filed by repo-audit/feature-ideas at 5d19354. Severity: low. Effort: M. audit-key: enhancement|games/maze/maze.ts|MAZE
Activity
TMHSDigital commentedon Nov 14, 2026
Fixed in bda5cad:
games/maze/maze.tsholds a list of layouts with auseLayout()switch, a second layout is added, and each level plays the next one in order. Verified with the maze invariant tests run against every layout (shape, mirror, tunnel, door, power cells, reachability), two new ones (shared middle block, no dead ends), typecheck, lint, the full test run (435 passing) and a production build; the built game boots and starts level 1 without errors. Level 2 on the new layout was not played through by hand, so chaser behavior there is covered by the invariants only.