public static void main(String[] args) throws IOException { System.out.println("Welcome to Pac Man problem !!"); Pacman obj = new Pacman(); int selection = Integer.parseInt(args[0]); String[] files = { "smallSearch.txt", "trickySearch.txt", }; File mazeFile = new File(files[selection]); BufferedReader br = new BufferedReader(new FileReader(mazeFile)); String line; int M = 0; int N = 0; while ((line = br.readLine()) != null) { M++; String[] items = line.split(""); N = items.length; } br.close(); char[][] maze = new char[M][N]; // Initialize start point and read maze obj.readMaze(mazeFile, maze, start); // Print maze obj.printMaze(maze); // Get goals for the start state start.goals = obj.goals(maze); // Run A star search obj.astar(maze); }