package boolean hitsArray(CoordinateRow array) { for (int i

package LongestPath;

import java.util.Scanner;
import ui.UserInterfaceFactory;
import ui.LabyrinthUserInterface;
import ui.UIAuxiliaryMethods;

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

class LongestPath {
LabyrinthUserInterface ui;
static final int LABYRINTH_WIDTH = 32;
static final int LABYRINTH_HEIGHT = 24;
static final int LEFT = 1;
static final int RIGHT = 2;
static final int UP = 3;
static final int DOWN = 4;
static final int WAITING_TIME = 10;
Coordinate startCoordinate;
Coordinate endCoordinate;
Coordinate nextPosition;
CoordinateRow tempPath;
CoordinateRow longestPath;
CoordinateRow wall;

LongestPath() {
UserInterfaceFactory.enableLowResolution(true);
ui = UserInterfaceFactory.getLabyrinthUI(LABYRINTH_WIDTH,LABYRINTH_HEIGHT);
}

Coordinate storeCoordinate(Scanner coordinateScanner) {
return new Coordinate(coordinateScanner.nextInt(), coordinateScanner.nextInt());
}

void makeWallArray(Scanner wallScanner) {
wall = new CoordinateRow();
wallScanner.useDelimiter(”
“);
while (wallScanner.hasNext()) {
Scanner wallPieceScanner = new Scanner(wallScanner.next());
wall.addBehind(storeCoordinate(wallPieceScanner));
}
}

void arrangeFile(Scanner fileScanner) {
fileScanner.useDelimiter(“=”);
while (fileScanner.hasNext()) {
startCoordinate = storeCoordinate(new Scanner(fileScanner.next()));
endCoordinate = storeCoordinate(new Scanner(fileScanner.next()));
makeWallArray(new Scanner(fileScanner.next()));
}
}

void initializeLabyrinth() {
for (int i = 0; i longestPath.numberOfElements) {
updateLongestPath();
}
}

boolean hitsArray(CoordinateRow array) {
for (int i = 0; i