Level 5: Strict choice

Open the level →

Task

Build an Exclusive OR (XOR) gate.

XOR (exclusive OR) outputs 1 when inputs DIFFER, and 0 when they match.

Related Materials

Solution

Contrast with OR: "tea or coffee?" is XOR — you pick exactly one, not both at once. OR would pass "both at once" (tea and coffee together). XOR is a difference detector: it fires exactly when its inputs differ.

Formula: XOR = (A OR B) AND NOT(A AND B). Build in two parallel streams:

1. Left stream — "at least one": feed A and B into OR → OR=1 when any input is 1. 2. Right stream — "not both": feed A and B into NAND → NAND=1 always EXCEPT when both inputs are 1. 3. Feed OR output and NAND output into AND inputs.

This final AND outputs 1 only when OR says 1 (at least one 1 present) AND NAND says 1 (not two 1s simultaneously) — exactly when the bits differ!

Connect AND output to Output.

Solution circuit for level 5 — Strict choice
The authored solution for level 5 in the simulator (dark theme)