Question: We describe a maze as having row x col cells. For example if row was 3, and col was 4, then we would have
We describe a maze as having row x col cells. For example if row was 3, and col was 4, then we would have a grid of cells as follows. We describe a wall by the two cell numbers the wall separates (smaller number first). If every single wall existed, there would be (row-1) (col) + (col-1) (row) walls. | 1 | 2 | 3 4 5 6 7 8 | 9 | 10 | 11 A Maze class (which you do not need to implement) describes a maze as mentioned above. This class is defined in maze.py. It has methods that you can use to travel through the maze (i.e. figure out where you are, find a neighbour cell etc.) Write a recursive maze runner function: def find_path(maze, from_cell, to_cell); The find_path function will find a path from cell number from cell to cell number to cell and will return it as a list containing all the cell numbers along the path, from the from cell to the to_cell. The function will also return the number of cells along the path from the from_cell to the to_cell, inclusive. You are allowed to use this function as a wrapper to a recursive function that does the work, allowing for other arguments to your function prototype or additional processing. However, the function that does the work to find the path must be recursive. For example, suppose the from cell was 0 and the to_cell was 3, using the maze below: 0 1 2 3 4 5 6 7 8 9 10 | 11 The find_path function would return this path: [0, 4, 5, 1, 2, 3] and 6 (as the number of the cells along this path.)
Step by Step Solution
3.43 Rating (153 Votes )
There are 3 Steps involved in it
To create a recursive maze runner function findpathmaze fromcell tocell you can follow this pseudoco... View full answer
Get step-by-step solutions from verified subject matter experts
