[Solved] How would I program an algorithm to solve this puzzle? [closed]


You can see this as a graph theory problem (http://en.wikipedia.org/wiki/Graph_theory).

Each given state of your puzzle is a Vertice of the graph, and each light switching is an edge that takes the Graph to another state.

Given a starting state, if you expand your graph breadth-first, your will find the sortest solution (http://en.wikipedia.org/wiki/Breadth-first_search).

It is beyond the scope of this answer to expand more than this. But I can point you to a python script I made to solve a similar but different 3×3 problem:

You can study my script to see what and why it does to solve this problem, and apply the same concepts to solve your problem on whatever language you desire.

3

solved How would I program an algorithm to solve this puzzle? [closed]