Problem 44756. Lights Out 5 - 5x5, 10 moves
Lights Out is a logic game wherein all lights need to be turned off to complete each board. See the first problem in the series for an introduction.
This problem contains boards that each require ten moves to solve. For example, if
board = [0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1]
an answer is:
moves = [1 2 3 4 5 16 17 18 19 20]
Prev.: 5x5, 8 moves — Next: 5x5, 13 moves
Solution Stats
Problem Comments
-
8 Comments
@goc3
A piece of advice, measure the running time(using tic, toc, for example) in the test suit to see which solution is fast.
@li haitao: I got 3.838179s (total time for test suite) for William's solution and 0.986936s (1/4 the time) for your sped-up version. Impressive.
i am surprised about the fact that some test admit a shorter solution than 10 moves :S
Solution Comments
Show commentsProblem Recent Solvers15
Suggested Problems
-
Return the largest number that is adjacent to a zero
5407 Solvers
-
Swap the first and last columns
21016 Solvers
-
2493 Solvers
-
406 Solvers
-
Back to basics 9 - Indexed References
446 Solvers
More from this Author139
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!