daily pastebin goal
24%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MazeStructure {
  2.    
  3.     private static char[][] maze;
  4.  
  5.     public MazeStructure(char[][]maze){
  6.         this.maze = maze;
  7.     }
  8.     public static void main(String[] args) {
  9.        
  10.         char[][] mazeStructure  =
  11.             {{'*','*','*','*','*','*','*','*','*','*','*','*','*','*'},
  12.             {'*',' ',' ',' ',' ','*','*','*','*','*','*','*','*','*'},
  13.             {'*','*','*','*',' ',' ',' ',' ',' ',' ','*','*','*','*'},
  14.             {'*','*','*','*','*','*',' ','*','*',' ','*','*','*','*'},
  15.             {'*','*','*','*','*','*',' ','*','*',' ',' ',' ','*','*'},
  16.             {'*','*','*','*',' ',' ',' ','*','*',' ','*',' ','*','*'},
  17.             {'*',' ',' ',' ',' ','*','*','*','*',' ',' ',' ','*','*'},
  18.             {'*','*',' ','*','*','*','*','*','*','*','*','*','*','*'},
  19.             {'*','*',' ',' ',' ','*','*','*','*','*','*','*','*','*'},
  20.             {'*','*','*',' ',' ',' ','*','*','*','*','*','*','*','*'},
  21.             {'*','*','*','*','*',' ','*','*','*','*','*','*','*','*'},
  22.             {'*','*','*',' ',' ',' ',' ',' ','*','*','*','*','*','*'},
  23.             {'*','*','*',' ','*','*','*',' ',' ',' ',' ',' ',' ','*'},
  24.             {'*','*','*','*','*','*','*','*','*','*','*','*',' ',' '},
  25.             {'*','*','*','*','*','*','*','*','*','*','*','*','*',' '}};
  26.        
  27.         for(int i = 0; i < mazeStructure.length; i++){
  28.             System.out.println(mazeStructure[i]);
  29.                
  30.         }
  31.     }
  32.  
  33.     public static boolean canEscape(int row, int column ){
  34.         char toRight = maze [row][column + 1];
  35.         /*  char start[][] = new char[1][1]; //starting point ???
  36.         char toLeft = maze [row][column -1];
  37.         char down = maze [row + 1][column];
  38.         char up = maze [row - 1][column];*/
  39.        
  40.         char current = maze [row][column];//???
  41.        
  42.         canEscape(row, column+1);//to the right
  43.         canEscape(row, column-1);//to the left
  44.         canEscape(row+1, column);// down
  45.         canEscape(row-1, column);//up
  46.        
  47.        
  48.         if(current == 'X'){
  49.             return true;
  50.         }
  51.        
  52.         if(current == '*'){
  53.             return false;
  54.         }
  55.        
  56.         if(current == ' '){
  57.             maze[row][column] = '.';
  58.         }
  59.        
  60.         if(current == 'S'){
  61.            
  62.         }
  63.        
  64.     }
  65.    
  66.    
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top