Skip to content

Lesson 7: state goals in the prompts, move the answer code into hints - #21

Merged
MBimrose merged 11 commits into
mainfrom
claude/peaceful-lovelace-5dsi0d
Nov 16, 2026
Merged

MBimrose merged 11 commits into
mainfrom
claude/peaceful-lovelace-5dsi0d

Conversation

@MBimrose

Copy link
Copy Markdown
Member

Summary

Follow-up to #20. That PR gave every lesson 7 exercise the information it needs, but several prompts also gave the exact lines of the answer. Now each exercise in _data/exercises/py7_*.yml works this way:

  • What you need still names every call, constructor, flag, starting value, key and unit, so a student never has to guess a name.
  • The parts say what the code must do, not the code itself.
  • The hints hold the step-by-step code. The Hint button shows them one at a time, from "check clear_jam first" to the exact line.
  • The help gets smaller through the lesson. Exercise 1 keeps the intake.py example. Exercise 9 is mostly goals, plus "you have the tools from exercises 1, 5, 6 and 7".

An independent review then worked each exercise as a beginner. It found nothing the checks need that the prompt, starter or page does not state. It also found a few examples that still used the answer's own values. Those now use names in place of values: drive_path(self.robot, name, seconds), withTimeout(seconds), wait(seconds), hasElapsed(seconds) and rotateBy(other). The page no longer says that exercise 7 makes the one-group error happen.

The checks and the solutions do not change.

Checks

  • python3 tools/validate-exercises.py: every lesson 7 exercise is ok. The 2 problems it reports are older, in py5_independent_intakes and py6_intake_callbacks.
  • python3 tools/validate-robotpy-browser.py --robotpy …: the browser copy and the real RobotPy 2026 agree on every check.
  • node tools/check-ste.js: no hard findings on the lesson page.
  • The site builds, and all 10 exercise blocks render.

Generated by Claude Code

claude added 11 commits November 9, 2026 19:11
Link the interactive Learn Git Branching tutorial in the Getting Started
section and the Additional Resources list so students can practice Git
commands hands-on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
A tutorial page that goes through the RobotPy code from Robot-2024-Public,
Robot-2025-Public and Robot-2026 (tracking-hub), file by file: robot.py and
CoroutineRobot, subsystems, Phoenix 6, const.py, wpimath geometry and
control, the OI bindings, commandify coroutines, autos and command groups,
the dashboard, and the Python features the code uses.

practice/robotpy is a set of eight exercises with pytest checks that run
against the real RobotPy 2026 libraries, plus a small practice robot that
runs with "robotpy sim" and "robotpy test". tools/validate-robotpy-practice.py
checks that each starter fails and each solution passes.

Behaviors checked with RobotPy 2026 while writing this:
- whenHeld with a plain function runs one time; a generator runs each loop
- a command in two groups raises IllegalCommandUse
- calling a commandify command gives a broken command (TypeError when run)
- periodic() runs while disabled
- CoroutineRobot stores robotInit on the instance, which hides the hook that
  "robotpy test" uses, so robot tests time out. The practice pack copy of
  wpilibextra makes these class methods.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
The lesson 7 exercises now use the same in-page Python exercise widget as
lessons 1 to 6, instead of a local pytest practice pack.

The real RobotPy libraries cannot load in Pyodide, so assets/py/robotpy is a
small plain-Python copy of the parts our code uses: wpilib, wpimath,
commands2 and phoenix6, plus an exact copy of wpilibextra from Robot-2026 and
a cz_sim helper for the checks. An exercise with `library: robotpy` loads it
before the student's code, and the worker imports it fresh for every run.

- python-worker.js: download a library manifest once, write the files into
  Pyodide, and forget the modules before each run
- python-exercise.html / .js: pass the library URL to the worker
- _config.yml: include __init__.py and _sim.py, which Jekyll leaves out
- 10 exercises in _data/exercises/py7_*.yml (one Try it block)
- validate-exercises.py: understands `library:`, and treats Try it blocks
  (no tests, no solution) as code that only has to run
- validate-robotpy-browser.py: runs every lesson 7 check with the browser
  copy and with the real RobotPy 2026; both must agree
- e2e test for the lesson 7 page
- the local practice pack (practice/robotpy) and its tools are removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
The exercises were numbered in the order they were written, so the page
showed Exercise 3, then 2, then 1, then 7, 4, 5, 6, 8 and R. They are now
1 to 9 from the top of the page, and the part labels inside each exercise
(1.1, 2.1, ... 9.3) match. The robot exercise is now Exercise 9 instead of R.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
…no changes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
A student could not write periodic() in the hopper exercise: the prompt said
"runs at JAM_SPEED" but never said to call self.set_speed(), never said
where the flags come from, and showed no example. The other exercises had
the same kind of gap: a call, a constructor, or a flag the student had to
guess.

Each prompt now has a "What you need" list with the exact calls, the flags
that the stand-in robot has and their start values, and the parts as plain
steps. The hopper prompt also shows the same if/elif/else shape from
periodic() in intake.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
- 3.3: the check now accepts any form of the flipped heading (210 or
  -150 degrees), and the prompt names rotateBy and explains the -150
- 3.3 and 3.4: say that rotateBy, + and - return a new object, so the
  result must be saved
- 5.4: say that the += 2 goes before the yield, and give that mistake its
  own failure message instead of the plain-function one
- 8.3: point to the "Pick the auto" section, which the student can see,
  instead of hopper.py
- the page says which library parts the browser copy does not have

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
The last pass gave every exercise the names it needs, but several prompts
also gave the exact lines of the answer. Now:

- "What you need" still lists every call, constructor, flag and start value
- the parts say what the code must do, not the code itself
- the step-by-step code is in the hints, which the Hint button shows one
  at a time
- the help gets smaller through the lesson: exercise 1 keeps the
  intake.py example, and exercise 9 is mostly goals

The checks and solutions do not change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
…no changes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
An independent review found no missing information after the rewrite, but
a few "What you need" examples still used the answer's own values. They now
use names in place of values: drive_path(self.robot, name, seconds),
withTimeout(seconds), wait(seconds), hasElapsed(seconds), and
rotateBy(other). The point_in_front recipe moved to the hints, the 6.2
starter comment no longer gives the wait line, and the page no longer says
that exercise 7 makes the one-group error happen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
@MBimrose
MBimrose merged commit 5e035d0 into main Nov 16, 2026
1 check passed
MBimrose pushed a commit that referenced this pull request Nov 16, 2026
…no changes)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dqu5om52cZsRn7kinP82t
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