Skip to content

Shuffle the step cards in tutorial 2 - #13

Merged
MBimrose merged 1 commit into
mainfrom
claude/jolly-wright-vz5il0
Sep 14, 2026
Merged

MBimrose merged 1 commit into
mainfrom
claude/jolly-wright-vz5il0

Conversation

@MBimrose

Copy link
Copy Markdown
Member

What was wrong

The five step cards in "Put the Steps in Order" were rendered straight from the STEPS array, and STEPS is written in an order that scores (lower → drive_piece → intake → drive_goal → shoot). A student could tap left to right without reading a single step and solve the exercise, which is the whole point of the tutorial.

What changed

  • assets/js/interactive/beginner.js — the bank is now shuffled, and the shuffle rejects any arrangement that would score. Reading order is never the answer.
  • The shuffle is saved per student. The routine already persists across visits, so a bank that re-scrambled on every load would not agree with the routine underneath it. A stale, duplicated, or accidentally-working saved order is thrown away.
  • _includes/interactive/first-sequence.html and docs/Code/Tutorials/first-sequence.md — the text now says the steps are not in order.
  • tools/validate-sequence.js (new) — the checker described below.

Why the rejection loop matters

Replaying all 120 orders through the real robot model, exactly four score:

lower        drive_piece  intake       drive_goal  shoot
lower        intake       drive_piece  drive_goal  shoot
drive_piece  lower        intake       drive_goal  shoot
intake       lower        drive_piece  drive_goal  shoot

There are four rather than one because the intake keeps running once it starts, so the robot can collect the game piece as it drives through. A plain shuffle would land on one of those about one visit in thirty and hand the answer back, so the shuffle repeats until the order is not one of them.

The new checker

That guarantee rests on the list of working orders being exact, so node tools/validate-sequence.js replays all 120 orders through the real robot and checks the list is still the whole set. The rules a step finishes by live in a closure with no module to load, so the tool holds a copy of them and fails loudly when that copy and the widget have parted. Both guards were tested: changing a threshold in stepDone and removing a line from the list each produce a failure.

It is listed with the other checks on the Tutorials page.

Checks run

  • node tools/validate-sequence.js — all checks pass.
  • The real shuffle code, run 200,000 times: no working order ever produced, and all 116 other orders reachable.
  • node tools/check-ste.js — clean on both edited pages.
  • Playwright first-tutorials.spec.mjs, sequence tests: every widget assertion passes. A wrong order is rejected with a reason, the right order scores, is-solved is set, and the code panel is correct.

One caveat on that browser run: the sequence tests and the untouched first-button test all fail their final expectNoErrors because cdn.jsdelivr.net is blocked in the sandbox the tests ran in, so mermaid never loads. The same failure appears on code this branch does not touch, and it fires after every behavioural assertion, but it does mean a fully green end-to-end run was not possible there.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CtC4MMv9XLZrAGLv712dF6


Generated by Claude Code

The five cards were shown in the order STEPS is written in, and that order
scores. A student could tap straight along the row and solve the exercise
without reading a single step, which is the whole point of the tutorial.

Shuffle the cards instead. Four of the 120 orders score, because the intake
keeps running once it starts and the robot can collect the game piece as it
drives through, so the shuffle rejects any arrangement that is one of those
four. Reading order is now never the answer.

Keep one student on one shuffle. The routine is already saved across visits,
so a bank that rearranged itself each time would not agree with the routine
under it. A saved order left over from an older list of steps is thrown away.

Add tools/validate-sequence.js. The guarantee rests on the list of working
orders being exact, so it replays all 120 orders through the real robot and
checks the list is still the whole set. The rules a step finishes by live in
a closure with no module to load, so the tool holds a copy and fails loudly
when that copy and the widget have parted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CtC4MMv9XLZrAGLv712dF6

Copy link
Copy Markdown
Member Author

The build check is failing, and the failure is not from this branch.

GET https://api.github.com/repos/CtrlZ-FRC4096/CtrlZ-FRC4096.github.io/contributors?per_page=100:
401 - Bad credentials (Octokit::Unauthorized)

jekyll-github-metadata resolves site.github.contributors for index.md:38, and the JEKYLL_GITHUB_TOKEN secret the workflow passes it is no longer valid. Two things place it outside this PR:

  • This branch changes five files and index.md is not one of them. It touches nothing the metadata plugin reads.
  • Every CI run on main has failed the same way, back through run 47 on 25 August, including run 56 on c148293 — the exact commit this branch is based on.

No fix for it exists to port: the remedy is rotating the JEKYLL_GITHUB_TOKEN repository secret, which needs someone with access to repository settings. Re-running the job would not change the result, because an expired credential fails identically every time, so I have not spent a re-run on it.

Worth noting separately that index.md fails the whole build when that lookup fails. Wrapping the contributor list so a missing or rejected token degrades instead of aborting would keep CI meaningful, but that is its own change and does not belong in this one.

The checks this branch can be judged on were run and pass: node tools/validate-sequence.js, node tools/check-ste.js, the shuffle exercised 200,000 times, and the Playwright sequence assertions.


Generated by Claude Code

@MBimrose
MBimrose merged commit c3e5ea9 into main Sep 14, 2026
1 check failed
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