Lights Out: https://veerasundar.com/lights-out-online-game/
Run Here: https://ideone.com/a1Go1a
Edit beg
variable to set initial state, 1
for lights on and 0
for off.
Program outputs list of (x, y)
coordinates you need to press to solve it in optimal moves.
The Algorithm uses Breadth-First-Search by considering state of game as graph node.
Each move is an unweighted edge to another state, and we just need to find shortest path from initial state to final state ie. state with all lights off.