Skip to content

Student-facing interfaces (Maze, Cell, Robot); reframe MazeSolver - #1

Merged
tytremblay merged 1 commit into
mainfrom
student-facing-interfaces
Aug 1, 2026
Merged

Student-facing interfaces (Maze, Cell, Robot); reframe MazeSolver#1
tytremblay merged 1 commit into
mainfrom
student-facing-interfaces

Conversation

@tytremblay

Copy link
Copy Markdown
Contributor

Adds the bitmask-free, student-facing API and leaves every concrete class for the implementer (Owen). The split follows the plan: the site defines the interfaces, Owen implements them, new students use the finished library — so the bitmask work lands on the implementer, never the beginners.

New interfaces (student-facing)

  • Cell — one square: wallUp/Down/Left/Right(), isStart(), isGoal().
  • Robot — walks the maze: canMoveUp/…(), moveUp/…(), atGoal(), trail().
  • Maze — hands out Cells and a Robot; hides the int[][].

Changed

  • MazeSolver reframed from int[][] solve(int[][]) to void solve(Robot) — this is the algorithm a student writes, by driving a robot to the goal.
  • Direction kept, now documented as implementer-facing only.
  • Removed the DefaultMazeSolver stub (implemented the old signature).
  • CONTRACT.md / README.md rewritten around two layers: the int[][] bitmask wire format (implementer-only) vs. the student-facing interface API, plus the GridMaze(int[][]) entry point the lesson site depends on.

Directions are screen-relative (up/down/left/right), mapped to N/S/E/W under the hood.

Left for the implementer (Owen)

GridMaze implements Maze (built from int[][]) and the concrete Cell/Robot it returns — the only place the bitmask is read. CONTRACT.md specifies exactly what they must do.

Verification

  • mvn verify passes; both existing Direction tests green.
  • Jar builds at ~4 KB (well under budget).
  • All classes are Java 8 bytecode (major version 52) — repo CI checks pass.

🤖 Generated with Claude Code

Introduce the bitmask-free API new students write against, leaving the
concrete implementations for the implementer:

- Cell, Robot, Maze: interfaces with plain up/down/left/right queries and
  moves (wallRight(), canMoveRight(), moveRight(), atGoal(), trail()) — no
  bitmasks in sight.
- MazeSolver: reframed from `int[][] solve(int[][])` to `void solve(Robot)`,
  so a student implements the *algorithm* by driving a robot to the goal.
- Direction bitmask constants kept as implementer-facing only.
- Remove the DefaultMazeSolver stub; the concrete side (GridMaze + the
  Cell/Robot it returns) is specified in CONTRACT.md for the implementer.
- CONTRACT.md/README rewritten around the two layers: int[][] wire format
  (implementer-only) vs. the student-facing interface API, and the GridMaze
  entry point the lesson site depends on.

Builds green: mvn verify passes, all classes are Java 8 bytecode (major 52).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tytremblay
tytremblay merged commit d8ce7f4 into main Aug 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant