mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-06-27 11:44:42 +02:00
Fikser noen problemer
Fikser et problem der kortvelgingsmenyen ikke dukker opp på når sending av elementer går for raskt Fikser tilstand til kortvelgingsskjermen slik at en ikke mister valgte kort når en ser på brettet Fikser problemer med å fjerne døde spillere Avslutter spillet på korrekt måte når alle spillere er døde Fjerner udp portnummer siden UDP ikke blir brukt
This commit is contained in:
@ -24,6 +24,11 @@ public class FakeGame implements InteractableGame {
|
||||
return winningPlayerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWinningPlayerName(String winningPlayerName) {
|
||||
this.winningPlayerName = winningPlayerName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveAllPrograms(ProgamsContainer programs) throws InterruptedException {
|
||||
//Not needed for testing
|
||||
@ -58,9 +63,4 @@ public class FakeGame implements InteractableGame {
|
||||
public void setProgram(List<ProgrammingCard> program) {
|
||||
//Not needed for testing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWinningPlayerName(String winningPlayerName) {
|
||||
this.winningPlayerName = winningPlayerName;
|
||||
}
|
||||
}
|
||||
|
@ -14,14 +14,15 @@ import java.util.List;
|
||||
import static junit.framework.TestCase.*;
|
||||
|
||||
public class PhaseTest {
|
||||
List<Robot> robots = new ArrayList<>();
|
||||
private Phase phase;
|
||||
private Board board;
|
||||
private Position robot1Position = new Position(2, 2);
|
||||
private Position robot2Position = new Position(3, 2);
|
||||
private Position robot3Position = new Position(7 , 2);
|
||||
private Position robot4Position = new Position(3 , 8);
|
||||
private Position robot5Position = new Position(2 , 14);
|
||||
private Position robot6Position = new Position(2 , 15);
|
||||
private Position robot3Position = new Position(7, 2);
|
||||
private Position robot4Position = new Position(3, 8);
|
||||
private Position robot5Position = new Position(2, 14);
|
||||
private Position robot6Position = new Position(2, 15);
|
||||
private Robot robot1 = new Robot(RobotID.ROBOT_1, robot1Position);
|
||||
private Robot robot2 = new Robot(RobotID.ROBOT_2, robot2Position);
|
||||
private Robot robot3 = new Robot(RobotID.ROBOT_3, robot3Position);
|
||||
@ -35,8 +36,6 @@ public class PhaseTest {
|
||||
private Player player5 = new Player(RobotID.ROBOT_5, "Player 5");
|
||||
private Player player6 = new Player(RobotID.ROBOT_6, "Player 6");
|
||||
|
||||
List<Robot> robots = new ArrayList<>();
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
robots.add(robot1);
|
||||
@ -72,7 +71,7 @@ public class PhaseTest {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> robot = new ArrayList<>();
|
||||
List<Player> player = new ArrayList<>();
|
||||
robot.add(new Robot(RobotID.ROBOT_1, new Position(0,0)));
|
||||
robot.add(new Robot(RobotID.ROBOT_1, new Position(0, 0)));
|
||||
player.add(new Player(RobotID.ROBOT_1, "Player 1"));
|
||||
|
||||
try {
|
||||
@ -86,7 +85,7 @@ public class PhaseTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotRegistersFlagWhenOnCorrectOne() {
|
||||
public void robotRegistersFlagWhenOnCorrectOne() {
|
||||
assertEquals(robot3.getLastFlagVisited(), 0);
|
||||
assertFalse(robot3.hasTouchedFlagThisTurn());
|
||||
phase.checkAllFlags();
|
||||
@ -107,7 +106,7 @@ public class PhaseTest {
|
||||
public void actionDoesPerformAnAction() throws InterruptedException {
|
||||
assertEquals(robot4.getRobotId(), board.getRobotOnPosition(robot4Position));
|
||||
phase.makeMove(RobotID.ROBOT_4, Action.MOVE_1);
|
||||
assertEquals(robot4.getRobotId(),board.getRobotOnPosition(new Position(3, 7)));
|
||||
assertEquals(robot4.getRobotId(), board.getRobotOnPosition(new Position(3, 7)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -126,7 +125,7 @@ public class PhaseTest {
|
||||
ProgrammingCard card9 = new ProgrammingCard(13, Action.MOVE_1);
|
||||
ProgrammingCard card10 = new ProgrammingCard(14, Action.MOVE_1);
|
||||
ProgrammingCard card11 = new ProgrammingCard(100, Action.ROTATE_LEFT);
|
||||
ProgrammingCard card12= new ProgrammingCard(200, Action.ROTATE_LEFT);
|
||||
ProgrammingCard card12 = new ProgrammingCard(200, Action.ROTATE_LEFT);
|
||||
ProgrammingCard card13 = new ProgrammingCard(300, Action.ROTATE_LEFT);
|
||||
ProgrammingCard card14 = new ProgrammingCard(400, Action.ROTATE_LEFT);
|
||||
ProgrammingCard card15 = new ProgrammingCard(500, Action.ROTATE_LEFT);
|
||||
|
Reference in New Issue
Block a user