fixes in Game.java Method gamePhase

This commit is contained in:
romanschenk37 2022-03-18 10:43:22 +01:00
parent e5f45b7bb1
commit 63204a4b29
1 changed files with 5 additions and 5 deletions

View File

@ -179,17 +179,17 @@ public class Game implements GameSpecification {
}
public int gamePhase() throws PositionVectorNotValid {
do{
while (getWinner() == NO_WINNER) {
userInterface.printTrack(track);
Direction direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove();
doCarTurn(direction);
int winner = getWinner();
if(winner != NO_WINNER) {
return winner;
if(allCarsCrashed()) {
return NO_WINNER;
}
switchToNextActiveCar();
} while (!allCarsCrashed());
return NO_WINNER;
}
return getWinner();
}
/**