change in Main.java
This commit is contained in:
parent
268506a084
commit
8dad26006c
|
@ -1,17 +1,28 @@
|
||||||
package ch.zhaw.pm2.racetrack;
|
package ch.zhaw.pm2.racetrack;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Main {
|
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");
|
boolean exit = false;
|
||||||
Game game = new Game(userInterface);
|
while (!exit) {
|
||||||
int winner = 0;
|
UserInterface userInterface = new UserInterface("Hello and Welcome");
|
||||||
if(game.initPhase()){
|
Game game = new Game(userInterface);
|
||||||
winner = game.gamePhase();
|
int winner = 0;
|
||||||
|
if (game.initPhase()) {
|
||||||
|
winner = game.gamePhase();
|
||||||
|
}
|
||||||
|
List<String> optionsNewGame = new ArrayList<>();
|
||||||
|
optionsNewGame.add("exit");
|
||||||
|
optionsNewGame.add("new game");
|
||||||
|
int selectedOption = userInterface.selectOption("The Winner was Car : " + winner + "\nStart new Game?", optionsNewGame);
|
||||||
|
if(selectedOption == 0) {
|
||||||
|
exit = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
userInterface.printInformation("Winner: " + winner);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue