Logic Gates
Place logic gates and wire them from the inputs to the outputs until every row of the truth table matches.
Loading the first level.
Truth table. The shaded row is the one set by the input switches on the board.
Controls
- Keyboard
- Tab to a dot and press Enter to start a wire, then Enter on an input dot to finish it. Arrow keys move a picked gate; Delete removes it.
- Touch
- Tap an output dot, then an input dot, to wire them. Drag a gate to move it. Tap a gate and press Delete gate to remove it.
Your best score stays in this browser only. Nothing is sent anywhere. The game pauses when you switch tabs.
About the Logic Gates puzzle
Every processor, phone and calculator is built from logic gates: tiny switches that take ones and zeros in and give a one or a zero out. This Logic Gates puzzle asks you to build small circuits from those gates, the same circuits that computer and electronics engineering students draw in their first digital logic course. Each level gives you a target truth table and a short list of gates you may use. The truth table beside the board checks your circuit against every possible input as you wire it, so you see at once which rows are right.
The fourteen levels start with a single inverter and climb through NAND-only designs, the half adder and full adder, a multiplexer, a decoder and a parity checker, up to a 2-bit magnitude comparator. Each level has a par, the smallest gate count we know of. Beating it is optional; your fewest gates for each level stay in this browser.
How to play Logic Gates
- Read the level brief, then press one of the add buttons to put a gate on the board. Drag it, or use the arrow keys, to move it where you like.
- To draw a wire, tap an output dot (the right edge of an input or a gate), then tap an input dot (the left edge of a gate or an output). One output can feed many inputs.
- Tap a wired input dot to remove its wire. Tap a gate and press Delete gate to remove it.
- Flip the input switches on the left to watch values travel along the wires. Green wires carry a 1.
- When every row of the truth table shows a tick, the level is solved. Press Next level to go on.
The gates, in one line each
AND gives 1 only when both inputs are 1. OR gives 1 when either input is 1. NOT flips its one input. XOR gives 1 when the inputs differ. NAND and NOR are AND and OR followed by a NOT, shown by the small circle on the output. NAND on its own is called a universal gate, because every other gate can be built from it; levels 2, 3 and 13 prove it.
Where these circuits are used
A half adder adds two bits, and chaining full adders gives the ripple-carry adder inside an arithmetic logic unit. A multiplexer picks one of several signals, which is how a processor chooses which register to read. A decoder turns a binary address into one select line for a memory chip. Comparators sit behind every if statement that compares two numbers. If you are preparing for a digital logic exam, try each level on paper first with Boolean algebra and Karnaugh maps, then build it here to check.
Written from scratch by Imperial College of Engineering for Kaamko. No third-party code or art.
Last checked by Imperial College of Engineering. Played through on desktop and a 390px phone screen on this date.