Skip to content

Fix un-runnable snippet on the "Meet the robot" lesson - #24

Open
tytremblay wants to merge 1 commit into
mainfrom
fix-robot-api-runnable-snippet
Open

Fix un-runnable snippet on the "Meet the robot" lesson#24
tytremblay wants to merge 1 commit into
mainfrom
fix-robot-api-runnable-snippet

Conversation

@tytremblay

Copy link
Copy Markdown
Contributor

Problem

Running the code on the "Meet the robot" lesson (algorithms-robot-api, page 1) failed with cannot find symbol errors for Maze, GridMaze, Robot, and grid.

The site makes only the first ```java fence per page the runnable snippet (firstJavaSnippet in site/src/lib/lessons.ts). On page 1 that was an illustrative two-liner:

Maze maze = new GridMaze(grid);
Robot robot = maze.robot();

— no import, and grid is out of scope. Auto-wrapped in a Main shell and compiled, it can't resolve any of those symbols. The complete, importing MeetTheRobot example lower on the page never got to be the runnable one.

Fix

Mark the illustrative fragment as ```text so it renders as a plain sample, promoting the full MeetTheRobot class to the page's runnable snippet.

Scope check

Audited the other three Algorithms lessons — algorithms (no java fences), algorithms-maze-data (self-contained bare-statement snippets), and algorithms-maze-solver (first fence is the full WallFollower class). This was the only lesson affected.

🤖 Generated with Claude Code

The site makes only the first ```java fence per page the runnable
snippet. On page 1 of algorithms-robot-api that was an illustrative
two-liner referencing an out-of-scope `grid` and no imports, so
pressing Run produced "cannot find symbol" errors for Maze/GridMaze/
Robot/grid instead of the intended full MeetTheRobot example.

Mark the illustrative fragment as ```text so the complete, importing
MeetTheRobot class becomes the page's runnable snippet.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants