Play a free lamp-flipping puzzle in five sizes and three difficulties. Every board is solvable, and a hint and a shortest-solution tool are built in.
Presses 0
Time 0:00
Lit 0
Fewest possible -
Your best -
Press a cell to flip it and its neighbours above, below, left and right. Clear every lamp. Arrow keys move, Enter or Space presses, H gives a hint. Pressing the same cell twice undoes it. A best score only counts if you did not use the hint or the solution.
Every board is made by pressing cells on a dark grid, so it can always be cleared by pressing the same cells again. A board of random lit cells usually cannot: on a 5x5 grid only one board in four is solvable.
The order of presses never matters and pressing a cell twice cancels, so a game is just a yes or no for each cell. That makes it a system of equations where 1 + 1 = 0 (arithmetic modulo 2). The solver runs Gaussian elimination on that system using bitmasks, then tries every combination of the leftover free choices and keeps the shortest set of presses. The solution and the hint come from that shortest set.
As-is, no warranty. These apps are free under their listed license and run entirely in your browser. Use at your own risk — don't blame me if your PC catches fire, your dog runs away, or the math turns out wrong. Verify anything that actually matters. None of this is professional financial, medical, legal, or engineering advice.
The board is a grid of lamps, each lit or dark. Pressing a cell flips that lamp and the lamps directly above, below, left and right of it. The edges do not wrap around. Turn every lamp off.
Pick a size (3x3 to 7x7) and a difficulty, then press cells with a tap, a click, or the keyboard: the arrow keys move, Enter or Space presses, H asks for a hint. Pressing the same cell twice puts everything back, so no undo button is needed. Restart returns to the same starting board; New puzzle deals a fresh one. The page address carries the board’s seed, so you can send a friend the exact puzzle.
Each press is announced for screen readers, with the cell pressed and how many lamps are still lit. Lamps are never shown by colour alone. A lit lamp is a filled circle and a dark lamp is a small hollow square. The solution tool marks cells with a dashed border and a diamond, and a hint uses a solid border and a diamond. Lit lamps glow amber in the middle with a soft sky-blue halo, and the solution and hint markers are violet so they never look like a lit lamp. When you clear the board a wave of colour ripples across the lamps, and it is switched off if your device asks for reduced motion.
Difficulty. Easy scrambles the dark grid with about n random presses and Normal with about 2n, where n is the side length. Because presses can overlap and cancel, the fewest presses needed can be lower than that. Hard is different: it picks a board uniformly at random from the boards that can be cleared, never one that is already clear.
Three facts do all the work, and the test suite checks each one.
That is arithmetic with only 0 and 1, called GF(2). With one yes or no per cell, solving the puzzle becomes a system of equations with one equation per lamp: “the presses that touch this lamp must flip it an odd number of times if it is lit, and an even number if it is dark.” The solver does Gaussian elimination on that system, the same row-by-row method from school algebra, with each row stored as a bitmask and “subtract” replaced by XOR. The elimination matrix is worked out once per size and reused for every board.
Some sets of presses change nothing at all. On 5x5, pressing the right pattern of cells leaves every lamp as it was. These quiet patterns form the null space, and its size decides how many boards are out of reach. The dimension of the null space for each size, as computed by the code:
| Size | Null-space dimension | Boards that can be cleared |
|---|---|---|
| 3x3 | 0 | all of them |
| 4x4 | 4 | 1 in 16 (2^12 of 2^16) |
| 5x5 | 2 | 1 in 4 (2^23 of 2^25) |
| 6x6 | 0 | all of them |
| 7x7 | 0 | all of them |
So on 5x5 only a quarter of the 33,554,432 possible patterns are solvable, and a board of randomly lit cells is unsolvable three times out of four. That is why Light Grid builds boards by pressing cells on a dark grid: the same presses undo them, so every board is solvable by construction.
When the null space is empty (3x3, 6x6, 7x7), each solvable board has exactly one set of presses that clears it, and elimination finds it directly. When it is not empty (4x4 and 5x5), each solvable board has 2^4 = 16 or 2^2 = 4 different solutions, because you can add any quiet pattern to a solution and still clear the board. The solver finds one solution, then tries every combination of quiet patterns (using a Gray code, one XOR per step) and keeps the smallest. The Show a solution button marks that smallest set, and Hint points at one cell of it.
Checked against a method that does not use elimination at all:
The “Fewest possible” figure under the board is the solver’s minimum for the starting board. Your best is the fewest presses you have used to clear a board of that size and difficulty. Only wins count. A win does not count toward a best if you used the hint or the solution tool on that puzzle, and that stays true if you restart the same puzzle.
Nothing is uploaded and there is no account. Your best press count for each size and difficulty is saved in your browser’s local storage as small whole numbers inside a small JSON object under one key. Clearing site data removes it. The only other state is the page address, which holds the size, difficulty and board seed.
Everything runs locally in your browser.
For informational purposes only. Not financial, medical, or legal advice. You are solely responsible for how you use these tools.