Add the interactive maze API and implement the solver - #2
Merged
Conversation
Promote the interactive robot API into the library for real, so the lesson
site no longer needs its temporary maze-engine shim:
- Direction becomes an enum { UP, DOWN, LEFT, RIGHT } (same N/S/E/W bit
values) with bit()/opposite()/clockwise()/counterClockwise().
- Add the Robot/Maze/Cell interfaces and concrete GridMaze/GridRobot/GridCell.
The robot API is sensor/drivetrain-shaped: readWallSensor(Direction) (true =
wall), drive(Direction) (no-op into a wall), and facing(), which the robot
auto-updates on each successful drive.
- Implement DefaultMazeSolver.solve() as a breadth-first search (shortest path).
- Update CONTRACT.md with the interactive API and the UP/DOWN/LEFT/RIGHT naming.
- Tests: 11 green under --release 8.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# Conflicts: # CONTRACT.md # src/main/java/com/frc2713/mazesolver/Cell.java # src/main/java/com/frc2713/mazesolver/DefaultMazeSolver.java # src/main/java/com/frc2713/mazesolver/Maze.java # src/main/java/com/frc2713/mazesolver/MazeSolver.java # src/main/java/com/frc2713/mazesolver/Robot.java
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.
Promotes the interactive robot API into the library for real, so the lesson site (
FRC2713/software_training) no longer needs its temporarymaze-engine.jarshim. Pairs with software_training PR #21.What's here
Directionis now anenum { UP, DOWN, LEFT, RIGHT }(same N/S/E/W bit values as before) withbit(),opposite(),clockwise(),counterClockwise().Robot/Maze/Cellinterfaces + concreteGridMaze/GridRobot/GridCell, moved out of the site's shim. The robot API is sensor/drivetrain-shaped:readWallSensor(Direction)—trueif that side is a walldrive(Direction)— move one cell; a no-op into a wallfacing()— the direction of the last drive, auto-updated bydrive()DefaultMazeSolver.solve()implemented as a breadth-first search (returns the shortest path, orint[0][]if unreachable).CONTRACT.mdupdated with the interactive API and theUP/DOWN/LEFT/RIGHTnaming.Testing
mvn -B test— 11/11 green, built under--release 8(CheerpJ / OpenJDK 8).The software_training Pages deploy rebuilds this library from
mainon every deploy, so this must merge before the maze-module change reaches software_training'smain— otherwise the deployed site compiles its new lesson snippets against a jar without this API.🤖 Generated with Claude Code