This commit is contained in:
Steinar Aalstad Lillesund
2020-03-24 14:28:49 +01:00
2 changed files with 53 additions and 0 deletions

View File

@@ -106,6 +106,7 @@ public class RoboRallyGame implements IDrawableGame {
robots.add(new Robot(RobotID.ROBOT_6, new Position(7, 7)));
robots.add(new Robot(RobotID.ROBOT_7, new Position(6, 7)));
robots.add(new Robot(RobotID.ROBOT_8, new Position(6, 8)));
playerList = new ArrayList<>();
playerList.add(new Player(RobotID.ROBOT_1, "Player1"));
playerList.add(new Player(RobotID.ROBOT_2, "Player2"));
playerList.add(new Player(RobotID.ROBOT_3, "Player3"));
@@ -177,6 +178,21 @@ public class RoboRallyGame implements IDrawableGame {
makeMove(RobotID.ROBOT_7, Action.MOVE_1);
}
/**
* Runs one phase as defined in the Robo Rally rulebook
* @param phaseNumber The number of the phase to run
* @throws InterruptedException If interrupted wile trying to sleep
*/
private void runPhase(int phaseNumber) throws InterruptedException {
runProgramCards(phaseNumber);
moveAllConveyorBelts();
rotateCogwheels();
fireAllLasers();
checkAllFlags();
}
/**
* Makes the given robot move according to to the action input.
* @param robotID The ID of the robot to move.