Question: Task Write a recursive program that will solve a given 3x3 sliding puzzle. You are to write a function solve_puzzle() that will solve the given

 Task Write a recursive program that will solve a given 3x3

Task Write a recursive program that will solve a given 3x3 sliding puzzle. You are to write a function solve_puzzle() that will solve the given input. Copy def solve_puzzle(solved, unsolved, prev_states, directions): # your code here Where all the parameters are all going to be Python lists. The maximum number of moves is 15. If the puzzle cannot be solved in 15 moves, then it's not a viable solution. The input for solved and unsolved will look something like this: Sample Input Copy solved = [ [1, 2, 3] [4, 5, 6] [7, 8, 0] ] unsolved = [ [1, 2, 3], [4, 5, 0] [7, 8, 6] ] Output The output should be a tuple where the first value is a list of moves and the second value is the minimum number of moves that correspond to the list of moves. If there's no viable solution, then the output should just be ([], 0)

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!