Question: To implement Breadth - First Search ( BFS ) , and Depth - First Search ( DFS ) algorithm, to solve the 8 - puzzle

To implement Breadth-First Search (BFS), and Depth-First Search (DFS) algorithm, to solve the 8-puzzle problemsGiven an initial state and final state below. Write an BFS/DFS algorithm to solve the following 8puzzle problem. Your BFS/DFS algorithm should create all intermediate states until it reaches the final states. Your code should be executable and print all the states while executing. Examples of such BFS algorithm is shown below.
\table[[2,8,3],[1,6,4],[7,,5],[Initial state (vertex),\table[[1,2,3],[8,,4],[7,6,5]],],[Final goal state/vertex,,]]
The program is to start from an initial configuration to find the goal configuration. A solution to the problem is an appropriate sequence of moves, such as "move tiles 5 to the right, move tile 7 to the left, move tile 6 to the down, etc". You should always start with an initial random state (do not hard-coded in your program). Your program should be able to deal with any initial configuration.
 To implement Breadth-First Search (BFS), and Depth-First Search (DFS) algorithm, to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!