From 752e05e19e36f8691cbc34b519bb34a94bed16b7 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:50:39 +0900 Subject: [PATCH 1/6] feat(tutorial): give stages 2 to 5 a hint in their steps, and keep the goals free of hints The steps are now the hints. Stages 2 to 5 had none, so a player stuck there had nothing to turn to; each now has one that tells how to build the circuit. Stage 5's goal told how to join the two adders, which moves to its step along with the Or it left out. Stage 6's last step, on playing and hexadecimal, is not a hint and stage 7 relies on it, so it moves to the goal. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 16 ++++++++++------ src/i18n/ja.ts | 18 ++++++++++++------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 8d7d181..e6b7bb9 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -37,14 +37,16 @@ const stageTexts: Record = { goal: [ "Make the lamp {Out} turn [ON] only when switch {A} is [ON] and {B} is [OFF]. This time, one component alone is not enough.", ], - steps: [], + steps: ["Turn {B} over with a {Not}, then connect it and {A} to an {And}."], }, xor: { title: "ON when just one is ON", goal: [ 'Make the lamp {Out} turn [ON] when exactly one of the switches {A} and {B} is [ON]. It stays [OFF] when both are [ON]. "{ON when only A is ON}" is ready to use as a component.', ], - steps: [], + steps: [ + 'Place two "{ON when only A is ON}", and connect {A} and {B} to one of them the other way round. Join their two {Out}s with an {Or} and connect it to {Out}.', + ], }, "half-adder": { title: "Adding one digit", @@ -52,25 +54,27 @@ const stageTexts: Record = { "From here on, think of [ON] as [1] and [OFF] as [0], and the tables of the stages' circuits write them that way too. Then {A} + {B} is 0, 1 or 2. Binary writes numbers with only 0 and 1: just as 9 + 1 carries over and becomes 10 in everyday numbers, 1 + 1 carries over and becomes 10 in binary. So 0, 1 and 2 are [00], [01] and [10] in two digits. A digit of a binary number is called a bit.", "Output the left digit (the twos digit) to {C} and the right digit (the ones digit) to {S}. {C} is called the carry and {S} the sum, and this circuit is called a half adder.", ], - steps: [], + steps: ["{C} can be made with an {And}, and {S} with an {Xor}."], }, "full-adder": { title: "Adding with a carry", goal: [ - 'Output {A} + {B} + {Cin} as a two-digit binary number to {C} and {S}. {Cin} is the carry coming up from the next lower digit. The answer is 0 to 3, and 3 is [11] in binary. "{Adding one digit}" is ready to use as a component: add {A} and {B} with one, then add {Cin} to its {S} with another. This circuit is called a full adder.', + 'Output {A} + {B} + {Cin} as a two-digit binary number to {C} and {S}. {Cin} is the carry coming up from the next lower digit. The answer is 0 to 3, and 3 is [11] in binary. "{Adding one digit}" is ready to use as a component. This circuit is called a full adder.', + ], + steps: [ + 'Add {A} and {B} with one "{Adding one digit}", then add {Cin} to its {S} with another. Join the two {C}s with an {Or} and output it to {C}.', ], - steps: [], }, "four-bit-adder": { title: "Adding four digits", goal: [ "{A} and {B} are four-digit binary numbers. Output {A} + {B} in four digits to {S}, and its fifth digit, the sixteens digit, to {C}: {C} is [1] when {A} + {B} is 16 or more. The table shows some examples.", + "While playing, click a digit of {A} or {B} to switch it between [0] and [1]. The sum {S} is shown as one character on the {Display} at the top right. The {7seg} before it turns the binary number into the shape of a numeral. To write 10 to 15 with one character, A (10), b (11), C (12), d (13), E (14) and F (15) are used. This way of writing is called hexadecimal.", ], steps: [ 'Place four "{Adding with a carry}". From the top, the pins on the right of {Decompose} and on the left of {Aggregate} are the eights, fours, twos and ones digits.', "For each digit, connect that digit's pin on the upper {Decompose}, which {A} goes into, and on the lower one, which {B} goes into, to the {A} and {B} of one \"{Adding with a carry}\". Connect the {S} of that adder to the same digit's pin of {Aggregate}.", "Connect the {C} of each digit's adder to the {Cin} of the adder one digit up. The ones digit's adder gets {False} on its {Cin}, and the {C} of the eights digit's adder goes to the output {C} on the right.", - "While playing, click a digit of {A} or {B} to switch it between [0] and [1]. The sum {S} is shown as one character on the {Display} at the top right. The {7seg} before it turns the binary number into the shape of a numeral. To write 10 to 15 with one character, A (10), b (11), C (12), d (13), E (14) and F (15) are used. This way of writing is called hexadecimal.", ], }, counter: { diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 1babba6..a15180b 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -181,14 +181,18 @@ export const ja: Messages = { goal: [ "スイッチ {A} が [ON] で、{B} が [OFF] のときだけ、ランプ {Out} が [ON] になるようにしましょう。今度は、コンポーネントを1つ置くだけではできません。", ], - steps: [], + steps: [ + "{B} を {Not} で反対にしてから、{A} と一緒に {And} につなぎます。", + ], }, xor: { title: "片方だけ ON で ON", goal: [ "スイッチ {A} と {B} のどちらか片方だけが [ON] のときに、ランプ {Out} が [ON] になるようにしましょう。両方 [ON] のときは [OFF] です。「{A だけ ON で ON}」をコンポーネントとして使えます。", ], - steps: [], + steps: [ + "「{A だけ ON で ON}」を2つ置き、片方には {A} と {B} を入れ替えてつなぎます。2つの {Out} を {Or} でまとめて、{Out} につなぎます。", + ], }, "half-adder": { title: "1桁の足し算", @@ -196,25 +200,27 @@ export const ja: Messages = { "ここからは [ON] を [1]、[OFF] を [0] と考え、課題の回路の表もそう書きます。すると、{A}+{B} は 0、1、2 のどれかです。2進数では、0 と 1 だけで数を書きます。ふだんの数で 9+1 が繰り上がって 10 になるように、2進数では 1+1 が繰り上がって 10 になります。そのため、0、1、2 は2桁で [00]、[01]、[10] です。2進数の1桁を「ビット」といいます。", "左の桁(2の位)を {C} に、右の桁(1の位)を {S} に出しましょう。{C} を「桁上がり」、{S} を「和」といい、この回路を「半加算器」といいます。", ], - steps: [], + steps: ["{C} は {And} で、{S} は {Xor} で作れます。"], }, "full-adder": { title: "桁上がりつきの足し算", goal: [ - "{A}+{B}+{Cin} の答えを、2桁の2進数で {C} と {S} に出しましょう。{Cin} は、下の桁から来る桁上がりです。答えは 0 から 3 で、3 は2進数で [11] です。「{1桁の足し算}」をコンポーネントとして使えます。1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足します。この回路を「全加算器」といいます。", + "{A}+{B}+{Cin} の答えを、2桁の2進数で {C} と {S} に出しましょう。{Cin} は、下の桁から来る桁上がりです。答えは 0 から 3 で、3 は2進数で [11] です。「{1桁の足し算}」をコンポーネントとして使えます。この回路を「全加算器」といいます。", + ], + steps: [ + "「{1桁の足し算}」の1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足します。2つの {C} は {Or} でまとめて、{C} に出します。", ], - steps: [], }, "four-bit-adder": { title: "4桁の足し算", goal: [ "{A} と {B} は4桁の2進数です。{A}+{B} を4桁で {S} に、5桁目(16の位)を {C} に出しましょう。{A}+{B} が 16 以上なら、{C} は [1] です。表はその例です。", + "再生中は、{A} と {B} の桁をクリックして [0] と [1] を切り替えられます。答えの {S} は、右上の {Display} に1文字で表示されます。その手前の {7seg} が、2進数を数字の形に変えています。10 から 15 は1文字で書くために、A(10)、b(11)、C(12)、d(13)、E(14)、F(15)を使います。この書き方を16進数といいます。", ], steps: [ "「{桁上がりつきの足し算}」を4つ置きます。{Decompose} の右側のピンと {Aggregate} の左側のピンは、どちらも上から8の位・4の位・2の位・1の位です。", "桁ごとに、{A} につないだ上の {Decompose} と、{B} につないだ下の {Decompose} から、その桁のピンを1つの「{桁上がりつきの足し算}」の {A} と {B} につなぎます。その足し算の {S} は、{Aggregate} の同じ桁のピンにつなぎます。", "それぞれの桁の足し算の {C} を、1つ上の桁の足し算の {Cin} につなぎます。1の位の足し算の {Cin} には {False} を、8の位の足し算の {C} は右の出力 {C} につなぎます。", - "再生中は、{A} と {B} の桁をクリックして [0] と [1] を切り替えられます。答えの {S} は、右上の {Display} に1文字で表示されます。その手前の {7seg} が、2進数を数字の形に変えています。10 から 15 は1文字で書くために、A(10)、b(11)、C(12)、d(13)、E(14)、F(15)を使います。この書き方を16進数といいます。", ], }, counter: { From 3bc2a0c0f607789a87da31d064e9a3db2398996a Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:50:39 +0900 Subject: [PATCH 2/6] feat(tutorial): open and close the steps by clicking their heading The steps are closed at first, so that a player sees the hints only when asking for them. The first stage's steps stay open, as they teach how to use the editor rather than how to build the circuit. Co-Authored-By: Claude Opus 5.5 --- src/pages/tutorial/stage.tsx | 62 +++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 11 deletions(-) diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index 8b7ad9e..6a9af4c 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -1,8 +1,10 @@ -import { ArrowBack } from "@mui/icons-material"; +import { ArrowBack, ExpandMore } from "@mui/icons-material"; import { Alert, Box, Button, + ButtonBase, + Collapse, Divider, Link, Stack, @@ -13,6 +15,7 @@ import { type ReactNode, useCallback, useEffect, + useId, useMemo, useRef, useState, @@ -81,6 +84,48 @@ function SectionHeading({ children }: { children: ReactNode }) { ); } +/** The steps are hints, kept closed until the player asks for them */ +function StepsSection({ + steps, + isOpenAtFirst, +}: { + steps: readonly string[]; + isOpenAtFirst: boolean; +}) { + const texts = useMessages().tutorial; + const [isOpen, setIsOpen] = useState(isOpenAtFirst); + const stepsId = useId(); + return ( +
+ + setIsOpen((open) => !open)} + sx={{ font: "inherit", gap: 0.5, borderRadius: 1 }} + > + + {texts.stepsHeading} + + + + + {steps.map((step) => ( + + + + ))} + + +
+ ); +} + function CheckFailure({ result, onReset, @@ -273,16 +318,11 @@ function StageView({ stage }: { stage: TutorialStage }) { )} {stageTexts.steps.length > 0 && ( -
- {texts.stepsHeading} - - {stageTexts.steps.map((step) => ( - - - - ))} - -
+ )}
{messages.parts.ofStage} From c34a56b646952dbd051245d0394b99134fdd0566 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:53:48 +0900 Subject: [PATCH 3/6] fix(tutorial): complete the hints of stages 3 and 5, and keep stage 6's table note next to the table Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 8 ++++---- src/i18n/ja.ts | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index e6b7bb9..2f0af8c 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -45,7 +45,7 @@ const stageTexts: Record = { 'Make the lamp {Out} turn [ON] when exactly one of the switches {A} and {B} is [ON]. It stays [OFF] when both are [ON]. "{ON when only A is ON}" is ready to use as a component.', ], steps: [ - 'Place two "{ON when only A is ON}", and connect {A} and {B} to one of them the other way round. Join their two {Out}s with an {Or} and connect it to {Out}.', + 'Place two "{ON when only A is ON}", and connect {A} and {B} to one as they are, and to the other the other way round. Join their two {Out}s with an {Or} and connect it to the lamp {Out}.', ], }, "half-adder": { @@ -62,14 +62,14 @@ const stageTexts: Record = { 'Output {A} + {B} + {Cin} as a two-digit binary number to {C} and {S}. {Cin} is the carry coming up from the next lower digit. The answer is 0 to 3, and 3 is [11] in binary. "{Adding one digit}" is ready to use as a component. This circuit is called a full adder.', ], steps: [ - 'Add {A} and {B} with one "{Adding one digit}", then add {Cin} to its {S} with another. Join the two {C}s with an {Or} and output it to {C}.', + 'Add {A} and {B} with one "{Adding one digit}", then add {Cin} to its {S} with another and output that {S} to {S}. Join the two {C}s with an {Or} and output it to {C}.', ], }, "four-bit-adder": { title: "Adding four digits", goal: [ - "{A} and {B} are four-digit binary numbers. Output {A} + {B} in four digits to {S}, and its fifth digit, the sixteens digit, to {C}: {C} is [1] when {A} + {B} is 16 or more. The table shows some examples.", - "While playing, click a digit of {A} or {B} to switch it between [0] and [1]. The sum {S} is shown as one character on the {Display} at the top right. The {7seg} before it turns the binary number into the shape of a numeral. To write 10 to 15 with one character, A (10), b (11), C (12), d (13), E (14) and F (15) are used. This way of writing is called hexadecimal.", + "{A} and {B} are four-digit binary numbers. Output {A} + {B} in four digits to {S}, and its fifth digit, the sixteens digit, to {C}: {C} is [1] when {A} + {B} is 16 or more.", + "While playing, click a digit of {A} or {B} to switch it between [0] and [1]. The sum {S} is shown as one character on the {Display} at the top right. The {7seg} before it turns the binary number into the shape of a numeral. To write 10 to 15 with one character, A (10), b (11), C (12), d (13), E (14) and F (15) are used. This way of writing is called hexadecimal. The table below shows some examples of {A} + {B}.", ], steps: [ 'Place four "{Adding with a carry}". From the top, the pins on the right of {Decompose} and on the left of {Aggregate} are the eights, fours, twos and ones digits.', diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index a15180b..7fa8142 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -191,7 +191,7 @@ export const ja: Messages = { "スイッチ {A} と {B} のどちらか片方だけが [ON] のときに、ランプ {Out} が [ON] になるようにしましょう。両方 [ON] のときは [OFF] です。「{A だけ ON で ON}」をコンポーネントとして使えます。", ], steps: [ - "「{A だけ ON で ON}」を2つ置き、片方には {A} と {B} を入れ替えてつなぎます。2つの {Out} を {Or} でまとめて、{Out} につなぎます。", + "「{A だけ ON で ON}」を2つ置き、{A} と {B} を、1つにはそのまま、もう1つには入れ替えてつなぎます。2つの {Out} を {Or} でまとめて、ランプ {Out} につなぎます。", ], }, "half-adder": { @@ -208,14 +208,14 @@ export const ja: Messages = { "{A}+{B}+{Cin} の答えを、2桁の2進数で {C} と {S} に出しましょう。{Cin} は、下の桁から来る桁上がりです。答えは 0 から 3 で、3 は2進数で [11] です。「{1桁の足し算}」をコンポーネントとして使えます。この回路を「全加算器」といいます。", ], steps: [ - "「{1桁の足し算}」の1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足します。2つの {C} は {Or} でまとめて、{C} に出します。", + "「{1桁の足し算}」の1つで {A} と {B} を足し、もう1つでその {S} と {Cin} を足して、その {S} を {S} に出します。2つの {C} は {Or} でまとめて、{C} に出します。", ], }, "four-bit-adder": { title: "4桁の足し算", goal: [ - "{A} と {B} は4桁の2進数です。{A}+{B} を4桁で {S} に、5桁目(16の位)を {C} に出しましょう。{A}+{B} が 16 以上なら、{C} は [1] です。表はその例です。", - "再生中は、{A} と {B} の桁をクリックして [0] と [1] を切り替えられます。答えの {S} は、右上の {Display} に1文字で表示されます。その手前の {7seg} が、2進数を数字の形に変えています。10 から 15 は1文字で書くために、A(10)、b(11)、C(12)、d(13)、E(14)、F(15)を使います。この書き方を16進数といいます。", + "{A} と {B} は4桁の2進数です。{A}+{B} を4桁で {S} に、5桁目(16の位)を {C} に出しましょう。{A}+{B} が 16 以上なら、{C} は [1] です。", + "再生中は、{A} と {B} の桁をクリックして [0] と [1] を切り替えられます。答えの {S} は、右上の {Display} に1文字で表示されます。その手前の {7seg} が、2進数を数字の形に変えています。10 から 15 は1文字で書くために、A(10)、b(11)、C(12)、d(13)、E(14)、F(15)を使います。この書き方を16進数といいます。下の表は、{A}+{B} の例です。", ], steps: [ "「{桁上がりつきの足し算}」を4つ置きます。{Decompose} の右側のピンと {Aggregate} の左側のピンは、どちらも上から8の位・4の位・2の位・1の位です。", From a130c31a8e6d3c9acbc3ecd2ea767a7bdd480d0e Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 03:53:48 +0900 Subject: [PATCH 4/6] fix(tutorial): show the steps' toggle on hover and keyboard focus Co-Authored-By: Claude Opus 5.5 --- src/pages/tutorial/stage.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index 6a9af4c..50aa9c7 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -102,7 +102,14 @@ function StepsSection({ aria-expanded={isOpen} aria-controls={stepsId} onClick={() => setIsOpen((open) => !open)} - sx={{ font: "inherit", gap: 0.5, borderRadius: 1 }} + focusRipple + sx={{ + font: "inherit", + gap: 0.5, + pr: 1, + borderRadius: 1, + "&:hover": { bgcolor: "action.hover" }, + }} > Date: Sat, 21 Nov 2026 03:54:28 +0900 Subject: [PATCH 5/6] feat(tutorial): say under the closed steps that they tell how to build the circuit "Steps" alone did not tell a stuck player that the closed section holds the way to build the circuit. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 2 ++ src/i18n/ja.ts | 2 ++ src/pages/tutorial/stage.tsx | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 2f0af8c..ebcc296 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -257,6 +257,8 @@ export const en = { stages: "Stages", goalHeading: "Goal", stepsHeading: "Steps", + stepsClosed: + "Open this when you are stuck. It tells how to build the circuit.", digitsLegend: "The tables of the stages' circuits write ON as 1 and OFF as 0.", check: "Check", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 7fa8142..d08391f 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -135,6 +135,8 @@ export const ja: Messages = { stages: "課題の一覧", goalHeading: "目標", stepsHeading: "手順", + stepsClosed: + "考えてもわからないときに開いてください。作り方が書いてあります。", digitsLegend: "課題の回路の表では、ON を 1、OFF を 0 と書いています。", check: "確かめる", checking: "確かめています…", diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index 50aa9c7..9690786 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -95,13 +95,16 @@ function StepsSection({ const texts = useMessages().tutorial; const [isOpen, setIsOpen] = useState(isOpenAtFirst); const stepsId = useId(); + const noteId = useId(); + const toggle = () => setIsOpen((open) => !open); return (
setIsOpen((open) => !open)} + aria-describedby={isOpen ? undefined : noteId} + onClick={toggle} focusRipple sx={{ font: "inherit", @@ -120,6 +123,19 @@ function StepsSection({ {texts.stepsHeading} + {!isOpen && ( + // Also opens the steps, as the note is where the eye goes; the button + // above reads it out + + {texts.stepsClosed} + + )} {steps.map((step) => ( From ea9c22cfecc4670f26a09218bbae09ee2f90cfd5 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Sat, 21 Nov 2026 04:01:00 +0900 Subject: [PATCH 6/6] fix(tutorial): keep the first stage's steps always shown, as they are no hints Closing them offered the note for a stuck player, which does not fit steps that teach how to use the editor. Co-Authored-By: Claude Opus 5.5 --- src/pages/tutorial/stage.tsx | 50 +++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index 9690786..fb9711c 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -84,16 +84,22 @@ function SectionHeading({ children }: { children: ReactNode }) { ); } -/** The steps are hints, kept closed until the player asks for them */ -function StepsSection({ - steps, - isOpenAtFirst, -}: { - steps: readonly string[]; - isOpenAtFirst: boolean; -}) { +function StepList({ steps }: { steps: readonly string[] }) { + return ( + + {steps.map((step) => ( + + + + ))} + + ); +} + +/** Steps that are hints, kept closed until the player asks for them */ +function HintSteps({ steps }: { steps: readonly string[] }) { const texts = useMessages().tutorial; - const [isOpen, setIsOpen] = useState(isOpenAtFirst); + const [isOpen, setIsOpen] = useState(false); const stepsId = useId(); const noteId = useId(); const toggle = () => setIsOpen((open) => !open); @@ -137,13 +143,7 @@ function StepsSection({ )} - - {steps.map((step) => ( - - - - ))} - +
); @@ -340,13 +340,17 @@ function StageView({ stage }: { stage: TutorialStage }) { )}
- {stageTexts.steps.length > 0 && ( - - )} + {stageTexts.steps.length > 0 && + // The first stage's steps teach the editor, not the circuit, so + // they are no hints to hide + (stageIndex === 0 ? ( +
+ {texts.stepsHeading} + +
+ ) : ( + + ))}
{messages.parts.ofStage}