We describe a maze as having row x col cells. For example if row was 3,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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.) 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.)
Expert Answer:
Answer rating: 100% (QA)
To create a recursive maze runner function findpathmaze fromcell tocell you can follow this pseudoco... View the full answer
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
With respect to real property taxes: (1) explain "assessed value"; (2) explain the similarities and differences between a tax exemption and a tax credit; and (3) discuss what factors a government...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
Define the SNMP model. How many tiers of agent-manager architecture it might have? How does the SNMP model employ client-server functionality? Is the peer-to-peer SNMP model feasible?
-
Muscles: Identify the name of the muscle, the origin, the insertion, and the action of the muscle labeled on the models. iliopsoas (psoas major and iliacus) gluteus maximus gluteus medius sartorius...
-
Consider the rectifier system of Example 10.5. Write a MATLAB script to plot the ripple voltage as a function of filter capacitance as the filter capacitance is varied over the range 3000F < C <...
-
Describe and explain the difficulties involved in grinding parts made of (a) Thermoplastics, (b) Thermosets, (c) Ceramics?
-
Alco, Inc., has a progressive board of directors and CEO who are committed to creating and maintaining an ethical culture within its business environment. It has an extensive corporate compliance and...
-
Bowyer Manufacturing Company has the following production data for selected months. Compute the physical units for eachmonth. Ending Work in Process % Complete as to Conversion Cost Beginning Work in...
-
3. You purchased a 3 year coupon bond one year ago. Its par value is $1,000 and coupon rate is 6%, paid annually. At the time you purchased the bond, its yield to maturity was 6.5%. Suppose you sell...
-
The finance director for the City of Green Falls printed the General Fund Revenues and Appropriations Ledgers shown below for the year just ended. The beginning-of-the-year fund balance was $160,160....
-
By 2018, 38 states had enacted "Right to Try" laws and more were considering such legislation. These efforts catapulted this ethical question into national prominence and touches on some of the...
-
Shadow plc has no debt but can borrow at 8 per cent. The firms WACC is currently 12 per cent, and the tax rate is 28 per cent. (a) What is Shadows cost of equity? (b) If the firm converts to 25 per...
-
Bruce & Co. expects its EBIT to be 100,000 every year forever. The firm can borrow at 10 per cent. Bruce currently has no debt, and its cost of equity is 20 per cent. If the tax rate is 21 per cent,...
-
Taiyuan Coal Gasification Ltd is comparing two different capital structures. Plan I would result in 1.62 billion shares of equity and 798 million yuan in debt. Plan II would result in 1 billion...
-
Show the impact of personal taxes on the firm value in an MM universe. When would a firm be indifferent between issuing debt or equity? Illustrate your answer with a practical example.
-
You manage an Islamic financing division and have been approached by a company for funding of 6 billion Bahrain dinars. The company wish to pay the funding back in equal instalments over 10 years...
-
Marriott Autograph-Lido House Newport Beach, California, islocated on the site of a former city hall. The historic hotelblends classic Cape Cod style architecture with nautical-inspireddetails to...
-
What are current assets and current liabilities? How are they different from non-current assets and non-current liabilities?
-
Implement an algorithm that returns a cycle in a directed graph G, if one exists.
-
Give Java code for performing add(e) and remove(i) methods for the Scoreboard class, as in Code Fragments 3.3 and 3.4, except this time, dontmaintain the game entries in order. Assume that we still...
-
Show how to use a deterministic O(n)-time selection algorithmto sort a sequence of n elements in O(nlogn)-worst-case time.
-
What are the six books of original entry?
-
Show the journal entries necessary to record the following items: 2017 Apr 1 Bought office furniture on credit from Durham Brothers Ltd 1,400. 4 We take goods costing 270 out of the business...
-
You are to open the books of F. Polk, a trader, via the journal to record the assets and liabilities, and are then to record the dialy transactions for the month of May. A trial balance is to be...
Study smarter with the SolutionInn App