You just watched two transistors turn into an AND and an OR. From here on, we'll stop drawing individual transistors and start treating each wired-up bundle as a single box called a logic gate — each one follows one dead-simple rule about its inputs. Click the switches below and watch each one think.
The simplest gate of all. One input, one output. Whatever comes in, the opposite comes out.
| A | OUT |
|---|---|
| 0 | 1 |
| 1 | 0 |
Output is 1 only when every input is 1. Think of two switches wired in a row — current only completes the loop if both are closed.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
Output is 1 if at least one input is 1. Like two switches wired side by side — either one closing completes the loop.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
"Exclusive OR." Output is 1 only when the inputs disagree. Two matching inputs (0,0 or 1,1) give 0. Remember this one — it's about to become the star of the show.
| A | B | OUT |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
Under the hood: a NOT gate takes about 2 transistors, an AND or OR gate about 6, and an XOR gate around 8–12. A modern chip strings together billions of these — but every single one of them is just one of these four simple rules.
Coming up: a switch only ever means 0 or 1 — so how does a computer represent a number like "37"? Next: binary numbers.