Given a Lights Out board, find the set of lights that need to be pressed in order to solve the board. If no solution is possible, an error is thrown.
There are a few algorithms for solving Lights Out puzzles. This function implements the Gaussian Elimination technique, which does not guarantee the minimum number of steps. Therefore, some steps in the given solution may be redundant.
If you are interested, there are many resources online outlining the exact details of how this technique works, and what the other solving strategies are.
A matrix with the same dimensions as the input board, with a
in every position that requires a press to solve to the board. Note that the
order of the light presses does not matter.
1 2 3 4 5 6 7 8
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.