Game #23

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

View File

@ -189,7 +189,12 @@ public class Game implements GameSpecification {
public int gamePhase() throws PositionVectorNotValid { public int gamePhase() throws PositionVectorNotValid {
while (CarsMoving() && getWinner() == NO_WINNER) { while (CarsMoving() && getWinner() == NO_WINNER) {
userInterface.printTrack(track); userInterface.printTrack(track);
Direction direction = track.getCar(currentCarIndex).getMoveStrategy().nextMove(); Direction direction = null;
direction= track.getCar(currentCarIndex).getMoveStrategy().nextMove();
if(direction == null) {
track.getCar(currentCarIndex).setMoveStrategy(new DoNotMoveStrategy());
direction= track.getCar(currentCarIndex).getMoveStrategy().nextMove();
}
doCarTurn(direction); doCarTurn(direction);
switchToNextActiveCar(); switchToNextActiveCar();
} }