mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
removed the the update respawn location of the robot from the function
This commit is contained in:
parent
a886b5e23d
commit
c137208ce5
@ -443,7 +443,7 @@ public class Board {
|
|||||||
Robot robot = robots.get(robotID);
|
Robot robot = robots.get(robotID);
|
||||||
int flagNr = flagID.getTileTypeID() % 16;
|
int flagNr = flagID.getTileTypeID() % 16;
|
||||||
if (flagNr - 1 == robot.getLastFlagVisited()) {
|
if (flagNr - 1 == robot.getLastFlagVisited()) {
|
||||||
robot.setLastFlagVisitedAndUpdateBackupPosition(flagNr);
|
robot.setLastFlagVisited(flagNr);
|
||||||
setHasTouchedFlagThisTurnFromRobotID(robotID, true);
|
setHasTouchedFlagThisTurnFromRobotID(robotID, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,12 +117,8 @@ public class Robot {
|
|||||||
*
|
*
|
||||||
* @param currentFlag The flag the robot is standing on
|
* @param currentFlag The flag the robot is standing on
|
||||||
*/
|
*/
|
||||||
public void setLastFlagVisitedAndUpdateBackupPosition(int currentFlag) {
|
public void setLastFlagVisited(int currentFlag) {
|
||||||
if (currentFlag - 1 != this.lastFlagVisited) {
|
|
||||||
throw new IllegalArgumentException("The robot has not yet visited the previous flag!");
|
|
||||||
}
|
|
||||||
this.lastFlagVisited = currentFlag;
|
this.lastFlagVisited = currentFlag;
|
||||||
this.backupPosition = currentPosition;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,7 +65,7 @@ public class RobotTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRobotGetNewFlag() {
|
public void testRobotGetNewFlag() {
|
||||||
testRobot.setLastFlagVisitedAndUpdateBackupPosition(nextFlag);
|
testRobot.setLastFlagVisited(nextFlag);
|
||||||
assertEquals(1, testRobot.getLastFlagVisited());
|
assertEquals(1, testRobot.getLastFlagVisited());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ public class RobotTest {
|
|||||||
public void testRobotGetNewBackup() {
|
public void testRobotGetNewBackup() {
|
||||||
Position nextFlagPosition = new Position(3, 4);
|
Position nextFlagPosition = new Position(3, 4);
|
||||||
testRobot.setPosition(nextFlagPosition);
|
testRobot.setPosition(nextFlagPosition);
|
||||||
testRobot.setLastFlagVisitedAndUpdateBackupPosition(nextFlag);
|
testRobot.setLastFlagVisited(nextFlag);
|
||||||
assertEquals(nextFlagPosition, testRobot.getBackupPosition());
|
assertEquals(nextFlagPosition, testRobot.getBackupPosition());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user