What's the catch? Clicking a cell will not only flip its color, but also that of all cells sharing the same row or column as it.
To me, this game feels like playing with a Rubik's cube --- every time you think you are fixing one cell, you mess up its neighbors!
There are many ways to arrive at a solution... some mathematical (linear algebra, or combinatorics), others more logical,... and yet others which are brute force.
The title “Lights Out” comes from a classic handheld game from 1997. The “rule” they follow for which-cells-get-flipped-on-click is what I call “Adjacent.” Additionally, my mathematics teacher showed me this game following another variant which I call “Same Row & Column,” but on a bigger board. He had worked out an algorithm for his version. I found the same strategy before he revealed the answer, and I feel that the process of discovering a solution is quite rewarding—it’s fundamentally related to computing on restrictive computer architectures.
I implemented this app with pretty basic TypeScript. It’s been used for some experiments to discover more general of strategies for different click variants, board sizes, and even board dimensions! It has also been the basis for the corresponding video produced using the Python library manim.
Try it out and let me know how you do!
kevindamm•4h ago
I'd seen the "adjacent only" variant before but not the other two, I'm glad the default was one I hadn't seen or I might not have noticed there was a choice!
Have you considered allowing the all-white state as a terminal state too? First time I completed it was with a detour to there (I know the text says make them red but my instincts went with the lights-out being to the color matching the background)
Thanks for the diversion. On the 5x5 my scores went from ~100 to dozens (sometimes 8-10). On larger boards I'm not as consistent but also not as interested in path length.