Skip to content

Add the interactive maze API and implement the solver - #2

Merged
tytremblay merged 2 commits into
mainfrom
maze-interactive-api
Aug 2, 2026
Merged

Add the interactive maze API and implement the solver#2
tytremblay merged 2 commits into
mainfrom
maze-interactive-api

Conversation

@tytremblay

Copy link
Copy Markdown
Contributor

Promotes the interactive robot API into the library for real, so the lesson site (FRC2713/software_training) no longer needs its temporary maze-engine.jar shim. Pairs with software_training PR #21.

What's here

  • Direction is now an enum { UP, DOWN, LEFT, RIGHT } (same N/S/E/W bit values as before) with bit(), opposite(), clockwise(), counterClockwise().
  • Robot / Maze / Cell interfaces + concrete GridMaze / GridRobot / GridCell, moved out of the site's shim. The robot API is sensor/drivetrain-shaped:
    • readWallSensor(Direction)true if that side is a wall
    • drive(Direction) — move one cell; a no-op into a wall
    • facing() — the direction of the last drive, auto-updated by drive()
  • DefaultMazeSolver.solve() implemented as a breadth-first search (returns the shortest path, or int[0][] if unreachable).
  • CONTRACT.md updated with the interactive API and the UP/DOWN/LEFT/RIGHT naming.

Testing

mvn -B test — 11/11 green, built under --release 8 (CheerpJ / OpenJDK 8).

⚠️ Merge ordering

The software_training Pages deploy rebuilds this library from main on every deploy, so this must merge before the maze-module change reaches software_training's main — otherwise the deployed site compiles its new lesson snippets against a jar without this API.

🤖 Generated with Claude Code

tytremblay and others added 2 commits August 1, 2026 15:21
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
@tytremblay
tytremblay merged commit fe298bb into main Aug 2, 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