From 68f90bdc70d3811eecffd1316cb6d1845fd3a8a0 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:19:43 +0900 Subject: [PATCH 1/6] feat(tutorial): split stage 1's text into its goal and numbered steps A stage's texts now have a list of steps, shown under "Steps" between the goal and Check. Stage 1's goal says the table is what clears it, and its steps say that the play button waits for every pin to be connected. The left column now scrolls above a footer holding Check and its result, so that Check stays in view however long the text is. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 12 ++- src/i18n/ja.ts | 12 ++- src/pages/tutorial/stage.tsx | 193 ++++++++++++++++++++--------------- 3 files changed, 130 insertions(+), 87 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 1dad934..ae8edda 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -107,6 +107,7 @@ export const en = { stages: "Stages", parts: "Parts", goalHeading: "Goal", + stepsHeading: "Steps", check: "Check", passed: "Cleared! The circuit works for every combination of the inputs.", next: "Next stage", @@ -132,15 +133,24 @@ export const en = { stageTexts: { and: { title: "Both switches", - goal: "Make the lamp Out light up only when both switches A and B are ON. Drag parts from the Parts list onto the editor, and drag from pin to pin to connect them. The play button at the bottom right lets you try the switches. When it works, press Check.", + goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", + steps: [ + "Pick a part in the Parts list and drag it onto the editor on the right.", + "Drag from pin to pin to connect them with a wire.", + "Once every pin of A, B and Out is connected, the play button at the bottom right can be pressed.", + "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", + "When it works as in the table, press Check.", + ], }, "a-only": { title: "Only switch A", goal: "Make the lamp Out light up only when switch A is ON and B is OFF. This time, one part alone is not enough.", + steps: [], }, xor: { title: "Only one switch", goal: 'Make the lamp Out light up when exactly one of the switches A and B is ON. It does not light up when both are ON. "Only switch A" is ready to use as a part.', + steps: [], }, }, }, diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index aa26f47..371792a 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -102,6 +102,7 @@ export const ja: Messages = { stages: "課題の一覧", parts: "部品", goalHeading: "目標", + stepsHeading: "手順", check: "確かめる", passed: "クリア!どの入力の組み合わせでも正しく動きます。", next: "次の課題へ", @@ -122,15 +123,24 @@ export const ja: Messages = { stageTexts: { and: { title: "両方のスイッチ", - goal: "スイッチ A と B が両方 ON のときだけ、ランプ Out がつくようにしましょう。「部品」の一覧から部品をエディタにドラッグして置き、ピンからピンへドラッグしてつなぎます。右下の再生ボタンで、スイッチを切り替えて試せます。できたら「確かめる」を押してください。", + goal: "スイッチ A と B が両方 ON のときだけ、ランプ Out がつくようにしましょう。下の表のとおりに動けばクリアです。", + steps: [ + "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", + "ピンからピンへドラッグして、線でつなぎます。", + "A・B・Out のピンをすべてつなぐと、右下の再生ボタンが押せるようになります。", + "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", + "表のとおりに動いたら、「確かめる」を押します。", + ], }, "a-only": { title: "A だけのスイッチ", goal: "スイッチ A が ON で、B が OFF のときだけ、ランプ Out がつくようにしましょう。今度は、部品を1つ置くだけではできません。", + steps: [], }, xor: { title: "片方だけのスイッチ", goal: "スイッチ A と B のどちらか片方だけが ON のときに、ランプ Out がつくようにしましょう。両方 ON のときはつきません。「A だけのスイッチ」を部品として使えます。", + steps: [], }, }, }, diff --git a/src/pages/tutorial/stage.tsx b/src/pages/tutorial/stage.tsx index 4909b1e..a500e9b 100644 --- a/src/pages/tutorial/stage.tsx +++ b/src/pages/tutorial/stage.tsx @@ -103,6 +103,7 @@ function StageView({ stage }: { stage: TutorialStage }) { const nextStage = tutorialStages[stageIndex + 1]; const titleOf: StageTitleOf = (id) => texts.stageTexts[id].title; const goalTable = truthTableOfCheck(stage.check); + const stageTexts = texts.stageTexts[stage.id]; const [store, setStore] = useState(() => getTutorialStageStore(stage, titleOf), @@ -160,92 +161,114 @@ function StageView({ stage }: { stage: TutorialStage }) { minHeight: 0, }} > - - - - {texts.stages} - -
- - {texts.stageNumber(stageIndex + 1)} - - - {texts.stageTexts[stage.id].title} - -
-
- {texts.goalHeading} - {texts.stageTexts[stage.id].goal} - {goalTable && ( - - - - )} -
- - {result?.type === "passed" && ( - <> - {texts.passed} - - - )} - {result && result.type !== "passed" && ( - - {describeFailure(result, store, messages)} - - )} -
- {messages.parts.ofStage} - - {stage.parts.map((partId) => ( - - ))} - {stage.givenParts.map((id) => ( - - ))} - -
- - {hasResetFailed && ( - {texts.resetStageFailed} - )} - -
+ {stageTexts.title} + + +
+ {texts.goalHeading} + {stageTexts.goal} + {goalTable && ( + + + + )} +
+ {stageTexts.steps.length > 0 && ( +
+ {texts.stepsHeading} + + {stageTexts.steps.map((step) => ( + + {step} + + ))} + +
+ )} +
+ {messages.parts.ofStage} + + {stage.parts.map((partId) => ( + + ))} + {stage.givenParts.map((id) => ( + + ))} + +
+ + {hasResetFailed && ( + {texts.resetStageFailed} + )} + + + + {/* Outside the scrolling, so that Check and its result stay in view */} + + + {result?.type === "passed" && ( + <> + {texts.passed} + + + )} + {result && result.type !== "passed" && ( + + {describeFailure(result, store, messages)} + + )} + + From 74e0d1763ec957d1a5dd426916e34fca9c175d5e Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:22:26 +0900 Subject: [PATCH 2/6] fix(tutorial): say what really keeps the play button disabled The button waits for Out and every input pin of the placed parts, not for the pins of A and B, so a spare part left unconnected keeps it disabled. The stage texts get a declared type, so that a stage without steps is not typed as never[]. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 51 +++++++++++++++++++++++++++----------------------- src/i18n/ja.ts | 2 +- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index ae8edda..b0fcc87 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -1,4 +1,5 @@ import { englishSimulationErrorTexts } from "../store/simulationErrorTexts"; +import type { TutorialStageId } from "../tutorial/stages"; const bitWidths = (widths: readonly number[]) => `${widths.join("/")} bit`; const listOf = (names: readonly string[]) => @@ -8,6 +9,32 @@ const listOf = (names: readonly string[]) => const themOf = (names: readonly string[]) => names.length === 1 ? "it" : "them"; +type StageTexts = { title: string; goal: string; steps: readonly string[] }; + +const stageTexts: Record = { + and: { + title: "Both switches", + goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", + steps: [ + "Pick a part in the Parts list and drag it onto the editor on the right.", + "Drag from pin to pin to connect them with a wire.", + "Once Out and every input pin of the parts you placed are connected, the play button at the bottom right can be pressed. A part left with an unconnected input keeps it disabled.", + "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", + "When it works as in the table, press Check.", + ], + }, + "a-only": { + title: "Only switch A", + goal: "Make the lamp Out light up only when switch A is ON and B is OFF. This time, one part alone is not enough.", + steps: [], + }, + xor: { + title: "Only one switch", + goal: 'Make the lamp Out light up when exactly one of the switches A and B is ON. It does not light up when both are ON. "Only switch A" is ready to use as a part.', + steps: [], + }, +}; + export const en = { languageName: "English", common: { @@ -130,29 +157,7 @@ export const en = { confirm: "Reset", }, resetStageFailed: "Could not reset the stage.", - stageTexts: { - and: { - title: "Both switches", - goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", - steps: [ - "Pick a part in the Parts list and drag it onto the editor on the right.", - "Drag from pin to pin to connect them with a wire.", - "Once every pin of A, B and Out is connected, the play button at the bottom right can be pressed.", - "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", - "When it works as in the table, press Check.", - ], - }, - "a-only": { - title: "Only switch A", - goal: "Make the lamp Out light up only when switch A is ON and B is OFF. This time, one part alone is not enough.", - steps: [], - }, - xor: { - title: "Only one switch", - goal: 'Make the lamp Out light up when exactly one of the switches A and B is ON. It does not light up when both are ON. "Only switch A" is ready to use as a part.', - steps: [], - }, - }, + stageTexts, }, componentProperties: { title: (componentName: string) => `${componentName} Properties`, diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 371792a..4e3011b 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -127,7 +127,7 @@ export const ja: Messages = { steps: [ "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", "ピンからピンへドラッグして、線でつなぎます。", - "A・B・Out のピンをすべてつなぐと、右下の再生ボタンが押せるようになります。", + "Out と、置いた部品の入力ピンがすべてつながると、右下の再生ボタンが押せるようになります。入力ピンが空いている部品が残っていると押せません。", "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、「確かめる」を押します。", ], From 9e1a81c74d970729dcfe019770ef75402b9079df Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:26:25 +0900 Subject: [PATCH 3/6] fix(tutorial): tell what a pin is before the steps rely on it The steps now point at the small circles on a part's edges, and name the input pins by where they are, on the left side. Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 4 ++-- src/i18n/ja.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index b0fcc87..fb29352 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -17,8 +17,8 @@ const stageTexts: Record = { goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", steps: [ "Pick a part in the Parts list and drag it onto the editor on the right.", - "Drag from pin to pin to connect them with a wire.", - "Once Out and every input pin of the parts you placed are connected, the play button at the bottom right can be pressed. A part left with an unconnected input keeps it disabled.", + "The small circles on the edges of a part are its pins. Drag from one pin to another to connect them with a wire.", + "Once Out and every pin on the left side of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free pin on its left side.", "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", "When it works as in the table, press Check.", ], diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 4e3011b..7f6437d 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -126,8 +126,8 @@ export const ja: Messages = { goal: "スイッチ A と B が両方 ON のときだけ、ランプ Out がつくようにしましょう。下の表のとおりに動けばクリアです。", steps: [ "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", - "ピンからピンへドラッグして、線でつなぎます。", - "Out と、置いた部品の入力ピンがすべてつながると、右下の再生ボタンが押せるようになります。入力ピンが空いている部品が残っていると押せません。", + "部品の端にある小さな丸を「ピン」といいます。ピンからピンへドラッグして、線でつなぎます。", + "Out と、置いた部品の左側のピンがすべてつながると、右下の再生ボタンが押せるようになります。左側のピンが空いている部品が残っていると押せません。", "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、「確かめる」を押します。", ], From b2030ad083f460f7c6cc64d6640d27dd0f5dda58 Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:27:17 +0900 Subject: [PATCH 4/6] fix(tutorial): describe pins as the small squares they are drawn as Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 2 +- src/i18n/ja.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index fb29352..44d63ad 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -17,7 +17,7 @@ const stageTexts: Record = { goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", steps: [ "Pick a part in the Parts list and drag it onto the editor on the right.", - "The small circles on the edges of a part are its pins. Drag from one pin to another to connect them with a wire.", + "The small squares on the edges of a part are its pins. Drag from one pin to another to connect them with a wire.", "Once Out and every pin on the left side of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free pin on its left side.", "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", "When it works as in the table, press Check.", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 7f6437d..afc6949 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -126,7 +126,7 @@ export const ja: Messages = { goal: "スイッチ A と B が両方 ON のときだけ、ランプ Out がつくようにしましょう。下の表のとおりに動けばクリアです。", steps: [ "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", - "部品の端にある小さな丸を「ピン」といいます。ピンからピンへドラッグして、線でつなぎます。", + "部品の端にある小さな四角を「ピン」といいます。ピンからピンへドラッグして、線でつなぎます。", "Out と、置いた部品の左側のピンがすべてつながると、右下の再生ボタンが押せるようになります。左側のピンが空いている部品が残っていると押せません。", "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、「確かめる」を押します。", From e2cdd84a1e16551fc1c2cc5e4183d79c56fce4ea Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:28:10 +0900 Subject: [PATCH 5/6] fix(tutorial): tell that left pins are inputs and right pins are outputs Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 2 +- src/i18n/ja.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 44d63ad..cfc6d60 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -17,7 +17,7 @@ const stageTexts: Record = { goal: "Make the lamp Out light up only when both switches A and B are ON. The stage is cleared when the circuit works as in the table below.", steps: [ "Pick a part in the Parts list and drag it onto the editor on the right.", - "The small squares on the edges of a part are its pins. Drag from one pin to another to connect them with a wire.", + "The small squares on the edges of a part are its pins. A pin on the left side is an input, which receives ON or OFF, and a pin on the right side is an output, which sends ON or OFF. Drag between an output pin and an input pin to connect them with a wire.", "Once Out and every pin on the left side of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free pin on its left side.", "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", "When it works as in the table, press Check.", diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index afc6949..7e35931 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -126,7 +126,7 @@ export const ja: Messages = { goal: "スイッチ A と B が両方 ON のときだけ、ランプ Out がつくようにしましょう。下の表のとおりに動けばクリアです。", steps: [ "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", - "部品の端にある小さな四角を「ピン」といいます。ピンからピンへドラッグして、線でつなぎます。", + "部品の端にある小さな四角を「ピン」といいます。左側のピンは ON か OFF を受け取る「入力」、右側のピンは ON か OFF を送り出す「出力」です。出力のピンと入力のピンのあいだをドラッグして、線でつなぎます。", "Out と、置いた部品の左側のピンがすべてつながると、右下の再生ボタンが押せるようになります。左側のピンが空いている部品が残っていると押せません。", "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、「確かめる」を押します。", From 725837e5e0fa3cb8a327c9ca9890ef22058ac6fe Mon Sep 17 00:00:00 2001 From: Rn86222 Date: Fri, 20 Nov 2026 00:29:14 +0900 Subject: [PATCH 6/6] fix(tutorial): call the pins in step 3 inputs, as step 2 now explains Co-Authored-By: Claude Opus 5.5 --- src/i18n/en.ts | 2 +- src/i18n/ja.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i18n/en.ts b/src/i18n/en.ts index cfc6d60..62463c1 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -18,7 +18,7 @@ const stageTexts: Record = { steps: [ "Pick a part in the Parts list and drag it onto the editor on the right.", "The small squares on the edges of a part are its pins. A pin on the left side is an input, which receives ON or OFF, and a pin on the right side is an output, which sends ON or OFF. Drag between an output pin and an input pin to connect them with a wire.", - "Once Out and every pin on the left side of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free pin on its left side.", + "Once Out and every input pin of the parts you placed are connected, the play button at the bottom right can be pressed. It cannot be pressed while a part has a free input pin.", "After pressing it, click the switches A and B to turn them ON and OFF, and watch the lamp Out. To fix the circuit, the pencil button in the same place takes you back to editing.", "When it works as in the table, press Check.", ], diff --git a/src/i18n/ja.ts b/src/i18n/ja.ts index 7e35931..1dd86fd 100644 --- a/src/i18n/ja.ts +++ b/src/i18n/ja.ts @@ -127,7 +127,7 @@ export const ja: Messages = { steps: [ "「部品」の一覧から部品を選び、右のエディタにドラッグして置きます。", "部品の端にある小さな四角を「ピン」といいます。左側のピンは ON か OFF を受け取る「入力」、右側のピンは ON か OFF を送り出す「出力」です。出力のピンと入力のピンのあいだをドラッグして、線でつなぎます。", - "Out と、置いた部品の左側のピンがすべてつながると、右下の再生ボタンが押せるようになります。左側のピンが空いている部品が残っていると押せません。", + "Out と、置いた部品の入力のピンがすべてつながると、右下の再生ボタンが押せるようになります。入力のピンが空いている部品が残っていると押せません。", "再生ボタンを押したら、スイッチ A と B をクリックして ON と OFF を切り替え、ランプ Out を見ます。回路を直すときは、同じ場所の鉛筆のボタンで編集に戻ります。", "表のとおりに動いたら、「確かめる」を押します。", ],