Play Logic Flow
A logic gate puzzle built with plain JavaScript. Toggle the inputs and watch them flow through AND, OR, XOR, NAND and NOR gates until the output matches the goal. Endless levels, all in the browser.
This is a real, playable puzzle, not a screenshot. Tap the inputs to flip each bit and the circuit recomputes instantly, lighting the output bulb. Match the goal to clear the level and the next one loads with more inputs and gates. It is a hands on way to feel how boolean logic works, the same logic behind every condition you write in code.
How to play
Each puzzle is a tiny circuit. A row of inputs feeds through a chain of logic gates and ends at one output bulb. The banner tells you the goal, turn the output on or off, and your job is to tap the inputs until the bulb matches. Every tap flips an input between 0 and 1, and the gates instantly recompute so you can watch the signal change. Solve it and the next level loads automatically, adding more inputs and gates as you climb. There is no failing here, only puzzles to crack, so chase a high best level.
The gates you will meet
Five gates cover almost everything you need to reason about digital logic.
AND, OR and XOR
AND outputs 1 only when both inputs are 1. OR outputs 1 when at least one input is 1. XOR outputs 1 when the two inputs differ. These three are the everyday workhorses of conditions and bit math.
NAND and NOR
NAND and NOR are simply AND and OR with the result flipped, so NAND is 0 only when both inputs are 1, and NOR is 1 only when both are 0. NAND alone can build every other gate, which is why chip designers love it.
Reading the chain
The circuit evaluates left to right. The first gate combines the first two inputs, then each later gate takes that running result and folds in the next input, exactly the way the code in this game computes the output.
How this game is built
Logic Flow is small but it leans on a couple of real ideas.
Generating a fair puzzle
Each level picks random gates, then the code checks every possible input combination to be sure the puzzle is not stuck on one constant answer and that the goal can actually be reached. That brute force check is the same exhaustive testing you would use to verify a truth table.
Tracking state and input
The inputs, the gates and the goal are the whole game state, and a tap just flips one bit and re-renders, the tidy loop covered in game state management and handling game input.
Why logic gates matter in code
Every if statement, every loop condition, every permission check comes down to combining true and false values, and that is all a logic gate does. When you write a condition with and and or, you are wiring AND and OR gates in your head. The short circuit operators in most languages even mirror the hardware, stopping early once the answer is certain. Play enough levels and the truth tables stop being something you memorise, they become something you feel, which carries straight over into the reactive conditions behind an event driven UI.
Frequently asked questions
How do I play Logic Flow?
Read the goal at the top, then tap the inputs to flip them between 0 and 1 until the output bulb matches the goal. The gates recompute on every tap, and solving advances you to a harder level.
What do AND, OR, XOR, NAND and NOR mean?
AND needs both inputs on, OR needs at least one, XOR needs them to differ, NAND is a flipped AND, and NOR is a flipped OR. The chain applies them left to right.
Are the puzzles always solvable?
Yes. Before a level appears, the game tests every input combination to confirm the goal is reachable and the circuit is not stuck on a single constant value.
How does this relate to programming?
Logic gates are the hardware version of the boolean conditions you write every day. Combining true and false with and and or is the same operation, right down to short circuit evaluation.
Want to see boolean logic drive a real interface?
Explore how event driven systems react to changing state.
Read: Event Driven UI →