optimized Main Class. added Method quit to UserInterface.java
This commit is contained in:
@@ -190,7 +190,7 @@ public class Game implements GameSpecification {
|
||||
}
|
||||
}
|
||||
|
||||
public int gamePhase() throws PositionVectorNotValid {
|
||||
public String gamePhase() throws PositionVectorNotValid {
|
||||
while (CarsMoving() && getWinner() == NO_WINNER) {
|
||||
userInterface.printTrack(track);
|
||||
Direction direction = null;
|
||||
@@ -203,7 +203,11 @@ public class Game implements GameSpecification {
|
||||
switchToNextActiveCar();
|
||||
}
|
||||
userInterface.printTrack(track);
|
||||
return getWinner();
|
||||
int indexWinner = getWinner();
|
||||
if(indexWinner == NO_WINNER){
|
||||
return null;
|
||||
}
|
||||
return String.valueOf(track.getCar(indexWinner).getID());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user