Skip to content

feat: describe the basic parts, and write a bit as ON or OFF everywhere - #98

Merged
Rn86222 merged 5 commits into
mainfrom
feat/part-descriptions
Nov 19, 2026
Merged

Rn86222 merged 5 commits into
mainfrom
feat/part-descriptions

Conversation

@Rn86222

@Rn86222 Rn86222 commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

A visitor who knows nothing about logic cannot tell what And or Xor does from its name. This PR adds short descriptions of the basic parts and shows them where the parts are chosen.

  • Descriptions: And, Or, Not, Xor, True and False each get a one-line summary in English and Japanese (e.g. "ON only when both inputs are ON").
  • Truth tables: these are built by running each part's own definition with every combination of one-bit inputs, so a table always matches how the part behaves. Parts a small table cannot show (those with settings or a state, such as Const, AndN or FlipFlop) get none.
  • Where they appear:
    • On a stage, "Parts you can use in this stage" lists the stage's parts with their descriptions, below Check and its result so Check stays in view.
    • In the side panel, an info button on each described part opens the same description in a popover. It appears in both the tutorial and the free mode.
  • ON and OFF everywhere: play-mode nodes already wrote a one-bit value as ON or OFF. The truth tables, the check's messages, the wire value labels, the part summaries and the stage goals now do too, through one function. Wider values keep their binary or hexadecimal form.
  • Wording: Or is described as "ON when at least one input is ON" so it is not read as Xor.

Not in this PR

The other parts (Input, Output, Const, Aggregate, Decompose, Broadcast, AndN, OrN, FlipFlop, Display, 7seg) have no description yet. Most of them need an idea taught first, such as bit width or time steps, so each will be described together with the stage that introduces it. Parts a table cannot show will need examples instead, which will be added then.

Testing

  • npx vitest run (178 tests), npx tsc -p . and npx biome check src pass. New tests cover:
    • the truth tables of the gates, the parts that get none, and that any part can be asked for one
    • labels for one bit (ON/OFF), a few bits (binary) and wide wire values (hexadecimal)
  • Checked in the browser, in Japanese and English:
    • the stage panel's parts with their tables, and the goals and check messages with ON/OFF
    • ON/OFF on play-mode nodes and wires
    • the info popover, which opens and closes and still lets the part be dragged
    • info buttons only on the described parts in the free mode

🤖 Generated with Claude Code

Rn86222 and others added 5 commits November 19, 2026 22:26
…the side panel

A visitor who knows no logic cannot tell what And or Xor does from the name. Each
gate now has a one-line summary in English and Japanese, and a truth table computed
by running its definition, so it always matches how the part behaves. A stage lists
its parts this way below Check, and the side panel opens the same description from an
info button on each part that has one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The truth tables and the check's messages said オン and オフ in Japanese while the
nodes in play mode said ON and OFF. One function now labels a bit for all of them.

From the review: OR is described as on when at least one input is on, so it is not
read as XOR; a stage lists the parts it lets the player use; a part with no inputs
gets no divider; the info button and its popover are announced as a dialog; and
tests cover parts that get no table and asking any part for one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
They sat right above tables and next to nodes that say ON and OFF, so the same value
read two ways.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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: e8355ae
Status: ✅  Deploy successful!
Preview URL: https://727c60be.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev
Branch Preview URL: https://feat-part-descriptions.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev

View logs

@Rn86222
Rn86222 merged commit 3bd3579 into main Nov 19, 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