Work: Write a program to solve the following customized 8-puzzle problem using the breadth first search algorithm. Note that we will be having two 4’s and two 5’s in this problem and no 3 or 6. Your program will ask the user to enter the starting position as a string (i.e. 142045578 the 0 is used for space). It then should show that position as: 1 4 2 4 5 5 7 8 Then it should output the sequence of actions that will lead to the goal: 1 2 4 4 5 5 7 8 Also print out the number of generated states and expanded states up to finding the goal state. In your code, always consider the following order of actions for expanding nodes: Up, Down, Right, then Left. Note that if any action is illegal (can’t be performed) then you should ignore it (don’t generate the illegal node).

25 0

Get full Expert solution in seconds

$1.97 ONLY