mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 15:19:35 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
05a92ff9a0
12
docs/team/referater/referat_21_04_2020.md
Normal file
12
docs/team/referater/referat_21_04_2020.md
Normal file
@ -0,0 +1,12 @@
|
||||
## Oppmøte
|
||||
Tilstede: Steinar, Gabriel, Kristian, Torbjørn, Petter
|
||||
Ikke tilstede:
|
||||
|
||||
## Agenda
|
||||
- Fortsette arbeidet med MVP
|
||||
|
||||
- Et gruppemedlem skal ha møte med foreleser, skal oppdatere gruppen på hva som blir avgjort her
|
||||
|
||||
## Møte
|
||||
Vi starter å fortsette arbeidet vi holdt på me fra sist gang med en gang. Et gruppemedlem drar på møte me
|
||||
foreleser og oppdaterer gruppen på hva som ble snakket om der.
|
@ -1,6 +1,7 @@
|
||||
package inf112.fiasko.roborally.objects;
|
||||
|
||||
import inf112.fiasko.roborally.elementproperties.Action;
|
||||
import inf112.fiasko.roborally.elementproperties.Direction;
|
||||
import inf112.fiasko.roborally.elementproperties.Position;
|
||||
import inf112.fiasko.roborally.elementproperties.RobotID;
|
||||
import inf112.fiasko.roborally.utility.BoardLoaderUtil;
|
||||
@ -109,6 +110,159 @@ public class PhaseTest {
|
||||
assertEquals(robot4.getRobotId(), board.getRobotOnPosition(new Position(3, 7)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotFiresLaserAndHitsAnotherRobot() throws InterruptedException {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> bot = new ArrayList<>();
|
||||
List<Player> botPlayer = new ArrayList<>();
|
||||
Position bot1Position = new Position(9, 12);
|
||||
Position bot2Position = new Position(9, 13);
|
||||
Robot bot1 = new Robot(RobotID.ROBOT_1, bot1Position);
|
||||
Robot bot2 = new Robot(RobotID.ROBOT_2, bot2Position);
|
||||
bot.add(bot1);
|
||||
bot.add(bot2);
|
||||
Player botPlayer1 = new Player(RobotID.ROBOT_1, "Player 1");
|
||||
Player botPlayer2 = new Player(RobotID.ROBOT_2, "Player 2");
|
||||
botPlayer.add(botPlayer1);
|
||||
botPlayer.add(botPlayer2);
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/another_test_map.txt", bot);
|
||||
Phase testPhase = new Phase(board, botPlayer, 0, testGame);
|
||||
assertEquals(0, bot2.getDamageTaken());
|
||||
assertEquals(0, bot1.getDamageTaken());
|
||||
testPhase.fireAllLasers();
|
||||
assertEquals(0, bot2.getDamageTaken());
|
||||
assertEquals(1, bot1.getDamageTaken());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotFiresLaserAndHitsAWallDoesNotDamageRobotOnOtherSide() throws InterruptedException {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> bot = new ArrayList<>();
|
||||
List<Player> botPlayer = new ArrayList<>();
|
||||
Position bot1Position = new Position(9, 11);
|
||||
Position bot2Position = new Position(9, 13);
|
||||
Robot bot1 = new Robot(RobotID.ROBOT_1, bot1Position);
|
||||
Robot bot2 = new Robot(RobotID.ROBOT_2, bot2Position);
|
||||
bot.add(bot1);
|
||||
bot.add(bot2);
|
||||
Player botPlayer1 = new Player(RobotID.ROBOT_1, "Player 1");
|
||||
Player botPlayer2 = new Player(RobotID.ROBOT_2, "Player 2");
|
||||
botPlayer.add(botPlayer1);
|
||||
botPlayer.add(botPlayer2);
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/another_test_map.txt", bot);
|
||||
Phase testPhase = new Phase(board, botPlayer, 0, testGame);
|
||||
assertEquals(0, bot2.getDamageTaken());
|
||||
assertEquals(0, bot1.getDamageTaken());
|
||||
testPhase.fireAllLasers();
|
||||
assertEquals(0, bot2.getDamageTaken());
|
||||
assertEquals(0, bot1.getDamageTaken());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotGetsHitBy2Lasers() throws InterruptedException {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> bot = new ArrayList<>();
|
||||
List<Player> botPlayer = new ArrayList<>();
|
||||
Position bot1Position = new Position(9, 12);
|
||||
Position bot2Position = new Position(9, 13);
|
||||
Position bot3Position = new Position(8, 12);
|
||||
Robot bot1 = new Robot(RobotID.ROBOT_1, bot1Position);
|
||||
Robot bot2 = new Robot(RobotID.ROBOT_2, bot2Position);
|
||||
Robot bot3 = new Robot(RobotID.ROBOT_3, bot3Position);
|
||||
bot.add(bot1);
|
||||
bot.add(bot2);
|
||||
bot.add(bot3);
|
||||
Player botPlayer1 = new Player(RobotID.ROBOT_1, "Player 1");
|
||||
Player botPlayer2 = new Player(RobotID.ROBOT_2, "Player 2");
|
||||
Player botPlayer3 = new Player(RobotID.ROBOT_3, "Player 3");
|
||||
botPlayer.add(botPlayer1);
|
||||
botPlayer.add(botPlayer2);
|
||||
botPlayer.add(botPlayer3);
|
||||
bot3.setFacingDirection(Direction.EAST);
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/another_test_map.txt", bot);
|
||||
Phase testPhase = new Phase(board, botPlayer, 0, testGame);
|
||||
assertEquals(0, bot1.getDamageTaken());
|
||||
testPhase.fireAllLasers();
|
||||
assertEquals(2, bot1.getDamageTaken());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void robotFiresLaserAndHitsARobotDoesNotDamageRobotOnOtherSide() throws InterruptedException {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> bot = new ArrayList<>();
|
||||
List<Player> botPlayer = new ArrayList<>();
|
||||
Position bot1Position = new Position(9, 12);
|
||||
Position bot2Position = new Position(9, 13);
|
||||
Position bot3Position = new Position(9, 14);
|
||||
Robot bot1 = new Robot(RobotID.ROBOT_1, bot1Position);
|
||||
Robot bot2 = new Robot(RobotID.ROBOT_2, bot2Position);
|
||||
Robot bot3 = new Robot(RobotID.ROBOT_3, bot3Position);
|
||||
bot.add(bot1);
|
||||
bot.add(bot2);
|
||||
bot.add(bot3);
|
||||
Player botPlayer1 = new Player(RobotID.ROBOT_1, "Player 1");
|
||||
Player botPlayer2 = new Player(RobotID.ROBOT_2, "Player 2");
|
||||
Player botPlayer3 = new Player(RobotID.ROBOT_3, "Player 3");
|
||||
botPlayer.add(botPlayer1);
|
||||
botPlayer.add(botPlayer2);
|
||||
botPlayer.add(botPlayer3);
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/another_test_map.txt", bot);
|
||||
Phase testPhase = new Phase(board, botPlayer, 0, testGame);
|
||||
assertEquals(0, bot1.getDamageTaken());
|
||||
testPhase.fireAllLasers();
|
||||
assertEquals(1, bot1.getDamageTaken());
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void robotGetsRotatedByCog() throws InterruptedException {
|
||||
FakeGame testGame = new FakeGame();
|
||||
List<Robot> bot = new ArrayList<>();
|
||||
List<Player> botPlayer = new ArrayList<>();
|
||||
Position bot1Position = new Position(0, 0);
|
||||
Position bot2Position = new Position(1, 0);
|
||||
Robot bot1 = new Robot(RobotID.ROBOT_1, bot1Position);
|
||||
Robot bot2 = new Robot(RobotID.ROBOT_2, bot2Position);
|
||||
bot.add(bot1);
|
||||
bot.add(bot2);
|
||||
Player botPlayer1 = new Player(RobotID.ROBOT_1, "Player 1");
|
||||
botPlayer.add(botPlayer1);
|
||||
Player botPlayer2 = new Player(RobotID.ROBOT_2, "Player 2");
|
||||
botPlayer.add(botPlayer2);
|
||||
|
||||
try {
|
||||
board = BoardLoaderUtil.loadBoard("boards/another_test_map.txt", bot);
|
||||
Phase testPhase = new Phase(board, botPlayer, 0, testGame);
|
||||
assertEquals(Direction.NORTH, bot1.getFacingDirection());
|
||||
testPhase.rotateCogwheels();
|
||||
assertEquals(Direction.EAST, bot1.getFacingDirection());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void programmingCardsGetsPlayedInOrder() throws InterruptedException {
|
||||
List<ProgrammingCard> testProgram1 = new ArrayList<>();
|
||||
|
33
src/test/resources/boards/another_test_map.txt
Normal file
33
src/test/resources/boards/another_test_map.txt
Normal file
@ -0,0 +1,33 @@
|
||||
12 16
|
||||
03;1 04;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 21;7
|
||||
01;1 12;3 11;3 11;3 11;3 11;3 11;3 11;3 11;3 11;3 12;5 01;1
|
||||
01;1 11;1 05;3 01;1 05;3 01;1 05;7 17;1 05;7 01;1 11;5 01;1
|
||||
01;1 11;1 01;1 02;1 01;1 05;3 01;1 05;7 01;1 05;7 11;5 01;1
|
||||
01;1 11;1 05;3 01;1 05;3 01;1 02;1 01;1 05;7 01;1 11;5 01;1
|
||||
01;1 11;1 01;1 05;3 01;1 22;7 01;1 05;7 01;1 05;7 11;5 01;1
|
||||
01;1 11;1 05;3 01;1 05;3 01;1 22;7 01;1 02;1 01;1 11;5 01;1
|
||||
01;1 11;1 01;1 05;3 01;1 02;1 01;1 05;7 01;1 05;7 11;5 01;1
|
||||
01;1 11;1 05;3 18;1 05;3 01;1 05;7 01;1 05;7 01;1 11;5 01;1
|
||||
01;1 11;1 01;1 05;3 01;1 05;3 01;1 05;7 01;1 05;7 11;5 01;1
|
||||
01;1 12;1 11;7 11;7 11;7 11;7 11;7 11;7 11;7 11;7 12;7 01;1
|
||||
21;7 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1
|
||||
01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1
|
||||
01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1
|
||||
29;1 27;1 01;1 25;1 01;1 23;1 24;1 01;1 26;1 01;1 28;1 30;1
|
||||
01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1
|
||||
0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0
|
||||
0 0 0 1;5 0 1;5 1;5 0 1;5 0 0 0
|
||||
1;7 0 0 0 0 0 0 0 0 0 0 1;3
|
||||
0 1;3 0 0 0 0 0 0 0 0 1;7 0
|
||||
1;7 0 0 0 0 0 0 0 0 0 0 1;3
|
||||
0 1;3 0 0 0 0 0 0 0 0 1;7 0
|
||||
0 1;3 0 0 0 0 0 0 0 0 1;7 0
|
||||
1;7 0 0 0 0 0 0 0 0 0 0 1;3
|
||||
0 1;3 0 0 0 0 0 0 0 0 1;7 0
|
||||
1;7 0 0 0 0 0 0 0 0 0 0 1;3
|
||||
0 0 0 1;1 0 1;1 1;1 0 1;1 0 0 0
|
||||
0 0 1;5 0 1;5 0 0 1;5 0 1;5 0 0
|
||||
0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0
|
||||
0 0 0 0 0 0 0 0 0 0 0 0
|
||||
0 1;7 0 1;7 0 1;7 1;7 1;7 0 1;7 0 1;7
|
||||
0 0 1;5 0 1;5 0 0 1;5 0 1;5 0 0
|
Loading…
x
Reference in New Issue
Block a user