fixes in Game.java Method gamePhase
This commit is contained in:
parent
e5f45b7bb1
commit
63204a4b29
|
@ -179,17 +179,17 @@ public class Game implements GameSpecification {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int gamePhase() throws PositionVectorNotValid {
|
public int gamePhase() throws PositionVectorNotValid {
|
||||||
do{
|
while (getWinner() == NO_WINNER) {
|
||||||
userInterface.printTrack(track);
|
userInterface.printTrack(track);
|
||||||
Direction direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove();
|
Direction direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove();
|
||||||
doCarTurn(direction);
|
doCarTurn(direction);
|
||||||
int winner = getWinner();
|
int winner = getWinner();
|
||||||
if(winner != NO_WINNER) {
|
if(allCarsCrashed()) {
|
||||||
return winner;
|
return NO_WINNER;
|
||||||
}
|
}
|
||||||
switchToNextActiveCar();
|
switchToNextActiveCar();
|
||||||
} while (!allCarsCrashed());
|
}
|
||||||
return NO_WINNER;
|
return getWinner();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue