Logic Gates

Flip the switches and the signal passes through a gate such as AND or OR (a part that decides its output from its inputs) to decide whether the bulb lights. At the end, two gates team up to do addition.

A = 0B = 0AND0

AND: the output is 1 only when both A and B are 1.

ABBulb
000
01?
10?
11?

A simplified teaching model.

How to play

Pick a gate with the buttons at the top. Then press switches A and B to flip between 0 (off) and 1 (on). The gate decides whether the bulb lights. Your goal is to try every combination of switches until there are no "?" left in the table below. "Run it for me" tries all the combinations one by one. Choose "Addition" to see two gates work together to calculate 1 + 1.

Learn more

AND gives 1 only when both inputs are 1. OR gives 1 when either input is 1. NOT swaps 0 and 1. XOR gives 1 only when the inputs differ. In addition, XOR produces the ones digit of the answer and AND produces the carry. In binary (writing numbers with only 0 and 1), 1 + 1 is 10. This circuit is called a half adder. Chain several together and you can add bigger numbers. Computer arithmetic is built from small parts like these. This diagram is a simplified teaching model: real chips use high and low voltages for 0 and 1 and have wiring and timing details we leave out.

Read more about it: How computers think →