Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MazeStructure {
- private static char[][] maze;
- public MazeStructure(char[][]maze){
- this.maze = maze;
- }
- public static void main(String[] args) {
- char[][] mazeStructure =
- {{'*','*','*','*','*','*','*','*','*','*','*','*','*','*'},
- {'*',' ',' ',' ',' ','*','*','*','*','*','*','*','*','*'},
- {'*','*','*','*',' ',' ',' ',' ',' ',' ','*','*','*','*'},
- {'*','*','*','*','*','*',' ','*','*',' ','*','*','*','*'},
- {'*','*','*','*','*','*',' ','*','*',' ',' ',' ','*','*'},
- {'*','*','*','*',' ',' ',' ','*','*',' ','*',' ','*','*'},
- {'*',' ',' ',' ',' ','*','*','*','*',' ',' ',' ','*','*'},
- {'*','*',' ','*','*','*','*','*','*','*','*','*','*','*'},
- {'*','*',' ',' ',' ','*','*','*','*','*','*','*','*','*'},
- {'*','*','*',' ',' ',' ','*','*','*','*','*','*','*','*'},
- {'*','*','*','*','*',' ','*','*','*','*','*','*','*','*'},
- {'*','*','*',' ',' ',' ',' ',' ','*','*','*','*','*','*'},
- {'*','*','*',' ','*','*','*',' ',' ',' ',' ',' ',' ','*'},
- {'*','*','*','*','*','*','*','*','*','*','*','*',' ',' '},
- {'*','*','*','*','*','*','*','*','*','*','*','*','*',' '}};
- for(int i = 0; i < mazeStructure.length; i++){
- System.out.println(mazeStructure[i]);
- }
- }
- public static boolean canEscape(int row, int column ){
- char toRight = maze [row][column + 1];
- /* char start[][] = new char[1][1]; //starting point ???
- char toLeft = maze [row][column -1];
- char down = maze [row + 1][column];
- char up = maze [row - 1][column];*/
- char current = maze [row][column];//???
- canEscape(row, column+1);//to the right
- canEscape(row, column-1);//to the left
- canEscape(row+1, column);// down
- canEscape(row-1, column);//up
- if(current == 'X'){
- return true;
- }
- if(current == '*'){
- return false;
- }
- if(current == ' '){
- maze[row][column] = '.';
- }
- if(current == 'S'){
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement