Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write scheme functions that uses breadth - first search to solve the 8 - puzzle problem: Eight tiles ( numbered 1 through 8 ) are
Write scheme functions that uses breadthfirst search to solve the puzzle problem: Eight tiles numbered through are fitted into a X matrix. One space is left blank so that tiles can be moved around to change the configuration of the matrix. The objective is to find a sequence of moves of the tiles into blank space that change the matrix from the initial state to the goal state. For example: Initial state Intermediate State Goal state Each problem state can be represented by a list containing the symbols numbers and B for blank in rowmajor order. For example, the goal state is represented by B Part I. Move operators points It is much easier to describe the change of matrix in terms of moving the blank tile, instead of moving a number tile. For example, we can describe the change from intermediate state to the goal state as moving the blank tile down by one row. Write functions named up down, left, right that each accept a list argument describing the state of the matrix and return the new state of the matrix generated by moving the blank tile in the direction indicated by the function name. The function should return if the movement will cause the blank tile to go out of bound. For example, up B B up B Part II Breadfirst Search points Write a function named puzzle that accept two list arguments: the st describing the initial state and the nd describing the goal state. The function returns a list of states describing a path from initial state to the goal state using breadthfirst search. For example: puzzle B B B B B B B B B B B At any point during the search, we can change the current state to a new state by calling one of the functions: up down, left, right. For example, up B B current state new state Before a new path contain the new state is added to the end of the search queue ie the nodelist in the fwgc program it must satisfy the following two conditions: The new state has NOT been generated previously, ie it is not in any of the paths of the queue. The new state is not empty. Part III printpuzzle points If we wish to see the path as actual matrices, we would need to define printpuzzle function We can call printpuzzle the solution to get the actual stepbystep solution. For example: printpuzzle puzzle B B
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started