diff --git a/src/main/java/inf112/fiasko/roborally/objects/Tile.java b/src/main/java/inf112/fiasko/roborally/objects/Tile.java index 7099ab5..4232ec2 100644 --- a/src/main/java/inf112/fiasko/roborally/objects/Tile.java +++ b/src/main/java/inf112/fiasko/roborally/objects/Tile.java @@ -49,6 +49,6 @@ public class Tile implements BoardElement { @Override public String toString() { return StringUtil.addLeadingZeros(tileType.getTileTypeID(), 2) + ";" + - StringUtil.addLeadingZeros(direction.getDirectionID(), 2); + direction.getDirectionID(); } } diff --git a/src/main/java/inf112/fiasko/roborally/ui/screens/BoardActiveScreen.java b/src/main/java/inf112/fiasko/roborally/ui/screens/BoardActiveScreen.java index 852d9e7..36e9f58 100644 --- a/src/main/java/inf112/fiasko/roborally/ui/screens/BoardActiveScreen.java +++ b/src/main/java/inf112/fiasko/roborally/ui/screens/BoardActiveScreen.java @@ -58,12 +58,6 @@ public class BoardActiveScreen extends InteractiveScreen { lastTouch = new Vector2(); } - @Override - public void show() { - super.show(); - resetCamera(); - } - @Override public void render(float delta) { super.render(delta); diff --git a/src/main/java/inf112/fiasko/roborally/ui/screens/LobbyScreen.java b/src/main/java/inf112/fiasko/roborally/ui/screens/LobbyScreen.java index 3880513..f5cb4e3 100644 --- a/src/main/java/inf112/fiasko/roborally/ui/screens/LobbyScreen.java +++ b/src/main/java/inf112/fiasko/roborally/ui/screens/LobbyScreen.java @@ -15,8 +15,10 @@ import inf112.fiasko.roborally.networking.containers.GameStartInfoResponse; import inf112.fiasko.roborally.objects.Player; import inf112.fiasko.roborally.ui.RoboRallyWrapper; import inf112.fiasko.roborally.ui.SimpleButton; +import inf112.fiasko.roborally.utility.BoardLoaderUtil; import inf112.fiasko.roborally.utility.IOUtil; +import java.io.IOException; import java.util.List; import java.util.Map; @@ -45,8 +47,11 @@ public class LobbyScreen extends InteractiveScreen { Skin skin = new Skin(Gdx.files.internal("uiskin.json")); selectBox = new SelectBox<>(skin); - selectBox.setItems("Dizzy_Dash", "Checkmate", "Risky_Exchange", "Twister", "Bloodbath_Chess", "Vault_Assault", - "Island_Hop", "Chop_Shop_Challenge", "Around_The_World", "Death_Trap", "Whirlwind_Tour"); + try { + selectBox.setItems(BoardLoaderUtil.getBoardListHumanReadable()); + } catch (IOException e) { + e.printStackTrace(); + } selectBox.setSize(200, 50); selectBox.setPosition((applicationWidth - selectBox.getWidth()) / 2f, applicationHeight / 2f - 120); @@ -77,7 +82,7 @@ public class LobbyScreen extends InteractiveScreen { roboRallyWrapper.server.getRobotID()); for (Connection connection : playerNames.keySet()) { roboRallyWrapper.server.sendToClient(connection, new GameStartInfoResponse( - selectBox.getSelected() + ".txt", playerList, playerNames.get(connection))); + BoardLoaderUtil.getRealBoardName(selectBox.getSelected()), playerList, playerNames.get(connection))); } roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(roboRallyWrapper)); } diff --git a/src/main/java/inf112/fiasko/roborally/utility/BoardLoaderUtil.java b/src/main/java/inf112/fiasko/roborally/utility/BoardLoaderUtil.java index 4a46155..ec52397 100644 --- a/src/main/java/inf112/fiasko/roborally/utility/BoardLoaderUtil.java +++ b/src/main/java/inf112/fiasko/roborally/utility/BoardLoaderUtil.java @@ -28,18 +28,65 @@ public final class BoardLoaderUtil { } /** - * Loads and rotates a board described in a file + * Gets the actual file name of a board given its human-readable name + * + * @param boardName The human-readable name of a board + * @return The file name of the board + */ + public static String getRealBoardName(String boardName) { + return boardName.replace(" ", "_") + ".txt"; + } + + /** + * Gets a list of all available boards with human-readable names + * + * @return A list of all available boards + * @throws IOException If the board list cannot be read + */ + public static String[] getBoardListHumanReadable() throws IOException { + String[] boards = getBoardList(); + for (int i = 0; i < boards.length; i++) { + boards[i] = boards[i].replace("_", " ").replace(".txt", ""); + } + return boards; + } + + /** + * Loads a board described in a file * * @param boardFile The file containing the board description * @param robotList A list of robots on the board - * @param clockwise Whether to rotate the board clockwise * @return A board * @throws IOException If the board file cannot be loaded */ - public static Board loadBoardRotated(String boardFile, List robotList, boolean clockwise) throws IOException { + public static Board loadBoard(String boardFile, List robotList) throws IOException { TwoTuple, Grid> grids = loadBoardGrids(boardFile); - adjustRobotRotationToBoardRotation(grids.value1, robotList); - return new Board(rotateGrid(grids.value1, clockwise), rotateGrid(grids.value2, clockwise), robotList); + Grid tileGrid = grids.value1; + Grid wallGrid = grids.value2; + if (grids.value1.getHeight() < grids.value1.getWidth()) { + tileGrid = rotateGrid(tileGrid, true); + wallGrid = rotateGrid(wallGrid, true); + } + adjustRobotRotationToBoardRotation(tileGrid, robotList); + return new Board(tileGrid, wallGrid, robotList); + } + + /** + * Gets a list of all available boards + * + * @return A list of all available boards + * @throws IOException If the board list cannot be read + */ + private static String[] getBoardList() throws IOException { + BufferedReader reader = new BufferedReader(new InputStreamReader( + ResourceUtil.getResourceAsInputStream("boards.txt"))); + int numberOfBoards = Integer.parseInt(reader.readLine()); + String[] boardList = new String[numberOfBoards]; + for (int i = 0; i < numberOfBoards; i++) { + String board = reader.readLine(); + boardList[i] = board; + } + return boardList; } /** @@ -96,20 +143,6 @@ public final class BoardLoaderUtil { return newGrid; } - /** - * Loads a board described in a file - * - * @param boardFile The file containing the board description - * @param robotList A list of robots on the board - * @return A board - * @throws IOException If the board file cannot be loaded - */ - public static Board loadBoard(String boardFile, List robotList) throws IOException { - TwoTuple, Grid> grids = loadBoardGrids(boardFile); - adjustRobotRotationToBoardRotation(grids.value1, robotList); - return new Board(grids.value1, grids.value2, robotList); - } - /** * Changes the direction of robots to the direction which is up * @@ -117,13 +150,13 @@ public final class BoardLoaderUtil { * @param robotList The list of robots on the board */ private static void adjustRobotRotationToBoardRotation(Grid tileGrid, List robotList) { - //The flags are always in the up direction - List> flags = GridUtil.getMatchingElements(TileType.ROBOT_SPAWN_1, tileGrid); + //The spawns are always in the up direction + List> spawns = GridUtil.getMatchingElements(TileType.ROBOT_SPAWN_1, tileGrid); Direction boardDirection; - if (flags.size() == 0) { + if (spawns.size() == 0) { boardDirection = Direction.NORTH; } else { - boardDirection = flags.get(0).getElement().getDirection(); + boardDirection = spawns.get(0).getElement().getDirection(); } for (Robot robot : robotList) { robot.setFacingDirection(boardDirection); diff --git a/src/main/resources/boards.txt b/src/main/resources/boards.txt new file mode 100644 index 0000000..0dc3ba2 --- /dev/null +++ b/src/main/resources/boards.txt @@ -0,0 +1,18 @@ +17 +Against_the_Grain.txt +Around_The_World.txt +Bloodbath_Chess.txt +Checkmate.txt +Chop_Shop_Challenge.txt +Death_Trap.txt +Dizzy_Dash.txt +Island_Hop.txt +Island_King.txt +Lost_Bearings.txt +Oddest_Sea.txt +Pilgrimage.txt +Risky_Exchange.txt +Robot_Stew.txt +Twister.txt +Vault_Assault.txt +Whirlwind_Tour.txt \ No newline at end of file diff --git a/src/main/resources/boards/Against_the_Grain.txt b/src/main/resources/boards/Against_the_Grain.txt new file mode 100644 index 0000000..a82191c --- /dev/null +++ b/src/main/resources/boards/Against_the_Grain.txt @@ -0,0 +1,25 @@ +28 12 +21;5 01;3 01;3 05;1 01;3 01;3 01;3 01;3 05;5 01;3 05;1 01;3 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 21;7 01;7 01;7 30;7 01;7 +01;3 01;3 01;3 05;1 01;3 01;3 01;3 01;3 05;5 17;1 01;3 01;3 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;7 01;7 28;7 01;7 +01;3 01;3 02;1 05;1 01;3 01;3 02;3 01;3 05;5 22;5 05;1 01;3 01;1 11;1 05;3 01;1 05;3 01;1 05;7 01;1 05;7 01;1 11;5 01;1 01;7 01;7 01;7 01;7 +05;3 05;3 05;3 04;5 01;3 01;3 04;5 03;5 01;3 01;3 05;1 01;3 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;7 01;7 26;7 01;7 +01;3 01;3 01;3 01;3 01;3 05;1 01;3 01;3 11;5 01;3 05;1 01;3 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;7 01;7 01;7 01;7 +01;3 01;3 01;3 01;3 02;1 05;1 01;3 01;3 11;5 04;5 06;1 05;7 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;7 01;7 24;7 01;7 +05;3 05;3 05;3 03;5 05;3 07;1 22;5 01;3 11;5 03;5 05;3 05;3 01;1 11;1 05;3 01;1 05;3 19;1 22;7 01;1 02;1 01;1 11;5 01;1 01;7 01;7 23;7 01;7 +01;3 01;3 22;5 01;3 01;3 04;5 05;7 01;3 11;5 01;3 01;3 01;3 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;7 01;7 01;7 01;7 +01;3 01;3 02;7 18;1 01;3 05;5 01;3 01;3 11;5 01;3 01;3 01;3 01;1 11;1 05;3 01;1 05;3 01;1 05;7 01;1 05;7 01;1 11;5 01;1 01;7 01;7 25;7 01;7 +01;3 01;3 05;1 05;1 01;3 05;5 12;3 11;3 16;5 01;3 01;3 01;3 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;7 01;7 01;7 01;7 +05;3 05;3 07;1 05;1 01;3 05;5 11;1 01;3 11;5 01;3 02;5 01;3 01;1 12;1 11;7 11;7 11;7 11;7 11;7 11;7 11;7 11;7 12;7 01;1 01;7 01;7 27;7 01;7 +01;3 01;3 01;3 05;1 01;3 05;5 11;1 01;3 11;5 01;3 01;3 21;5 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;7 01;7 29;7 01;7 +0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 1;5 0 +0 1;3 0 0 3;3 0 0 0 0 0 7;7 1;7 0 0 0 1;5 0 1;5 1;5 0 1;5 0 0 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 1;5 1;3 +0 0 0 0 0 4;7 0 0 0 1;7 0 0 0 1;3 0 0 0 0 0 0 0 0 1;7 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 3;1 0 1;3 1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 1;5 1;3 +0 1;1 0 3;1 0 0 0 0 0 0 0 0 0 1;3 0 0 0 0 0 0 0 0 1;7 0 0 0 1;5 0 +0 0 0 0 0 0 0 0 0 0 0 0 0 1;3 0 0 0 0 0 0 0 0 1;7 0 0 0 1;5 0 +1;7 0 0 1;5 0 0 0 0 0 0 0 1;3 1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 0 1;3 +0 0 0 0 0 0 2;2 0 0 0 0 0 0 1;3 0 0 0 0 0 0 0 0 1;7 0 0 0 1;5 0 +1;7 0 0 0 0 0 0 0 0 1;5 0 1;3 1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 0 1;3 +0 0 0 0 0 0 3;7 0 0 1;7 0 0 0 0 0 1;1 0 1;1 1;1 0 1;1 0 0 0 0 0 1;5 0 +0 0 1;5 0 1;5 0 0 1;5 0 1;5 0 0 0 0 1;5 0 1;5 0 0 1;5 0 1;5 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/boards/Around_The_World.txt b/src/main/resources/boards/Around_The_World.txt index 97c8cc5..9ed4b99 100644 --- a/src/main/resources/boards/Around_The_World.txt +++ b/src/main/resources/boards/Around_The_World.txt @@ -1,16 +1,16 @@ 28 12 -21;01 01;03 01;03 01;03 01;03 01;03 01;03 01;03 01;03 01;03 01;03 01;03 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;07 01;07 30;07 01;07 -01;03 34;07 35;03 01;03 01;03 01;01 01;03 01;03 01;03 35;07 34;01 01;03 01;1 12;3 11;3 11;3 12;5 01;1 01;1 12;3 11;3 11;3 12;5 01;1 01;07 01;07 28;07 01;07 -01;03 35;05 03;01 05;03 05;03 05;03 05;03 05;03 05;03 05;03 35;05 01;03 17;1 11;1 03;1 01;1 11;5 04;1 01;1 11;1 03;1 01;1 11;5 01;1 01;07 01;07 01;07 01;07 -01;03 01;03 05;01 04;01 05;07 05;07 09;07 05;07 04;01 05;05 01;03 01;03 01;1 11;1 21;1 03;1 11;5 01;1 01;1 11;1 22;1 03;1 11;5 01;1 01;07 01;07 26;07 01;07 -01;03 01;03 05;01 05;05 34;07 35;03 05;01 01;03 05;01 05;05 01;03 01;03 01;1 12;1 11;7 11;7 12;7 01;1 04;1 12;1 11;7 11;7 12;7 01;1 01;07 01;07 01;07 01;07 -01;03 18;01 05;01 05;05 35;05 22;01 05;01 01;03 05;01 05;05 01;03 01;03 01;1 01;1 01;1 01;1 04;1 01;1 01;1 01;1 01;1 04;1 01;1 01;1 01;07 01;07 24;07 01;07 -01;03 01;03 05;01 05;05 01;03 05;05 01;03 35;01 05;01 05;05 01;01 01;03 01;1 01;1 04;1 01;1 01;1 01;1 01;1 04;1 01;1 01;1 19;1 01;1 01;07 01;07 23;07 01;07 -01;03 01;03 05;01 05;05 01;03 05;05 35;07 34;03 05;01 05;05 01;03 01;03 01;1 12;3 11;3 11;3 12;5 04;1 01;1 12;3 11;3 11;3 12;5 01;1 01;07 01;07 01;07 01;07 -01;03 01;03 05;01 04;01 05;03 09;03 05;03 05;03 04;01 05;05 01;03 01;03 01;1 11;1 03;1 22;1 11;5 01;1 01;1 11;1 03;1 21;1 11;5 01;1 01;07 01;07 25;07 01;07 -01;03 35;01 03;01 05;07 05;07 05;07 05;07 05;07 05;07 05;05 35;01 01;03 01;1 11;1 01;1 03;1 11;5 01;1 04;1 11;1 01;1 03;1 11;5 01;1 01;07 01;07 01;07 01;07 -01;03 34;05 35;03 01;03 01;03 01;03 01;03 01;03 01;03 35;07 34;03 01;03 01;1 12;1 11;7 11;7 12;7 01;1 01;1 12;1 11;7 11;7 12;7 01;1 01;07 01;07 27;07 01;07 -01;03 01;03 01;03 01;03 01;03 01;03 01;03 01;01 01;03 21;01 01;03 01;03 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;07 01;07 29;07 01;07 +21;1 01;3 01;3 01;3 01;3 01;3 01;3 01;3 01;3 01;3 01;3 01;3 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;7 01;7 30;7 01;7 +01;3 34;7 35;3 01;3 01;3 01;1 01;3 01;3 01;3 35;7 34;1 01;3 01;1 12;3 11;3 11;3 12;5 01;1 01;1 12;3 11;3 11;3 12;5 01;1 01;7 01;7 28;7 01;7 +01;3 35;5 03;1 05;3 05;3 05;3 05;3 05;3 05;3 05;3 35;5 01;3 17;1 11;1 03;1 01;1 11;5 04;1 01;1 11;1 03;1 01;1 11;5 01;1 01;7 01;7 01;7 01;7 +01;3 01;3 05;1 04;1 05;7 05;7 09;7 05;7 04;1 05;5 01;3 01;3 01;1 11;1 21;1 03;1 11;5 01;1 01;1 11;1 22;1 03;1 11;5 01;1 01;7 01;7 26;7 01;7 +01;3 01;3 05;1 05;5 34;7 35;3 05;1 01;3 05;1 05;5 01;3 01;3 01;1 12;1 11;7 11;7 12;7 01;1 04;1 12;1 11;7 11;7 12;7 01;1 01;7 01;7 01;7 01;7 +01;3 18;1 05;1 05;5 35;5 22;1 05;1 01;3 05;1 05;5 01;3 01;3 01;1 01;1 01;1 01;1 04;1 01;1 01;1 01;1 01;1 04;1 01;1 01;1 01;7 01;7 24;7 01;7 +01;3 01;3 05;1 05;5 01;3 05;5 01;3 35;1 05;1 05;5 01;1 01;3 01;1 01;1 04;1 01;1 01;1 01;1 01;1 04;1 01;1 01;1 19;1 01;1 01;7 01;7 23;7 01;7 +01;3 01;3 05;1 05;5 01;3 05;5 35;7 34;3 05;1 05;5 01;3 01;3 01;1 12;3 11;3 11;3 12;5 04;1 01;1 12;3 11;3 11;3 12;5 01;1 01;7 01;7 01;7 01;7 +01;3 01;3 05;1 04;1 05;3 09;3 05;3 05;3 04;1 05;5 01;3 01;3 01;1 11;1 03;1 22;1 11;5 01;1 01;1 11;1 03;1 21;1 11;5 01;1 01;7 01;7 25;7 01;7 +01;3 35;1 03;1 05;7 05;7 05;7 05;7 05;7 05;7 05;5 35;1 01;3 01;1 11;1 01;1 03;1 11;5 01;1 04;1 11;1 01;1 03;1 11;5 01;1 01;7 01;7 01;7 01;7 +01;3 34;5 35;3 01;3 01;3 01;3 01;3 01;3 01;3 35;7 34;3 01;3 01;1 12;1 11;7 11;7 12;7 01;1 01;1 12;1 11;7 11;7 12;7 01;1 01;7 01;7 27;7 01;7 +01;3 01;3 01;3 01;3 01;3 01;3 01;3 01;1 01;3 21;1 01;3 01;3 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;7 01;7 29;7 01;7 0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 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 1;7 0 0 0 0 0 1;5 0 0 0 0 1;3 1;7 0 0 1;5 0 0 0 0 0 0 0 1;3 1;7 0 1;5 1;3 diff --git a/src/main/resources/boards/Island_King.txt b/src/main/resources/boards/Island_King.txt new file mode 100644 index 0000000..adab0f2 --- /dev/null +++ b/src/main/resources/boards/Island_King.txt @@ -0,0 +1,33 @@ +12 16 +01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 21;3 +01;5 34;7 35;3 01;5 01;5 01;5 01;5 01;5 01;5 35;7 34;1 01;5 +01;5 35;5 03;3 05;3 05;3 05;3 05;3 05;3 05;3 03;3 35;5 01;5 +01;5 01;5 05;1 04;3 05;7 05;7 05;7 05;7 04;3 05;5 01;5 01;5 +01;5 01;5 05;1 05;5 01;5 17;1 35;7 34;1 05;1 05;5 01;5 01;5 +01;5 01;5 05;1 09;5 05;7 05;7 22;3 35;5 05;1 05;5 01;5 01;5 +01;5 01;5 05;1 05;5 35;1 19;1 05;3 05;3 09;1 05;5 01;5 01;5 +01;5 01;5 05;1 05;5 34;5 35;3 01;5 18;1 05;1 05;5 01;5 01;5 +01;5 01;5 05;1 04;3 05;3 05;3 05;3 05;3 04;3 05;5 01;5 01;5 +21;3 35;1 05;7 05;7 05;7 05;7 05;7 05;7 05;7 05;5 35;1 01;5 +01;5 34;5 35;3 01;5 01;5 01;5 01;5 01;5 01;5 35;7 34;3 01;5 +01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 +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 0 0 0 0 0 0 0 0 0 +1;7 0 0 0 0 1;5 0 0 0 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 0 0 1;3 +0 0 1;3 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 1;7 0 0 +1;7 0 0 0 0 0 0 0 0 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 0 0 0 1;1 0 0 0 0 0 1;3 +0 0 0 0 0 0 0 0 0 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 \ No newline at end of file diff --git a/src/main/resources/boards/Lost_Bearings.txt b/src/main/resources/boards/Lost_Bearings.txt new file mode 100644 index 0000000..b6fa258 --- /dev/null +++ b/src/main/resources/boards/Lost_Bearings.txt @@ -0,0 +1,33 @@ +12 16 +01;1 05;5 01;1 01;1 01;1 05;5 05;1 01;1 01;1 01;1 05;1 32;1 +01;1 07;3 05;3 05;3 05;3 10;5 05;1 01;1 01;1 32;1 06;1 05;7 +01;1 17;1 01;1 01;1 01;1 05;5 05;1 01;1 01;1 01;1 01;1 21;7 +01;1 01;1 32;1 01;1 01;1 05;5 05;1 01;1 01;1 01;1 01;1 01;1 +01;1 01;1 22;7 01;1 01;1 05;5 06;1 07;7 01;1 01;1 01;1 01;1 +05;7 05;7 05;7 05;7 05;7 06;7 35;1 06;1 05;7 05;7 05;7 05;7 +05;3 05;3 05;3 05;3 06;5 35;7 31;1 35;3 06;3 05;3 05;3 05;3 +01;1 01;1 01;1 01;1 07;3 06;5 35;5 06;3 07;1 35;7 35;3 01;1 +01;1 01;1 19;1 01;1 01;1 05;5 06;3 07;1 01;1 22;7 01;1 01;1 +01;1 01;1 32;1 01;1 01;1 05;5 05;1 01;1 01;1 01;1 18;1 01;1 +05;3 06;5 01;1 01;1 01;1 05;5 10;1 05;7 05;7 05;7 07;7 01;1 +21;7 05;5 01;1 01;1 01;1 05;5 05;1 01;1 01;1 01;1 05;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 2;8 0 0 1;1 0 1;1 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 1;7 0 1;3 +0 0 0 1;7 3;3 0 0 2;4 0 3;3 0 0 +1;7 1;5 0 0 2;4 0 0 0 0 0 0 2;1 +0 0 0 0 0 0 0 0 0 0 0 0 +0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 1;1 0 0 0 0 0 0 0 0 1;3 +0 0 0 4;1 2;2 0 0 0 1;7 0 2;8 0 +1;7 0 0 0 0 0 0 3;1 0 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 0 0 +0 0 1;5 1;1 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 \ No newline at end of file diff --git a/src/main/resources/boards/Oddest_Sea.txt b/src/main/resources/boards/Oddest_Sea.txt new file mode 100644 index 0000000..a70ab9e --- /dev/null +++ b/src/main/resources/boards/Oddest_Sea.txt @@ -0,0 +1,25 @@ +28 12 +21;5 01;5 01;5 01;5 01;5 05;5 01;5 01;5 01;5 01;5 05;1 01;5 01;3 11;5 01;3 22;1 01;3 11;5 05;1 01;3 01;3 01;3 01;3 21;1 01;7 01;7 30;7 01;7 +01;5 07;5 05;7 05;7 05;7 06;7 01;5 01;5 01;5 01;5 06;1 05;7 01;3 14;3 11;3 11;3 11;3 15;3 11;3 11;3 11;3 12;5 07;5 05;7 01;7 01;7 28;7 01;7 +01;5 05;5 20;1 02;1 01;5 01;5 01;5 01;5 02;3 01;5 01;5 01;5 01;3 11;1 06;3 05;3 05;3 05;3 05;3 05;3 06;5 11;5 05;5 01;3 01;7 01;7 01;7 01;7 +01;5 05;5 01;5 01;5 01;5 01;5 17;1 01;5 01;5 01;5 03;5 05;3 01;3 11;1 05;1 12;3 11;3 11;3 11;3 12;5 05;5 11;5 05;5 01;3 01;7 01;7 26;7 01;7 +01;5 05;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 05;1 01;5 01;3 11;1 05;1 11;1 06;3 05;3 06;5 11;5 05;5 11;5 05;5 01;3 01;7 01;7 01;7 01;7 +05;7 06;7 01;5 01;5 01;5 22;5 22;5 01;5 01;5 01;5 05;1 01;5 01;3 11;1 05;1 11;1 05;1 34;7 34;1 11;5 05;5 11;5 09;5 05;7 01;7 01;7 24;7 01;7 +01;5 01;5 01;5 01;5 01;5 22;5 22;5 01;5 19;1 01;5 05;1 01;5 11;3 15;1 05;1 11;1 05;1 34;5 34;3 11;5 05;5 11;5 05;5 05;3 01;7 01;7 23;7 01;7 +01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 05;1 01;5 01;3 11;1 05;1 11;1 05;1 12;1 11;7 12;7 05;5 11;5 05;5 01;3 01;7 01;7 01;7 01;7 +01;5 05;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 01;5 06;1 09;7 01;3 11;1 05;1 11;1 06;1 05;7 05;7 05;7 06;7 11;5 05;5 01;3 01;7 01;7 25;7 01;7 +01;5 05;5 01;5 02;7 01;5 01;5 01;5 01;5 02;5 01;5 01;5 05;1 01;3 11;1 05;1 12;1 11;7 11;7 11;7 11;7 11;7 12;7 05;5 01;3 01;7 01;7 01;7 01;7 +01;5 05;5 01;5 01;5 18;1 11;5 01;5 01;5 13;5 11;7 11;7 03;5 11;3 13;1 06;1 05;7 05;7 05;7 09;7 05;7 05;7 05;7 08;7 01;3 01;7 01;7 27;7 01;7 +01;5 05;5 01;5 01;5 01;5 11;5 01;5 01;5 11;5 01;5 01;5 21;5 21;1 01;3 01;3 01;3 01;3 01;3 05;1 01;3 01;3 01;3 05;1 01;3 01;7 01;7 29;7 01;7 +0 0 1;1 0 1;1 0 0 1;1 0 3;1 0 0 0 0 6;1 0 5;1 0 0 5;1 0 6;1 0 0 0 0 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 +1;7 0 0 0 0 5;5 1;5 0 0 0 0 1;3 6;7 0 0 0 0 0 0 0 0 0 0 6;3 1;7 0 1;5 1;3 +0 0 0 0 0 0 0 0 0 1;1 0 0 0 0 0 0 0 3;1 0 0 0 0 0 0 0 0 0 0 +3;7 0 0 0 2;8 0 0 2;2 0 0 0 3;3 5;7 0 0 0 0 0 3;1 0 0 0 0 5;3 1;7 0 1;5 1;3 +0 0 6;3 0 0 0 0 0 0 5;7 0 0 0 0 0 0 3;7 0 0 0 1;3 0 0 0 0 0 1;5 0 +0 0 5;3 0 0 0 0 0 0 1;7 0 0 0 0 0 3;7 0 0 0 1;3 0 0 0 0 0 0 1;5 0 +3;7 0 0 0 2;6 0 0 2;4 0 0 0 3;3 5;7 0 0 0 0 1;5 0 0 0 0 0 5;3 1;7 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;5 0 0 0 0 0 0 0 1;5 0 +1;7 0 0 0 0 5;1 1;1 0 0 0 0 1;3 6;7 0 0 0 0 0 0 0 0 0 0 6;3 1;7 0 0 1;3 +0 0 0 0 0 0 6;3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;5 0 +0 0 1;5 0 1;5 0 0 1;5 0 1;5 0 0 0 0 6;5 0 5;5 0 0 5;5 0 6;5 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/boards/Pilgrimage.txt b/src/main/resources/boards/Pilgrimage.txt new file mode 100644 index 0000000..021b8f3 --- /dev/null +++ b/src/main/resources/boards/Pilgrimage.txt @@ -0,0 +1,25 @@ +28 12 +21;1 05;5 01;3 01;3 01;3 05;5 05;1 01;3 01;3 01;3 01;3 01;3 01;3 02;1 01;3 05;1 01;3 01;3 05;1 01;3 05;5 01;3 05;1 21;7 01;7 01;7 30;7 01;7 +05;7 06;7 01;3 01;3 01;3 05;5 05;1 01;3 01;3 02;3 07;5 05;7 01;3 01;3 01;3 05;1 01;3 05;5 05;1 01;3 05;5 01;3 01;3 01;3 01;7 01;7 28;7 01;7 +01;3 01;3 32;3 01;3 01;3 05;5 05;1 22;1 32;3 01;3 05;5 01;3 01;3 01;3 01;3 05;1 01;3 05;5 05;1 18;1 05;5 01;3 02;3 01;3 01;7 01;7 01;7 01;7 +01;3 01;3 01;3 01;3 01;3 05;5 05;1 01;3 01;3 01;3 05;5 01;3 05;3 05;3 05;3 04;7 01;3 05;5 05;1 01;3 04;7 05;3 05;3 05;3 01;7 01;7 26;7 01;7 +01;3 01;3 01;3 01;3 07;5 06;7 05;1 01;3 01;3 01;3 05;5 01;3 01;3 01;3 01;3 01;3 01;3 05;5 05;1 01;3 01;3 01;3 01;3 01;3 01;7 01;7 01;7 01;7 +05;7 05;7 05;7 05;7 06;7 35;1 06;1 05;7 05;7 05;7 10;7 05;7 11;7 11;7 11;7 11;7 11;7 01;3 01;3 05;7 05;7 05;7 05;7 05;7 01;7 01;7 24;7 01;7 +05;3 10;3 05;3 06;5 35;7 31;3 35;3 06;3 05;3 05;3 05;3 05;3 01;3 05;3 05;3 05;3 05;3 01;3 01;3 05;3 05;3 05;3 05;3 05;3 01;7 01;7 23;7 01;7 +01;3 05;1 01;3 07;3 06;5 35;5 06;3 07;1 17;1 01;3 01;3 01;3 01;3 01;3 01;3 01;3 22;7 11;5 05;1 01;3 01;3 01;3 02;3 01;3 01;7 01;7 01;7 01;7 +01;3 05;1 01;3 01;3 07;3 06;5 05;1 01;3 01;3 01;3 01;3 01;3 05;7 05;7 05;7 04;7 01;3 11;5 05;1 01;3 05;7 05;7 05;7 05;7 01;7 01;7 25;7 01;7 +01;3 05;1 01;3 22;1 35;1 05;5 05;1 01;3 01;3 01;3 32;3 01;3 01;3 01;3 19;1 05;1 01;3 11;5 05;1 01;3 11;5 01;3 01;3 01;3 01;7 01;7 01;7 01;7 +05;3 07;1 01;3 01;3 35;5 05;5 05;1 01;3 01;3 01;3 06;3 05;3 05;3 03;7 01;3 05;1 01;3 11;5 05;1 01;3 11;5 01;3 03;7 05;3 01;7 01;7 27;7 01;7 +01;3 01;3 01;3 01;3 01;3 05;5 05;1 01;3 01;3 21;1 05;1 32;3 21;7 05;5 01;3 05;1 01;3 11;5 05;1 01;3 11;5 01;3 05;1 01;3 01;7 01;7 29;7 01;7 +0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 0 0 1;5 0 +0 0 0 0 0 0 0 1;7 0 0 0 0 0 1;7 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 0 0 1;3 0 0 0 0 0 0 1;3 1;7 0 0 0 0 0 0 0 0 0 0 1;3 1;7 0 1;5 1;3 +1;3 0 0 4;3 0 0 0 0 1;1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 +1;7 0 0 2;4 0 0 0 2;6 3;5 0 0 2;2 1;7 0 0 0 2;4 0 0 2;6 0 0 0 1;3 1;7 0 1;5 1;3 +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 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 1;5 0 +1;7 0 3;3 0 0 0 0 0 2;6 0 0 1;3 1;7 0 0 0 2;2 0 0 2;8 0 0 0 1;3 1;7 0 0 1;3 +0 0 0 1;1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1;5 0 +1;7 0 0 0 0 0 0 0 3;5 1;1 0 1;3 1;7 0 0 0 0 0 0 0 0 1;1 0 1;3 1;7 0 0 1;3 +0 0 0 2;2 0 0 0 0 0 0 0 0 0 0 1;3 0 0 0 0 0 0 0 0 0 0 0 1;5 0 +0 0 1;5 0 1;5 0 0 2;3 0 1;5 0 0 0 0 1;5 0 1;5 0 0 1;5 0 3;5 0 0 0 0 0 0 \ No newline at end of file diff --git a/src/main/resources/boards/Robot_Stew.txt b/src/main/resources/boards/Robot_Stew.txt new file mode 100644 index 0000000..aba7b4d --- /dev/null +++ b/src/main/resources/boards/Robot_Stew.txt @@ -0,0 +1,33 @@ +12 16 +01;5 05;5 01;5 01;5 01;5 05;5 01;5 01;5 05;5 01;5 01;5 21;7 +01;5 05;5 01;5 01;5 01;5 05;5 01;5 01;5 05;5 01;5 01;5 01;5 +01;5 07;3 05;3 02;1 22;7 05;5 01;5 01;5 05;5 02;3 01;5 01;5 +05;3 05;3 05;3 01;5 01;5 03;7 01;5 01;5 04;7 05;3 05;3 05;3 +17;1 01;5 01;5 01;5 01;5 05;5 02;3 01;5 01;5 01;5 01;5 01;5 +05;7 05;7 05;7 05;7 04;7 07;3 05;3 05;3 01;5 01;5 01;5 01;5 +11;3 11;3 12;5 01;5 05;1 22;7 01;5 01;5 04;7 02;5 01;5 01;5 +01;5 01;5 11;5 01;5 01;5 01;5 01;5 01;5 03;7 18;1 01;5 01;5 +11;7 11;7 16;7 11;7 11;7 11;7 11;7 11;7 01;5 05;7 05;7 05;7 +01;5 01;5 01;5 01;5 01;5 03;7 04;7 01;5 01;5 22;7 01;5 01;5 +01;5 02;7 19;1 01;5 01;5 05;5 06;3 05;3 05;3 05;3 01;5 05;3 +21;7 01;5 01;5 01;5 01;5 05;5 05;1 01;5 01;5 01;5 01;5 01;5 +29;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 30;1 +01;1 27;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 28;1 01;1 +05;3 05;3 06;5 25;1 01;1 01;1 01;1 01;1 26;1 07;5 05;7 05;7 +01;1 01;1 07;3 05;3 05;3 23;1 24;1 05;7 05;7 06;7 01;1 01;1 +0 0 1;1 0 1;1 0 0 1;1 0 1;1 0 0 +0 0 0 0 0 0 1;3 0 0 0 1;5 0 +1;7 0 0 0 0 0 0 0 0 0 0 1;3 +0 0 0 0 1;7 0 3;3 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 0 3;5 1;3 +0 0 0 0 0 0 0 0 4;1 0 0 0 +0 3;1 0 2;4 0 0 0 0 0 0 0 0 +1;7 0 0 0 0 0 0 0 0 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 0 0 +1;7 1;1 1;7 0 0 0 0 3;3 1;1 0 0 1;3 +0 0 0 0 0 0 0 0 0 0 7;1 0 +0 0 1;5 0 1;5 0 0 1;5 0 1;5 1;1 0 +0 0 1;1 0 2;8 0 0 2;2 0 1;1 0 0 +0 1;7 1;7 0 0 0 0 0 0 1;3 1;3 0 +0 0 0 0 0 0 1;7 0 0 0 0 0 +0 0 0 0 0 0 1;7 0 0 0 0 0 \ No newline at end of file diff --git a/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java b/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java index cccccd1..611ac68 100644 --- a/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java +++ b/src/test/java/inf112/fiasko/roborally/objects/PhaseTest.java @@ -86,21 +86,21 @@ public class PhaseTest { assertTrue(robot.hasTouchedFlagThisTurn()); robot.setHasTouchedFlagThisTurn(false); assertNull(testGame.getWinningPlayerName()); - board.moveRobot(robotID, Direction.EAST); + board.moveRobot(robotID, Direction.SOUTH); testPhase.checkAllFlags(); //Should have registered second flag assertEquals(2, robot.getLastFlagVisited()); assertTrue(robot.hasTouchedFlagThisTurn()); assertNull(testGame.getWinningPlayerName()); robot.setHasTouchedFlagThisTurn(false); - board.moveRobot(robotID, Direction.EAST); + board.moveRobot(robotID, Direction.SOUTH); testPhase.checkAllFlags(); //Should have registered third flag assertEquals(3, robot.getLastFlagVisited()); assertTrue(robot.hasTouchedFlagThisTurn()); assertNull(testGame.getWinningPlayerName()); robot.setHasTouchedFlagThisTurn(false); - board.moveRobot(robotID, Direction.EAST); + board.moveRobot(robotID, Direction.SOUTH); testPhase.checkAllFlags(); //Should have registered fourth and last flag assertEquals(4, robot.getLastFlagVisited()); diff --git a/src/test/resources/boards/test_board.txt b/src/test/resources/boards/test_board.txt index 4fe6cf5..162a450 100644 --- a/src/test/resources/boards/test_board.txt +++ b/src/test/resources/boards/test_board.txt @@ -1,16 +1,16 @@ 12 12 -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 -01;01 01;01 01;01 01;01 01;01 11;01 01;01 01;01 01;01 01;01 01;01 01;01 -01;01 01;01 01;01 01;01 11;01 12;07 11;07 01;01 01;01 04;01 01;01 01;01 -01;01 01;01 01;01 01;01 11;01 01;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 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 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 +05;1 01;1 01;1 01;1 01;1 01;1 01;1 05;1 01;1 01;1 01;1 01;1 +01;1 05;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 02;1 01;1 01;1 +01;1 05;1 01;1 05;7 01;1 01;1 01;1 01;1 01;1 05;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 11;1 01;1 01;1 01;1 01;1 01;1 01;1 +01;1 01;1 01;1 01;1 11;1 12;7 11;7 01;1 01;1 04;1 01;1 01;1 +01;1 01;1 01;1 01;1 11;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 +01;1 01;1 01;1 01;1 11;1 05;1 05;3 02;1 01;1 03;1 01;1 01;1 +01;1 07;5 07;7 01;1 11;1 05;1 01;1 05;1 01;1 01;1 01;1 01;1 +01;1 07;3 07;1 01;1 11;1 05;1 01;1 01;1 01;1 01;1 01;1 01;1 +01;1 01;1 01;1 01;1 11;1 05;1 01;1 05;3 01;1 01;1 05;5 01;1 +01;1 01;1 01;1 01;1 01;1 01;1 01;1 01;1 05;1 01;1 01;1 01;1 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