Student-facing interfaces (Maze, Cell, Robot); reframe MazeSolver - #1
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 outCells and aRobot; hides theint[][].Changed
MazeSolverreframed fromint[][] solve(int[][])tovoid solve(Robot)— this is the algorithm a student writes, by driving a robot to the goal.Directionkept, now documented as implementer-facing only.DefaultMazeSolverstub (implemented the old signature).CONTRACT.md/README.mdrewritten around two layers: theint[][]bitmask wire format (implementer-only) vs. the student-facing interface API, plus theGridMaze(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 fromint[][]) and the concreteCell/Robotit returns — the only place the bitmask is read.CONTRACT.mdspecifies exactly what they must do.Verification
mvn verifypasses; both existingDirectiontests green.🤖 Generated with Claude Code