Skip to content

feat(tutorial): add the counter stage - #105

Merged
Rn86222 merged 5 commits into
mainfrom
feat/counter-stage
Nov 20, 2026
Merged

Rn86222 merged 5 commits into
mainfrom
feat/counter-stage

Conversation

@Rn86222

@Rn86222 Rn86222 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Stage 7 is the first stage over time, on the way to the stopwatch: a counter that shows 0 to F on a display.

  • Stage 7, "Counter":
    • No inputs, and a four-bit output Count that goes up by 1 at each time step and goes back to 0000 after 1111. It is checked over 32 time steps.
    • FlipFlop and Const can be placed, and the four-digit adder is handed over.
    • It starts with a 7seg and a Display at the top right, its input left for the player to connect.
    • The goal says what a time step is: the number between the arrows at the bottom while playing.
    • The steps cover:
      • what a FlipFlop does, and connecting it to Count and the 7seg;
      • writing 0001 in the Const;
      • wiring the adder;
      • going through the time steps, by hand or with Auto.
  • A goal over time: the goal table of a stage over time has a column of time steps first and skips steps with a row of ⋮. Stage 7 shows steps 1, 2, 3, 16 and 17, so the wrap from 1111 to 0000 is in view.
    • A check now holds what its goal shows: the examples of a combinational check, or the steps of a sequential one.
  • The first view: a stage's editor also fits the span between the columns of input and output pins. A stage without inputs no longer puts its outputs in the middle and leaves little room on the left.
  • Smaller changes:
    • FlipFlop and Const get summaries, also shown in the free mode.
    • The legend under the tables now reads "The tables write ON as 1 and OFF as 0." "In the tables, 1 is ON" could be read as covering the 1 in the column of time steps.
    • Stages 6 and 7 share how the 7seg and Display are placed.

Not in this PR

  • A wrong output tells only the inputs at that time step. Stage 8, whose input Up changes between steps, has to settle how the player can replay the steps before it.

Testing

  • npx vitest run (227 tests), npx tsc -p . and npx biome check src pass. New tests cover:
    • stage 7 cleared by its solution, using only the parts it offers
    • the four-digit adder handed over without the 7seg and Display
    • stage 7's goal table, and goal tables over time in general
    • the columns and rows of a table: the time-step column, the dividers and the ⋮ rows
    • steps shown that are not checked, or out of order
  • In the browser:
    • stage 7 can be built by following its steps, counts on the display and clears;
    • a wrong Const gives the time step at which Count goes wrong;
    • stage 7 opens with room on the left, and stage 1 opens as before.

🤖 Generated with Claude Code

Rn86222 and others added 5 commits November 20, 2026 04:08
Stage 7 counts from 0000 to 1111 and back with a FlipFlop, a Const of 0001 and the
four-digit adder handed over. It starts with a 7seg and a Display, and its texts
explain time steps, FlipFlop and Const.

The goal of a stage over time is a table with a column of time steps, which skips
the steps between with a row of dots. A check now holds what its goal shows: the
examples of a combinational check, or the steps of a sequential one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… step with the row

The counter's goal now says what a time step is, before its steps and the table use
the word, and the Const step says to write four digits, as a wire cannot connect pins
of different widths. A row of a table holds its own time step, so the cells cannot
shift under the wrong column, and the order of the columns and rows is worked out
apart from the view and tested.

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

"In the tables, 1 is ON" could be read as covering the 1 in the column of time
steps. The legend now says the tables write ON as 1 and OFF as 0.

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

The view was fitted only to the nodes a stage starts with. The counter starts with
nothing on the left, so its display and output came to the middle and left little
room to build. The view now also takes in the span between the columns of input
and output pins.

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

cloudflare-workers-and-pages Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

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

Latest commit: 64ff8cb
Status: ✅  Deploy successful!
Preview URL: https://cbb2cf79.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://feat-counter-stage.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

@Rn86222
Rn86222 merged commit 9483fb4 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