diff --git a/docs/team/referater/referat_23_04_2020.md b/docs/team/referater/referat_23_04_2020.md new file mode 100644 index 0000000..326b21f --- /dev/null +++ b/docs/team/referater/referat_23_04_2020.md @@ -0,0 +1,9 @@ +## Oppmøte +Tilstede: Steinar, Gabriel, Kristian, Torbjørn, Petter +Ikke tilstede: + +## Agenda +- Fortsette arbeidet med MVP + +## Møte +Started med engang å fortsette med arbeidet vi har på prosjekt tavlen. \ No newline at end of file diff --git a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/WinnerScreen.java b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/WinnerScreen.java index f1975f3..c5c3c8a 100644 --- a/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/WinnerScreen.java +++ b/src/main/java/inf112/fiasko/roborally/gamewrapper/screens/WinnerScreen.java @@ -50,18 +50,17 @@ public class WinnerScreen extends AbstractScreen { @Override public void render(float delta) { - Gdx.gl.glClearColor(0.2f, 1f, 0.2f, 1); + Gdx.gl.glClearColor(0.2f, 0.2f, 0.2f, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); roboRallyWrapper.batch.setProjectionMatrix(camera.combined); roboRallyWrapper.batch.begin(); - roboRallyWrapper.font.draw(roboRallyWrapper.batch, "The winner is: " + - roboRallyWrapper.roboRallyGame.getWinningPlayerName(), applicationWidth / 2f - 380 / 2f, - applicationHeight / 2f + 100, 380, 1, + roboRallyWrapper.font.draw(roboRallyWrapper.batch, "The winner is: ", applicationWidth / 2f - 380 / 2f, + applicationHeight / 2f + 300, 380, 1, true); roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Click the button to exit the game", - applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1, + applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 150, 380, 1, true); roboRallyWrapper.batch.end(); stage.draw(); diff --git a/src/main/java/inf112/fiasko/roborally/objects/Board.java b/src/main/java/inf112/fiasko/roborally/objects/Board.java index 0b86cc3..4f74a52 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Board.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Board.java @@ -401,20 +401,20 @@ public class Board { private boolean hasCrossingConflict(Position crossingPosition, Direction conveyorBeltDirection) { Position frontLeftPosition = getNewPosition(crossingPosition, Direction.getLeftRotatedDirection(conveyorBeltDirection)); - Tile frontLeftTile = getTileOnPosition(frontLeftPosition); Position frontRightPosition = getNewPosition(crossingPosition, Direction.getRightRotatedDirection(conveyorBeltDirection)); - Tile frontRightTile = getTileOnPosition(frontRightPosition); Position twoForwardPosition = getNewPosition(crossingPosition, conveyorBeltDirection); - Tile twoForwardTile = getTileOnPosition(twoForwardPosition); //If another robot is standing on a conveyor belt pointing to the tile in front, a conflict happens - return (isValidPosition(frontLeftPosition) && isConveyorBelt(frontLeftTile) && frontLeftTile.getDirection() == + return (isValidPosition(frontLeftPosition) && isConveyorBelt(getTileOnPosition(frontLeftPosition)) && + getTileOnPosition(frontLeftPosition).getDirection() == Direction.getRightRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontLeftPosition)) || - (isValidPosition(frontRightPosition) && isConveyorBelt(frontRightTile) - && frontRightTile.getDirection() == Direction.getLeftRotatedDirection(conveyorBeltDirection) + (isValidPosition(frontRightPosition) && isConveyorBelt(getTileOnPosition(frontRightPosition)) + && getTileOnPosition(frontRightPosition).getDirection() == + Direction.getLeftRotatedDirection(conveyorBeltDirection) && hasRobotOnPosition(frontRightPosition)) || - (isValidPosition(twoForwardPosition) && isConveyorBelt(twoForwardTile) - && twoForwardTile.getDirection() == Direction.getReverseDirection(conveyorBeltDirection) + (isValidPosition(twoForwardPosition) && isConveyorBelt(getTileOnPosition(twoForwardPosition)) + && getTileOnPosition(twoForwardPosition).getDirection() == + Direction.getReverseDirection(conveyorBeltDirection) && hasRobotOnPosition(twoForwardPosition)); } diff --git a/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java b/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java index 9b2bd43..ed9ae08 100644 --- a/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java +++ b/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java @@ -461,4 +461,32 @@ public class PhaseTest { assertFalse(board.isRobotAlive(RobotID.ROBOT_1)); assertNull(board.getRobotOnPosition(new Position(7, 0))); } + + @Test + public void robotOnConveyorBeltFacingOutOfMapMovesIntoWallIsBlocked() throws IOException, InterruptedException { + List robots = new ArrayList<>(); + List players = new ArrayList<>(); + robots.add(new Robot(RobotID.ROBOT_1, new Position(0, 0))); + players.add(new Player(RobotID.ROBOT_1, "Player 1")); + + Phase testPhase = createPhaseAndLoadBoard(players, robots); + testPhase.moveAllConveyorBelts(); + + assertTrue(board.isRobotAlive(RobotID.ROBOT_1)); + assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(new Position(0, 0))); + } + + @Test + public void robotOnConveyorBeltFacingOutOfMapWithOneTileBetweenCanBeMoved() throws IOException, InterruptedException { + List robots = new ArrayList<>(); + List players = new ArrayList<>(); + robots.add(new Robot(RobotID.ROBOT_1, new Position(10, 10))); + players.add(new Player(RobotID.ROBOT_1, "Player 1")); + + Phase testPhase = createPhaseAndLoadBoard(players, robots); + testPhase.moveAllConveyorBelts(); + + assertTrue(board.isRobotAlive(RobotID.ROBOT_1)); + assertEquals(RobotID.ROBOT_1, board.getRobotOnPosition(new Position(10, 11))); + } } diff --git a/src/test/resources/boards/test_board.txt b/src/test/resources/boards/test_board.txt index 2eaf55c..4fe6cf5 100644 --- a/src/test/resources/boards/test_board.txt +++ b/src/test/resources/boards/test_board.txt @@ -1,5 +1,5 @@ 12 12 -01;01 01;01 01;01 01;01 01;01 01;01 01;01 05;01 01;01 01;01 01;01 01;01 +05;01 01;01 01;01 01;01 01;01 01;01 01;01 05;01 01;01 01;01 01;01 01;01 01;01 05;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 02;01 01;01 01;01 01;01 05;01 01;01 05;07 01;01 01;01 01;01 01;01 01;01 05;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 @@ -9,9 +9,9 @@ 01;01 01;01 01;01 01;01 11;01 05;01 05;03 02;01 01;01 03;01 01;01 01;01 01;01 07;05 07;07 01;01 11;01 05;01 01;01 05;01 01;01 01;01 01;01 01;01 01;01 07;03 07;01 01;01 11;01 05;01 01;01 01;01 01;01 01;01 01;01 01;01 -01;01 01;01 01;01 01;01 11;01 05;01 01;01 05;03 01;01 01;01 01;01 01;01 +01;01 01;01 01;01 01;01 11;01 05;01 01;01 05;03 01;01 01;01 05;05 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 01;01 05;01 01;01 01;01 01;01 -0 1;5 0 0 0 0 0 0 0 0 0 0 +1;1 1;5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0