fixes in Game.java and UserInterface.java
This commit is contained in:
parent
a723ea16ec
commit
e5f45b7bb1
|
@ -187,6 +187,7 @@ public class Game implements GameSpecification {
|
||||||
if(winner != NO_WINNER) {
|
if(winner != NO_WINNER) {
|
||||||
return winner;
|
return winner;
|
||||||
}
|
}
|
||||||
|
switchToNextActiveCar();
|
||||||
} while (!allCarsCrashed());
|
} while (!allCarsCrashed());
|
||||||
return NO_WINNER;
|
return NO_WINNER;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,11 @@ public class Main {
|
||||||
public static void main(String[] args) throws InvalidTrackFormatException, FileNotFoundException, PositionVectorNotValid {
|
public static void main(String[] args) throws InvalidTrackFormatException, FileNotFoundException, PositionVectorNotValid {
|
||||||
UserInterface userInterface = new UserInterface("Hello and Welcome");
|
UserInterface userInterface = new UserInterface("Hello and Welcome");
|
||||||
Game game = new Game(userInterface);
|
Game game = new Game(userInterface);
|
||||||
|
int winner = 0;
|
||||||
if(game.initPhase()){
|
if(game.initPhase()){
|
||||||
int winner = game.gamePhase();
|
winner = game.gamePhase();
|
||||||
}
|
}
|
||||||
|
userInterface.printInformation("Winner: " + winner);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class UserInterface {
|
||||||
*/
|
*/
|
||||||
public PositionVector.Direction selectDirection(int playingCarIndex, char playingCarID) {
|
public PositionVector.Direction selectDirection(int playingCarIndex, char playingCarID) {
|
||||||
PositionVector.Direction direction = null;
|
PositionVector.Direction direction = null;
|
||||||
textTerminal.println("Playing Car " + playingCarIndex + ": " + playingCarIndex);
|
textTerminal.println("Playing Car " + playingCarIndex + ": " + playingCarID);
|
||||||
textTerminal.println("Directions are based on the number pad:");
|
textTerminal.println("Directions are based on the number pad:");
|
||||||
textTerminal.println("7 8 9 7=up-left, 8=up, 9=up-right");
|
textTerminal.println("7 8 9 7=up-left, 8=up, 9=up-right");
|
||||||
textTerminal.println("4 5 6 4=left, 5=no acceleration, 6=right");
|
textTerminal.println("4 5 6 4=left, 5=no acceleration, 6=right");
|
||||||
|
|
Loading…
Reference in New Issue