From 8549ce2f173aee75ede3452998c786bfae22b505 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Thu, 27 Feb 2020 18:36:10 +0100 Subject: [PATCH 1/2] Flytter private metoder nedover i koden --- .../inf112/fiasko/roborally/game/Game.java | 50 +++++++++---------- .../fiasko/roborally/objects/Board.java | 46 +++++++++-------- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/game/Game.java b/src/main/java/inf112/fiasko/roborally/game/Game.java index 717a4b2..d85f0ce 100644 --- a/src/main/java/inf112/fiasko/roborally/game/Game.java +++ b/src/main/java/inf112/fiasko/roborally/game/Game.java @@ -37,6 +37,31 @@ public class Game implements IDrawableGame { } } + @Override + public int getWidth() { + return gameBoard.getBoardWidth(); + } + + @Override + public int getHeight() { + return gameBoard.getBoardHeight(); + } + + @Override + public List getTilesToDraw() { + return gameBoard.getTiles(); + } + + @Override + public List getWallsToDraw() { + return gameBoard.getWalls(); + } + + @Override + public List getRobotsToDraw() { + return gameBoard.getAliveRobots(); + } + /** * Does whatever the game wants to do * @throws InterruptedException If interrupted while trying to sleep @@ -86,29 +111,4 @@ public class Game implements IDrawableGame { TimeUnit.MILLISECONDS.sleep(cycleDelay); gameBoard.moveRobotForward(RobotID.ROBOT_2); } - - @Override - public int getWidth() { - return gameBoard.getBoardWidth(); - } - - @Override - public int getHeight() { - return gameBoard.getBoardHeight(); - } - - @Override - public List getTilesToDraw() { - return gameBoard.getTiles(); - } - - @Override - public List getWallsToDraw() { - return gameBoard.getWalls(); - } - - @Override - public List getRobotsToDraw() { - return gameBoard.getAliveRobots(); - } } diff --git a/src/main/java/inf112/fiasko/roborally/objects/Board.java b/src/main/java/inf112/fiasko/roborally/objects/Board.java index c25694c..0d96f8e 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Board.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Board.java @@ -145,6 +145,30 @@ public class Board { return true; } + /** + * Moves all dead robots to their backups and makes them part of the board again, and if a robot has no lives + * it will be removed from the game. + */ + public void respawnRobots() { + for (Robot robot : deadRobots) { + if (robot.getAmountOfLives() > 0) { + robot.setPosition(robot.getBackupPosition()); + robot.setFacingDirection(Direction.NORTH); + robots.put(robot.getRobotId(), robot); + } + } + deadRobots = new ArrayList<>(); + } + + /** + * Checks if a specific robot is currently alive on the board + * @param robot the ID of the robot you want to check + * @return True/False based on if the robot was found. + */ + public boolean isRobotAlive(RobotID robot) { + return robots.containsKey(robot); + } + /** * Checks if a potential robot move would be blocked by a wall * @param robotPosition The current position of the robot @@ -284,26 +308,4 @@ public class Board { } return elements; } - - /** - * Moves all dead robots to their backups and makes them part of the board again, and if a robot has no lives - * it will be removed from the game. - */ - public void respawnRobots() { - for (Robot robot : deadRobots) { - if (robot.getAmountOfLives() > 0) { - robot.setPosition(robot.getBackupPosition()); - robot.setFacingDirection(Direction.NORTH); - robots.put(robot.getRobotId(), robot); - } - } - deadRobots = new ArrayList<>(); - } - - /** - * Checks if a specific robot is currently alive on the board - * @param robot the ID of the robot you want to check - * @return True/False based on if the robot was found. - */ - public boolean isRobotAlive(RobotID robot) { return robots.containsKey(robot); } } From 1b6175f6327047c11605196c6b65f4dd56877612 Mon Sep 17 00:00:00 2001 From: GabrielMagnus Date: Thu, 27 Feb 2020 18:43:06 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Lagt=20m=C3=B8tereferat=20for=20andre=20m?= =?UTF-8?q?=C3=B8te=2027/02/2020?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/team/referater/referat_27_02_2020_nr2.md | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 docs/team/referater/referat_27_02_2020_nr2.md diff --git a/docs/team/referater/referat_27_02_2020_nr2.md b/docs/team/referater/referat_27_02_2020_nr2.md new file mode 100644 index 0000000..207f014 --- /dev/null +++ b/docs/team/referater/referat_27_02_2020_nr2.md @@ -0,0 +1,10 @@ +## Oppmøte +Tilstede: Steinar, Gabriel, Kristian, Petter +Ikke tilstede: Torbjørn + +## Agenda +- Gjøre ferdig innlevering til oblig 2 + + +## Møte +Retting og omformulering av oppgavesvar. \ No newline at end of file