Game #23

Merged
schrom01 merged 43 commits from Game into main 2022-03-20 16:56:34 +01:00
1 changed files with 17 additions and 6 deletions
Showing only changes of commit 8dad26006c - Show all commits

View File

@ -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 {
boolean exit = false;
while (!exit) {
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; int winner = 0;
if (game.initPhase()) { if (game.initPhase()) {
winner = game.gamePhase(); winner = game.gamePhase();
} }
userInterface.printInformation("Winner: " + winner); 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;
}
}
} }
} }