Menu

[Solved]90 Marks Write Program Solves Given Maze Using Stack Maze 2d Array Cell Structs Entry Cell Q37199687

a) [90 marks] Write a program that solves a given maze using stack Maze is a 2D array of Cell structs. Below entry cell is (1use c programming language

a) [90 marks] Write a program that solves a given maze using stack Maze is a 2D array of Cell structs. Below entry cell is (1.0) and exit is (9, 10). You’ll need other attributes in your struct as well, eg, int visited. Wall cells are represented below by 1s you will represent them by setting the int wall flag to 1 . M= Here is a solved maze where X indicates a cell on the path, indicates a cell visited but not on the path. Use this neighbor lookup order consistently: top, right, bottom, left M(solved) Algonithm is essentially the following Set maze start as the current cell Push current cell on the stack while The current cell is not the maze end Set the current cell by peaking on the stack Mark the cuurent cell visited and on the path if the cusrent cell has unvisited and reachable neighbors Consistently choose an unvisited a peighbor, Push the neighbor onto the stack Set the curent cell not on the path Pop the cusrent cell from the stack return The path that reached the exit You will print the path retumed above. Assume that we provide a valid maze to you. Show transcribed image text a) [90 marks] Write a program that solves a given maze using stack Maze is a 2D array of Cell structs. Below entry cell is (1.0) and exit is (9, 10). You’ll need other attributes in your struct as well, eg, int visited. Wall cells are represented below by 1s you will represent them by setting the int wall flag to 1 . M= Here is a solved maze where X indicates a cell on the path, indicates a cell visited but not on the path. Use this neighbor lookup order consistently: top, right, bottom, left M(solved) Algonithm is essentially the following Set maze start as the current cell Push current cell on the stack while The current cell is not the maze end Set the current cell by peaking on the stack Mark the cuurent cell visited and on the path if the cusrent cell has unvisited and reachable neighbors Consistently choose an unvisited a peighbor, Push the neighbor onto the stack Set the curent cell not on the path Pop the cusrent cell from the stack return The path that reached the exit You will print the path retumed above. Assume that we provide a valid maze to you.

Expert Answer


Answer to a) [90 marks] Write a program that solves a given maze using stack Maze is a 2D array of Cell structs. Below entry cell … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *