All case studies

Lights Out — the puzzle where most random boards cannot be solved

One rule, five cells per tap, and a generation problem most implementations never notice: scatter the lights at random and a large share of boards have no solution at all.

Lights Out — the puzzle where most random boards cannot be solved
Client
In-house title
Platform
WebGL / browser
Engine
Unity
Genre
Puzzle
Unity WebGLC#gzip compressionApache

The challenge

Lights Out has one rule: tap a cell and it toggles, along with its four orthogonal neighbours. There is nothing else to explain, no second mechanic, no progression system holding it up. That makes it an unusually honest piece of design work, because there is nowhere for a weak implementation to hide.

The first problem is that the rule is counter-intuitive in a specific way. Every other grid puzzle a player has met lets them change one thing at a time — place a number, swap a gem, drop a block. Here, touching a cell changes five. A player's instinct is to treat the board as a tidying job: find a lit cell, turn it off, repeat. That instinct is actively wrong, and following it produces a board that churns without improving. The player is not failing at the puzzle, they are solving the wrong puzzle, and nothing on screen tells them so.

The second problem is worse and is unique to this genre: a randomly generated board may have no solution at all. Lights Out is governed by linear algebra over GF(2), and on a 5x5 grid only a fraction of all possible light configurations can actually be cleared. Scatter lights at random and a large share of boards are mathematically impossible. A player can tap correctly for ten minutes on a board that was never solvable, conclude they are not clever enough, and quit. From inside the game there is no way to tell an impossible board from a merely hard one — and from outside, casual testing usually passes, because the developer rarely plays long enough to hit one.

Third, feedback is almost absent by default. In most puzzles, a good move visibly advances the state. Here, a correct move often lights up more cells than it extinguishes, because the solution frequently passes through boards that look worse than where you started. A player who judges progress by counting lit cells will abandon the correct path precisely when it is working.

Fourth, there is a property of the game that is enormously useful to players and completely invisible unless the interface reveals it: the order of taps does not matter, and tapping the same cell twice cancels out. That means a solution is a *set* of cells, not a sequence. A player who knows this can experiment freely and undo by repeating; a player who does not will treat every tap as a committed move in a sequence they are afraid to disturb.

And finally this is a browser build with no install step, so there is no sunk cost keeping anyone around. A visitor who finds the first thirty seconds confusing simply closes the tab.

Our approach

Solvability was treated as a generation constraint, not a hope. Boards are produced by starting from a cleared grid and applying a set of taps, which means every board the player sees is reachable backwards along the same path — it is solvable by construction. This matters more here than in almost any other puzzle genre, because unlike a sudoku or a water-sort board, an unsolvable Lights Out grid is not rare bad luck; on a random fill it is the common case. Generating forward from a solved state removes the entire failure mode, and it costs nothing at runtime.

The toggle rule is taught by the first tap rather than by text. The player taps, five cells flip, and the plus shape is immediately legible on the board. No tutorial can explain that faster than seeing it once, and for a game whose entire rule set is a single sentence, any instruction screen costs more attention than it returns.

Reversibility is made usable rather than merely true. Because tapping the same cell twice returns the board to where it was, nothing a player does is permanent — and that turns the board into a space to experiment in instead of a sequence to be afraid of. A player who discovers they can simply undo by re-tapping stops playing cautiously and starts actually exploring, which is when the real insight arrives.

The board was designed so the lit and unlit states are unmistakable at a glance and at any size. In a game where the only information is which cells are on, two states that read similarly on a phone is not a cosmetic problem — it is the game failing to communicate its single variable. Lit cells carry a warm glow that spreads slightly beyond the cell, so the pattern of light is readable as a shape rather than as sixteen separate squares, which is what lets a player start recognising configurations instead of counting cells.

Difficulty comes from the number of taps in the generated solution rather than from the number of lit cells, which is the distinction that keeps the curve honest. A board with many lights can be two taps from cleared; a board with three lights can need six. Generating by solution length means a level labelled harder actually demands more planning, rather than just looking busier.

No timer and no move limit. The entire activity is working out which set of cells to tap, and both a clock and a tap budget punish exactly the deliberate thinking the puzzle is built around. The pressure in Lights Out is the problem itself.

On the technical side the build ships gzip-compressed — identified by reading the magic bytes rather than assuming Brotli like most of the library — with its own server rule declaring that encoding, so the browser decompresses natively instead of falling back to the slower JavaScript path. The canvas is responsive, fixed to the full stage with the game scaling its own UI, so it fills the player page at any window size without cropping.

The result

Every board is solvable by construction. Boards are generated forward from a cleared grid by applying taps, so the player can never be stranded on an impossible configuration — which on a randomly filled Lights Out board is not an edge case but the likely outcome.

The rule teaches itself in one tap. Five cells flip in a plus shape and the mechanic is understood, with no tutorial standing between the player and the puzzle.

Reversibility is surfaced rather than hidden: re-tapping a cell undoes it, so the board becomes somewhere to experiment instead of a sequence to protect. That is what moves a player from clearing lights one at a time to choosing a set of cells, which is the actual game.

Lit and unlit states are unmistakable at any size, with the glow spreading just past each cell so the lit pattern reads as a shape — the first step toward recognising configurations rather than counting squares.

Difficulty scales on solution length, not on how many lights are showing, so a harder level genuinely demands more planning.

No timer, no move limit. The build loads with native gzip decompression and fills the stage at any window size, on desktop and mobile.

Playable on this site right now, with no download and no account.