diff --git a/follower/challenge_points.txt b/follower/challenge_points.txt index d794046..4d7fec6 100644 --- a/follower/challenge_points.txt +++ b/follower/challenge_points.txt @@ -1,3 +1,7 @@ +(X:28, Y:22) +(X:31, Y:22) +(X:34, Y:22) +(X:37, Y:22) (X:40, Y:22) (X:43, Y:22) (X:46, Y:21) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index 9c18c24..0ac8d9e 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -99,7 +99,7 @@ public class Game implements GameSpecification { } if (selectedFile != null) { try { - moveStrategy = new PathFollowerMoveStrategy(selectedFile, track.getCarPos(currentCarIndex)); + moveStrategy = new PathFollowerMoveStrategy(selectedFile, track.getCarPos(i)); } catch (FileNotFoundException e) { e.printStackTrace(); userInterface.printInformation("There is no Point-List implemented. Choose another Strategy!"); diff --git a/src/main/java/ch/zhaw/pm2/racetrack/InvalidFileFormatException.java b/src/main/java/ch/zhaw/pm2/racetrack/InvalidFileFormatException.java index f530593..22b7126 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/InvalidFileFormatException.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/InvalidFileFormatException.java @@ -4,8 +4,8 @@ package ch.zhaw.pm2.racetrack; * Class for Exception when invalid Fileformat is used. */ public class InvalidFileFormatException extends Exception { - public InvalidFileFormatException(){super();} public InvalidFileFormatException(String errorMessage) { super(errorMessage); } + public InvalidFileFormatException(){super();} } diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index 38c2a37..e1d0ca5 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -115,7 +115,7 @@ public class Track implements TrackSpecification { char possibleCarChar = line.charAt(xPosition); if (!allSpaceTypesAsChar.contains(possibleCarChar)) { if (usedSymbolForCar.contains(possibleCarChar)) { - throw new InvalidTrackFormatException(); + throw new InvalidTrackFormatException("More than one car on track!"); } usedSymbolForCar.add(possibleCarChar); cars.add(new Car(possibleCarChar, new PositionVector(xPosition, yPosition))); @@ -143,12 +143,12 @@ public class Track implements TrackSpecification { } } if (finishLine.size() == 0) { - throw new InvalidTrackFormatException(); + throw new InvalidTrackFormatException("No finish line found!"); } finishTyp = getSpaceType(finishLine.get(0)); for (PositionVector positionVector : finishLine) { if (getSpaceType(positionVector) != finishTyp) { - throw new InvalidTrackFormatException(); + throw new InvalidTrackFormatException("Inconsistent finish line found!"); } } }