2022-03-11 12:08:17 +01:00
|
|
|
package ch.zhaw.pm2.racetrack;
|
|
|
|
|
|
|
|
import java.io.FileNotFoundException;
|
2022-03-18 13:34:51 +01:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2022-03-11 12:08:17 +01:00
|
|
|
|
|
|
|
public class Main {
|
|
|
|
|
2022-03-18 10:19:23 +01:00
|
|
|
public static void main(String[] args) throws InvalidTrackFormatException, FileNotFoundException, PositionVectorNotValid {
|
2022-03-18 13:34:51 +01:00
|
|
|
boolean exit = false;
|
2022-03-18 16:13:37 +01:00
|
|
|
UserInterface userInterface = new UserInterface("Hello and Welcome");
|
2022-03-18 13:34:51 +01:00
|
|
|
while (!exit) {
|
|
|
|
Game game = new Game(userInterface);
|
|
|
|
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;
|
|
|
|
}
|
2022-03-11 12:08:17 +01:00
|
|
|
}
|
2022-03-18 16:13:37 +01:00
|
|
|
userInterface.printInformation("Thank you and goodbye");
|
2022-03-11 12:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|