public static void main(String args[]) { int width = IN.nextInt(); int height = IN.nextInt(); IN.nextLine(); System.err.println(width + " " + height); Grid tunnelMap = new Grid(width, height); fillTunelMap(tunnelMap); int exit = IN .nextInt(); // the coordinate along the X axis of the exit (not useful for this first // mission, but must be read). System.err.println(exit); tunnelMap.setEndPosition(new Position(exit, height - 1)); // game loop while (true) { Position IndiActPosition = new Position(IN.nextInt(), IN.nextInt()); Direction entranceDirection = Enum.valueOf(Direction.class, IN.next()); tunnelMap.getRoom(IndiActPosition).setEntrance(entranceDirection); tunnelMap.initializeGrid(); tunnelMap.findPathFromStartToEnd(IndiActPosition); int numberOfRocks = IN.nextInt(); // the number of rocks currently in the grid. for (int i = 0; i < numberOfRocks; i++) { System.err.println(); int XR = IN.nextInt(); int YR = IN.nextInt(); Position rockPosition = new Position(XR, YR); Direction entranceOfRock = Enum.valueOf(Direction.class, IN.next()); tunnelMap.getRoom(rockPosition).setEntrance(entranceOfRock); tunnelMap.compareRockPathWithIndisPath(rockPosition); System.err.println("ROCK " + rockPosition + " " + entranceOfRock); } String command = tunnelMap.nextCommand(); // One line containing the X Y coordinates of the room in which you believe Indy will be on // the next turn. System.out.println(command); } }