Repository navigation
feat(tutorial): hand earlier stages' components over as finished parts - #100
Merged
Merged
Conversation
Each stage now has a reference solution, built with StageCircuit through the same stores the editor uses. A stage can list earlier stages in givenParts: their components are laid out with their solutions and offered as parts. A saved stage that lacks one is laid out anew. The old second stage (exactly one switch from And, Or and Not) is split in two: "Only switch A" joins two parts, and "Only one switch" builds on it as a given part with Or. Given parts are listed with their tables under Available parts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom before - The Input and Output nodes of a part handed over are kept like the stage's own, and its properties button is hidden. - Editing a part handed over offers the parts of its own stage, so a deleted gate can be put back, and no new pins. - Given parts are collected down every level. - A save without a part that is now handed over gets the part added instead of being laid out anew, so the player's circuit stays. - Solutions take intrinsic pins as objects, since those are named for display. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e hands over Also name the missing pin when a solution asks for one, and drop comments that only restated the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Deploying create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee with
|
| Latest commit: |
db14e10
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://99125c38.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev |
| Branch Preview URL: | https://feat-given-parts.create-cpu-c8345196-9409-4cce-afc4-389f413ad8ee.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Later stages are meant to build on earlier ones: a half adder becomes part of a full adder, and so on up to the stopwatch. A visitor may start from any stage, so a stage has to hand over the earlier parts already built. This PR adds that, and uses it by splitting the old second stage in two.
solve), built withStageCircuitthrough the same stores the editor uses. A test runs every solution through Check and makes sure it only uses parts the stage offers.givenParts. When the stage is laid out, their components are built from their solutions (and from the parts those are given), named after their stages, and offered in the side panel. "Available parts" lists them with their tables.xor) is built from two "Only switch A" parts and Or. Its goal says the part is ready to use.PartDescriptionis split into the intrinsic lookup andPartDescriptionView, which given parts use with their stage's table.Not in this PR
Testing
npx vitest run(190 tests),npx tsc -p .andnpx biome check srcpass. New tests cover:🤖 Generated with Claude Code