Reference
Constraints & rules
The renderer is permissive by design — invalid references return null and are silently skipped rather than throwing. But circuits that violate these rules will look wrong or incomplete. Treat them as hard requirements.
Component ids
- Every
idincomponents[]must be unique. - Every
idreferenced inshow[]orhighlightmust exist incomponents[]. - Wire
from/tothat reference non-existent ids produce no wire (silent skip).
show[] — cumulative invariant
- Each step's
show[]must be a superset of the previous step'sshow[]. - Never remove an id between steps.
- The final step's
show[]must include every component id. - First step's
show[]must be['bb'].
IC placement
- All gates use
row: 'e'. - Each IC occupies exactly 7 consecutive columns.
- Minimum 2-column gap between adjacent ICs.
- Do not place any component past column 30 on the standard breadboard, or past column 63 on the long-breadboard.
Resistor + LED pairing
- Every LED must have a current-limiting resistor in series (330Ω typical).
- Resistor at col N → resistor p2 at col N+3 → LED anode at col N+2 (not N+4). The LED is placed 2 cols after the resistor start.
- LED cathode must always connect to a ground rail.
The resistor → LED column arithmetic
Resistor at col 22 → p1 at col 22, p2 at col 25. LED at col 24 → anode at col 24, cathode at col 25. Wire: resistor p2 (col 25) → LED anode (col 24). They share the same node because they're in the same column on the same row.
Wires
- Every wire must have a valid
fromandto— both must resolve to a position. - Wires with unresolvable endpoints are silently dropped (no crash, but missing connections).
- Each ground return wire should use a unique
colon the rail to avoid overlap.
truthTable
- If present,
inputsandoutputsarrays must be non-empty. - Every
row.inputskey must be in theinputsarray. - Every
row.outputskey must be in theoutputsarray. activeInputskeys in steps must matchtruthTable.inputskeys exactly.
Validating before committing
There's no automated validator yet. Manual checklist:
- All ids in
show[]exist incomponents[] - Column ranges of components on the same row don't overlap
- Every IC is on row
'e'with 7-col spacing - Every LED has a resistor and a ground wire
show[]only grows — never shrinks- Last step's
show[]contains all component ids activeInputskeys matchtruthTable.inputs
Let AI validate for you
Paste the generated circuit into Claude and ask it to check against this constraints list. It will catch column collisions, missing ground wires, and non-cumulative show arrays.