Lights Out Puzzle

Burak Keskin
MIS Profundum
Published in
5 min readMar 10, 2022

--

Game History

Lights Out is an electronic game released by Tiger Electronics in 1995. The game consists of a 5 by 5 grid of lights. When the game starts, a random number or a stored pattern of these lights is switched on. Pressing any of the lights will toggle it and the adjacent lights. The goal of the puzzle is to switch all the lights off, preferably in as few button presses as possible.

Game Description

A one-person game played on a rectangular lattice of lamps which can be turned on and off. A move consists of flipping a “switch” inside one of the squares, thereby toggling the on/off state of this and all four vertically and horizontally adjacent squares. The problem of determining if it is possible to start from set of all lights being on to all lights being off is known as the “all-ones problem”.

Solution

If a light is on, it must be toggled an odd number of times to be turned off. If a light is off, it must be toggled an even number of times for it to remain off. Several conclusions are used for the game’s strategy. Firstly, the order in which the lights are pressed does not matter, as the result will be the same. Secondly, in a minimal solution, each light needs to be pressed no more than once, because pressing a light twice is equivalent to not pressing it at all.

Matrix Representation

Solution Steps

Each lamp configuration can be viewed as a matrix L a (0,1) matrix, where each 1 represents a burning light and 0 represents a light turned off.

The action of the switch placed at (i, j) can be interpreted as the matrix addition L + Aij , where Aij is the matrix in which the only entries equal to 1 are those placed at and in the adjacent positions; there are essentially three different types of matrices Aij, depending on whether (i, j) is a corner entry,

Since matrix addition is commutative, it follows that the order in which the moves are performed is irrelevant.

Every winning combination of moves can be expressed mathematically in the form:

Here, 0 denotes the zero matrix, which corresponds to the situation where all lights are turned off, and each coefficient x_i_j represents the number of times that switch (i, j) has to be pressed. Because we are solving the equations (mod 2), they can therefore be written in the equivalent form:

Example

Since the matrix of the system of equations has maximal rank (it is a 9×9 matrix with nonzero determinant), the game on a 3×3 lattice is always solvable.

How To Solve

Buttons to Press

Chasing the Lights

1. Chase the lights starting from the first row. To chase the lights in the first row, click the tile on the second row corresponding to the light in the first row. This will turn off that light in the first row.

2. In the same way continue to chase the lights in the second, third and fourth row. At the end of this you will be only left with the lights in the fifth row.

3. Now depending on which lights are remaining in the fifth row, click the tiles in the first row using the table given below.

4. Now again chase the lights starting from the first row. After chasing the lights this time your puzzle will be solved.

Example

No Solution

In 1998, Marlow Anderson and Todd Feil used linear algebra to prove that not all configurations are solvable. For example:

The Game

https://www.logicgamesonline.com/lightsout/

http://perfectweb.org/ddo/solver/vale_puzzle.html

--

--