fixed typos in several classes
This commit is contained in:
@@ -97,7 +97,7 @@ public class Car implements CarSpecification {
|
||||
/**
|
||||
* Set this Car position directly, regardless of current position and velocity.
|
||||
* This should only be used by the game controller in rare cases to set the crash or winning position.
|
||||
* The next position is normaly automatically calculated and set in the {@link #move()} method.
|
||||
* The next position is normally automatically calculated and set in the {@link #move()} method.
|
||||
*
|
||||
* @param position The new position to set the car directly to.
|
||||
* @throws IllegalArgumentException if invalid PositionVector is given.
|
||||
|
||||
@@ -6,7 +6,6 @@ import ch.zhaw.pm2.racetrack.strategy.*;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static ch.zhaw.pm2.racetrack.PositionVector.Direction;
|
||||
@@ -36,16 +35,15 @@ public class Game implements GameSpecification {
|
||||
public boolean initPhase() {
|
||||
if (config.getTrackDirectory().listFiles().length > 0) {
|
||||
List<String> tracks = new ArrayList<>();
|
||||
tracks.addAll(Arrays.asList(config.getTrackDirectory().list()));
|
||||
|
||||
File selectedTrack = config.getTrackDirectory().listFiles()[userInterface.selectOption("Select Track file", tracks)];
|
||||
try {
|
||||
selectTrack(selectedTrack);
|
||||
} catch (FileNotFoundException e) {
|
||||
userInterface.printInformation("There is an unexpected Error with the trackfile Path. Add trackfiles only to tracks path. Exit the Game and Fix the Problem");
|
||||
userInterface.printInformation("There is an unexpected Error with the track file Path. Add track files only to tracks path. Exit the Game and Fix the Problem");
|
||||
return false;
|
||||
} catch (InvalidTrackFormatException e) {
|
||||
userInterface.printInformation("There is an unexpected Error with the trackfile. Format does not match specifications! Exit the Game and Fix the Problem");
|
||||
userInterface.printInformation("There is an unexpected Error with the track file. Format does not match specifications! Exit the Game and Fix the Problem");
|
||||
return false;
|
||||
}
|
||||
List<String> moveStrategies = new ArrayList<>();
|
||||
|
||||
@@ -55,7 +55,7 @@ import java.util.Scanner;
|
||||
* <li>the file contains more than {@link Config#MAX_CARS} cars</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>The Track can return a String representing the current state of the race (including car positons)</p>
|
||||
* <p>The Track can return a String representing the current state of the race (including car positions)</p>
|
||||
*/
|
||||
public class Track implements TrackSpecification {
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Track implements TrackSpecification {
|
||||
*
|
||||
* @param trackFile Reference to a file containing the track data
|
||||
* @throws FileNotFoundException if the given track file could not be found
|
||||
* @throws InvalidTrackFormatException if the track file contains invalid data (no tracklines, ...)
|
||||
* @throws InvalidTrackFormatException if the track file contains invalid data (no track lines, ...)
|
||||
*/
|
||||
public Track(File trackFile) throws FileNotFoundException, InvalidTrackFormatException {
|
||||
track = new ArrayList<>();
|
||||
@@ -185,7 +185,7 @@ public class Track implements TrackSpecification {
|
||||
}
|
||||
|
||||
/**
|
||||
* Method that returns the finishline as a List
|
||||
* Method that returns the finish line as a List
|
||||
*
|
||||
* @return finishLine List
|
||||
*/
|
||||
@@ -224,7 +224,7 @@ public class Track implements TrackSpecification {
|
||||
//Removes the Car at Current Pos
|
||||
drawCharOnTrackIndicator(carPositionVector, ConfigSpecification.SpaceType.TRACK.getValue());
|
||||
|
||||
//Redraw finishline if Car was on finish-line Position
|
||||
//Redraw finish line if Car was on finish-line Position
|
||||
for (PositionVector finishLinePositionVector : finishLine) {
|
||||
if (finishLinePositionVector.equals(carPositionVector)) {
|
||||
drawCharOnTrackIndicator(carPositionVector, finishTyp.getValue());
|
||||
@@ -347,7 +347,7 @@ public class Track implements TrackSpecification {
|
||||
* If there is a crashed car at the position, {@link #CRASH_INDICATOR} is returned.
|
||||
*
|
||||
* @param y position Y-value
|
||||
* @param x position X-vlaue
|
||||
* @param x position X-value
|
||||
* @param currentSpace char to return if no car is at position (x,y)
|
||||
* @return character representing position (x,y) on the track
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,7 @@ public class PathFinderMoveStrategy implements MoveStrategy {
|
||||
|
||||
}
|
||||
|
||||
// while no PossibleMove crosses the finishline
|
||||
// while no PossibleMove crosses the finish line
|
||||
// every PossibleMove will be accelerated in each direction to find a Move which finishes.
|
||||
while (finishedMove == null) {
|
||||
List<PossibleMove> newMoves = new ArrayList<>();
|
||||
@@ -164,9 +164,9 @@ public class PathFinderMoveStrategy implements MoveStrategy {
|
||||
}
|
||||
|
||||
/**
|
||||
* check if the finishline is crossed (in correct direction) if this move is executed
|
||||
* check if the finish line is crossed (in correct direction) if this move is executed
|
||||
*
|
||||
* @return true if finishline will be crossed
|
||||
* @return true if finish line will be crossed
|
||||
*/
|
||||
public boolean finished() {
|
||||
return track.calculateNewWinPoints(startPosition, endPosition) == 1;
|
||||
|
||||
Reference in New Issue
Block a user