devShakib

Loading devShakib…

Lights Out

Toggle cells to switch every light off — but each tap flips its neighbours too. Solve it in the fewest moves.

Lights Out was a Tiger Electronics handheld from 1995, and it is unusual among puzzle games in being exactly linear algebra. Each press toggles a cell and its neighbours, toggling twice returns to the start, and order never matters — so a solution is a set of cells to press, not a sequence.

That makes it a system of equations over the integers modulo two, solvable by Gaussian elimination. On the standard 5×5 board the transformation is not invertible, which has a concrete consequence: not every starting configuration is solvable, and those that are have exactly four distinct solutions.