Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. public static void main(String[] args) {
  2. String x;
  3. String y;
  4. Scanner fileName = null;
  5. try {
  6. fileName = new Scanner(new File("C:/Users/TOSHIBA/Desktop/maze21.txt"));
  7. } catch (FileNotFoundException e) {
  8. e.printStackTrace();
  9. }
  10. List<String> tempList = new ArrayList<>();
  11.  
  12. while (fileName.hasNextLine()) {
  13. String line = fileName.nextLine();
  14. tempList.add(line);
  15. }
  16.  
  17. x = fileName.nextLine();
  18. y = fileName.nextLine();
  19. int row = x.length();
  20. int column = y.length();
  21.  
  22. boolean[][] cells = new boolean[tempList.size()][tempList.get(0).length()];
  23.  
  24. String finalX = fileName.nextLine();
  25. String finalY = fileName.nextLine();
  26. cells[finalX.length()][finalY.length()] = true;
  27.  
  28. for (int i = 0; i < cells.length; i++) {
  29. for (int j = 0; j < cells[i].length; j++) {
  30. if (cells[i][j])
  31. System.out.print("#");
  32. else
  33. System.out.print(" ");
  34. }
  35. System.out.println();
  36. }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement