Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The two-dimensional grid of cells is given as follows. Write a program to displa

ID: 3695895 • Letter: T

Question

The two-dimensional grid of cells is given as follows. Write a program to display the path through a maze using backtracking. The starting point is (0.0) and the exit point is (6,6). When you find a path, all cells on the path is set to the BREAD. Your program should print the sequence of the BREADs. Change the initial image to have no barrier cells. Test with no barrier cells at all. When you find a path, all cell on the path is set to the BREAD. Your program should print the sequence of the BREADs. Change the initial image to have a harrier at the exit point (6.6). Test a barrier at the exit point Submit your source code and output to the dropbox of WestemOnline.

Explanation / Answer

public class Maze { private int N; // dimension of maze private boolean[][] north; // is there a wall to north of cell i, j private boolean[][] east; private boolean[][] south; private boolean[][] west; private boolean[][] visited; private boolean done = false; public Maze(int N) { this.N = N; StdDraw.setXscale(0, N+2); StdDraw.setYscale(0, N+2); init(); generate(); } private void init() { // initialize border cells as already visited visited = new boolean[N+2][N+2]; for (int x = 0; x