Lights On/Lights Out Game and Solver

Lights On/Lights Out is a puzzle game. Given a set of random lights, press one of the lights to toggle it and its four adjacent lights on and off. The objective of the game is to switch all the lights on or off. This Demonstration gives an instant solution to the puzzle.


  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


Suppose the puzzle has squares. The solver sets up a system of linear equations in variables and uses the Mathematica built-in function Solve to find a solution. The solution page marks the squares that need to be pressed in red.
For more information, see the Wikipedia entry for Lights Out.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.