I am programming the game that named Lights Out. The purpose of this game is turning all the lights out. There's a flash version of the game here. I want to develop a way of solving the game. How can I do this?
You can use a tree. There are lots of ways to employ these and you will need to think carefully about which method will work best for your particular game - so some research should be done first.
To give a basic overview.
Start with the root node which will be your level's starting state. Create a branch for every possible action that can be performed at that point and have the node be the new game state after that action is performed. Repeat this for each node that's created.
Then what you need to do is find a node (which you can be looking for while building the tree) in which the game state is the level completed. Then walk back up the tree to the root node to get a list of actions that need to be performed to get to this "complete" state.
This may not be the best solution to your particular problem but it might steer you towards a solution. You might want to look into decision trees and path finding techniques for general interest, but also the reading might give you some ideas.