Skip to content

feat(tutorial): add the stopwatch stage - #107

Merged
Rn86222 merged 6 commits into
mainfrom
feat/stopwatch-stage
Nov 20, 2026
Merged

Rn86222 merged 6 commits into
mainfrom
feat/stopwatch-stage

Conversation

@Rn86222

@Rn86222 Rn86222 commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Summary

Stage 9 is the goal of the tutorial: a stopwatch that counts MM:SS on a display.

  • Stage 9, "Stopwatch":
    • Input Start, outputs M10, M1, S10 and S1 (four bits each). It goes on by one second at each time step while Start is ON, and goes back to 00:00 after 59:59.
    • It hands over "One decimal digit" (stage 8) and "One base-6 digit", built like stage 8 but counting 0 to 5. The player places two of each and chains them, Carry into Up, from S1 to M10.
    • It starts with one Display showing the four numerals and a colon side by side, like a clock. Four 7segs in column-major order and a Const of gaps and the colon, split by a Decompose, are joined by an Aggregate into the Display.
    • Check keeps Start ON until 59:59 has gone back to 00:00 (3601 time steps), then turns it OFF for two steps and ON again. The goal table shows the start, 00:59 to 01:00, 59:59 to 00:00 and the pause, at the same time steps a player sees in play mode after turning Start ON at the first one.
    • The steps tell how to go straight to time step 3600 to see 59:59 turn into 00:00.
  • Parts that are not stages: a stage can hand over a part that no stage of the list builds, such as the base-6 digit. Its title is in the messages, and it is set up, protected and offered like a stage's component.
  • Check over many time steps: the stopwatch check takes about a second. The button says "Checking…" and cannot be pressed again until the result is shown, and a pending check is cancelled when the stage is reset or left.
  • The time step field (also in the free mode): it goes to the step typed only on Enter or when left, as every step up to it is simulated and kept. Before, every key went to a step, so typing 3600 after "15" simulated 153600 steps and could freeze the tab. It selects its text when clicked, reads full-width digits typed with a Japanese input method, and goes no further than step 10000.
  • Layout: stages can set the spacing of their pins, and a test keeps the layout every stage starts with within 1400x850, as the first view shrinks to show all of it. The goal texts of stages 8 and 9 say what Check looks for rather than list time steps.
  • The stage text column is a quarter of the window, from 300 to 420 wide, so that long texts and tables of many columns fit on wider screens. Wide tables scroll sideways on their own.

Testing

  • npx vitest run (271 tests), npx tsc -p . and npx biome check src pass. New tests cover:
    • stage 9 and the base-6 digit cleared by their solutions, using only the parts offered
    • every stage handing over its parts built and working, without their displays
    • stage 9's goal table
    • the size of every stage's starting layout
    • reading the time step field
  • In the browser:
    • stage 9 can be built by following its steps, runs like a clock with Auto, shows 59:59 then 00:00 after entering 3600, and clears
    • the time step field behaves the same in the free mode
    • the goal table fits the text column on a 1440-wide window

🤖 Generated with Claude Code

Rn86222 and others added 6 commits November 20, 2026 19:51
Stage 9 counts MM:SS, one second a time step while Start is ON, from four digits
chained by Carry into Up: "One decimal digit" for M1 and S1, and a base-6 digit
for M10 and S10. The base-6 digit is built like stage 8 but is not a stage of its
own, so a stage can now hand over parts that no stage of the list builds.

It starts with four Displays in a row with a colon, each fed by a 7seg below it,
and is checked over 3604 time steps, through a pause and from 59:59 back to
00:00. Every stage now checks that the parts it hands over work and carry no
display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…esponsive

- The four numerals and the colon go side by side on one Display, from 7segs
  in column-major order joined by an Aggregate with the gaps and colon of one
  Const. The stage is lower, with its outputs closer together, so the first
  view no longer draws it small; a test now keeps every stage within a size.
- Start is OFF only after 59:59 has gone back to 00:00, so the goal and play
  mode agree on time step 3600.
- The step number field goes to a step only on Enter or when left, as every step
  up to it is simulated, and selects its text when clicked.
- Check says it is checking and cannot be pressed again while a long check runs.
- Wide tables scroll on their own, and the parts handed over without a stage are
  tied to their ids by type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… a jump

- The step field reads full-width digits, waits for the input method before
  Enter goes to the step, selects its text after the click, and goes no further
  than step 10000, as every step up to it is simulated and kept.
- A check still waiting when the stage is reset or left is cancelled.
- The Japanese first step of the stopwatch says, as the English does, that a
  base-6 digit carries after 5 as decimal does after 9.
- The stopwatch's 7seg positions and display columns are each defined once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…wide screens

- The goals of stages 8 and 9 say what Check sees while it switches Up or Start,
  instead of listing time step numbers.
- The stopwatch step on Count names which output each part goes to, and its goal
  also shows the steps around 01:00.
- The column of stage texts grows with the screen, from 300 up to 400 wide, so
  that long texts and tables of many columns fit where there is room.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
At 1440 wide, 22% left the column barely wider than before, short of the
stopwatch's goal table.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3ea608c
Status: ✅  Deploy successful!
Preview URL: https://3438ad9b.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://feat-stopwatch-stage.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

@Rn86222
Rn86222 merged commit 0617472 into main Nov 20, 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