From 9a5a465f113393cf7e9125b61abf2f2f006bf8f0 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Fri, 28 Feb 2020 19:46:40 +0100 Subject: [PATCH] Legger til manglende kommentarer i Game Legger til manglende kommentarer til initialiseringsmetodene Flytter initialiseringsmetodene nedover i filen --- .../inf112/fiasko/roborally/game/Game.java | 62 ++++++++++--------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/inf112/fiasko/roborally/game/Game.java b/src/main/java/inf112/fiasko/roborally/game/Game.java index 521c6f4..b722d67 100644 --- a/src/main/java/inf112/fiasko/roborally/game/Game.java +++ b/src/main/java/inf112/fiasko/roborally/game/Game.java @@ -31,34 +31,6 @@ public class Game implements IDrawableGame { initializeGame(); } - private void initializeDebugMode() { - List robots = new ArrayList<>(); - try { - gameBoard = BoardLoaderUtil.loadBoard("boards/all_tiles_test_board.txt", robots); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private void initializeGame() { - try { - List robots = new ArrayList<>(); - robots.add(new Robot(RobotID.ROBOT_1, new Position(1, 1))); - robots.add(new Robot(RobotID.ROBOT_2, new Position(1, 2))); - robots.add(new Robot(RobotID.ROBOT_3, new Position(1, 3))); - gameBoard = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots); - new Thread(() -> { - try { - runGameLoop(); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - }).start(); - } catch (IOException e) { - e.printStackTrace(); - } - } - @Override public int getWidth() { return gameBoard.getBoardWidth(); @@ -84,6 +56,40 @@ public class Game implements IDrawableGame { return gameBoard.getAliveRobots(); } + /** + * Initializes the game with a debugging board + */ + private void initializeDebugMode() { + List robots = new ArrayList<>(); + try { + gameBoard = BoardLoaderUtil.loadBoard("boards/all_tiles_test_board.txt", robots); + } catch (IOException e) { + e.printStackTrace(); + } + } + + /** + * Initializes the game with a playable board + */ + private void initializeGame() { + try { + List robots = new ArrayList<>(); + robots.add(new Robot(RobotID.ROBOT_1, new Position(1, 1))); + robots.add(new Robot(RobotID.ROBOT_2, new Position(1, 2))); + robots.add(new Robot(RobotID.ROBOT_3, new Position(1, 3))); + gameBoard = BoardLoaderUtil.loadBoard("boards/Checkmate.txt", robots); + new Thread(() -> { + try { + runGameLoop(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + }).start(); + } catch (IOException e) { + e.printStackTrace(); + } + } + /** * Does whatever the game wants to do * @throws InterruptedException If interrupted while trying to sleep