Is there any perfect way of solving the puzzle? Not necessarily. It depends on the resources available and the scope of the solver. Solving the puzzle by logic is not always possible because enough givens are needed. The lack of givens to solve the puzzle is a big problem using this method. But when enough givens are provided then this method works beautifully using very few iterations to find the solution. Solving the puzzle by logic is easy for humans but not for computers. Developing a computer program to solve the puzzle by logic is way more complicated than writing the code for DFS. Tasks easy forhumans are complicated for computers and vice versa.
Finding a solution for thepuzzle using only DFS is for certain.Tree diagrams are widely used in computer science
We’ll use the same kind of diagram, except we’ll show the relationships between states (specifically between states which lead to other states, and states which are led to from other states). A tree is composed of nodes, which represent states, and branches,which represent the possible transitions between states.