diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Game.java b/src/main/java/ch/zhaw/pm2/racetrack/Game.java index 2136aed..d3b2ee1 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Game.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Game.java @@ -122,7 +122,7 @@ public class Game implements GameSpecification { @Override public int getWinner() { // TODO: implementation - throw new UnsupportedOperationException(); + return NO_WINNER; } /** @@ -168,14 +168,16 @@ public class Game implements GameSpecification { track.carDoesCrash(currentCarIndex, crashPosition); } else { - track.getCar(currentCarIndex).move(); + track.moveCar(currentCarIndex); } } public void gamePhase() { do{ userInterface.printTrack(track); - doCarTurn(userInterface.selectDirection(currentCarIndex, track.getCarId(currentCarIndex))); + track.getCar(currentCarIndex).getMoveStrategy(); //TODO Movestrategy berücksichtigen ?? + Direction direction = userInterface.selectDirection(currentCarIndex, track.getCarId(currentCarIndex)); + doCarTurn(direction); if(getWinner() != NO_WINNER) { return; } diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Main.java b/src/main/java/ch/zhaw/pm2/racetrack/Main.java new file mode 100644 index 0000000..a646252 --- /dev/null +++ b/src/main/java/ch/zhaw/pm2/racetrack/Main.java @@ -0,0 +1,17 @@ +package ch.zhaw.pm2.racetrack; + +import java.io.FileNotFoundException; + +public class Main { + + public static void main(String[] args) throws InvalidTrackFormatException, FileNotFoundException { + UserInterface userInterface = new UserInterface("Hello and Welcome"); + Game game = new Game(userInterface); + + if(game.initPhase()){ + game.gamePhase(); + int winner = game.getWinner(); + } + } + +}