import java.io.*; import java.util.Scanner; public class Maze { private final static int MAXROW = 12; private final static int MAXCOL = 12; private final static char BLANK = ' '; public void loadMaze(char[][] maze) { try { String dataFileName = "mazeData.txt"; FileReader reader = new FileReader(dataFileName); Scanner sf = new Scanner(reader); for (int row=1; row<=MAXROW; row++) { String line = sf.nextLine(); for (int col = 1; col<=MAXCOL; col++) { maze[row][col] = line.charAt(col-1); } } sf.close(); } catch(IOException e) { System.out.println("File problems."); } } public void printMaze(char[][] maze) throws IOException { PrintWriter outfile = new PrintWriter (new FileWriter("outfile.txt")); System.out.println(" 123456789012"); for (int row=1; row<=MAXROW; row++) { System.out.print (row %10 + " "); for (int col=1; col<=MAXCOL; col++) { System.out.print("" + maze[row][col]); outfile.print("" + maze[row][col]); } System.out.println(); outfile.println(); } outfile.close(); System.out.println(); } public void traceMaze(char[][] maze, int row, int col) throws IOException { char[][] mazeCopy = new char[maze.length][maze[0].length]; for (int r=0; r