Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class TestMazeDFS {
- private static int[][] maze = {
- {1, 1, 1, 1, 1, 1, 1, 1, 1},
- {1, 0, 0, 0, 0, 0, 0, 0, 1},
- {1, 0, 1, 0, 1, 1, 1, 1, 1},
- {1, 0, 1, 0, 0, 0, 0, 0, 1},
- {1, 1, 1, 1, 1, 0, 1, 0, 1},
- {1, 0, 0, 0, 1, 0, 1, 0, 1},
- {1, 0, 1, 1, 1, 1, 1, 0, 1},
- {1, 0, 0, 0, 0, 0, 0 ,3, 1},
- {1, 1, 1, 1, 1, 1, 1, 1, 1},
- };
- public int[][] getMaze(){
- return this.maze;
- }
- // prints the maze.
- public static void printMaze() {
- for (int i = 0; i < 9; i++) {
- for (int j = 0; j < 9; j++) {
- // if (maze[i][j] == 1) {
- // System.out.print('#');
- // } else {
- // System.out.print(' ');
- // }
- System.out.print(maze[i][j]);
- }
- System.out.println();
- }
- System.out.println();
- }
- public static void main(String[] args) {
- TestMazeDFS maze = new TestMazeDFS();
- boolean test = DFS.solve(maze.getMaze(), 1, 1);
- System.out.println(test);
- printMaze();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement