Page 1 of 1

Question 7: 1D Maze 10 points Suppose you're given a 1D maze in an array of chars called 'maze! The variable size' conta

Posted: Sun May 15, 2022 8:00 am
by answerhappygod
Question 7 1d Maze 10 Points Suppose You Re Given A 1d Maze In An Array Of Chars Called Maze The Variable Size Conta 1
Question 7 1d Maze 10 Points Suppose You Re Given A 1d Maze In An Array Of Chars Called Maze The Variable Size Conta 1 (84.21 KiB) Viewed 41 times
Question 7 1d Maze 10 Points Suppose You Re Given A 1d Maze In An Array Of Chars Called Maze The Variable Size Conta 2
Question 7 1d Maze 10 Points Suppose You Re Given A 1d Maze In An Array Of Chars Called Maze The Variable Size Conta 2 (47.61 KiB) Viewed 41 times
Question 7: 1D Maze 10 points Suppose you're given a 1D maze in an array of chars called 'maze! The variable size' contains the number of chars in the array. You can move left or right one char. The char X represents impassible space. Any other char can be passed through (either forward or backward). The char 'S' is the starting point and 'F' is the finish point. Example: XX This puzzle is fairly boring so we add one more complication. The digits (0,1,2,3,4,5,6,7.8.9} represent warp zones. In addition to the usual left and right movement these chars allow you to move to the matching digit (if present, a digit will appear exactly 2 times). Below is an example Maze: XS 2 XF 2 X X13 3 XX Convert a given 1D array to an equivalent graph. There should be a solution to the maze if and only if there is a path through the graph between the start and finish vertices. You can assume the first and last positions of the mixe contain the char X In addition to returning a_graph, you should also store the index of the start and finish into the locations pointed to by ps and pf. Some helpful functions/reminders 1/Creates and returns a new empty Graph Graph. createGraph(): // Adds an edge from vertex from te vertexto 1/11 needed also automatically creates vertices to represent the given integers void addEdge Graph 8. int from. int to): chint IN You can compare det vil with to the function Digit to test if a Chat

Complete the following function: Graph• mazeToGraph(char* maze, int size, int .ps, int .pf) //Declare variables 7/Build the graph 1