Skip to content

Neon Maze has a single layout on every level #85

Closed

Description

@TMHSDigital

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:8 to 32 (LEFT and the exported MAZE)
  • games/maze/maze.ts:44 to 49 (TUNNEL_ROW, DOOR, HOUSE_EXIT, HOUSE_Y, BONUS_CELL, fixed for that one layout)
  • games/maze/chase.ts and games/maze/scenes/GameScene.ts (read MAZE and 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 Layout built 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, find and the chase helpers take the active layout (or provide a useLayout() setter called at level start).
  • Add one or two more layouts and pick by level % layouts.length.
  • Extend games/maze/maze.test.ts so 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 in README.md

Filed by repo-audit/feature-ideas at 5d19354. Severity: low. Effort: M. audit-key: enhancement|games/maze/maze.ts|MAZE

Activity

  1. added
    enhancement
    help wanted
    severity: low
    on Nov 14, 2026
  2. TMHSDigital commented on Nov 14, 2026

    @TMHSDigital
    OwnerAuthor

    Fixed in bda5cad: games/maze/maze.ts holds a list of layouts with a useLayout() 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementhelp wantedseverity: low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions