From aa1efc9c6e164226d1f47fcaecd5c7cf47040943 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Fri, 12 Jan 2018 00:21:27 +0100 Subject: Modifying BoardConverter method due to TileVec2 modification and successful tests --- src/main/java/fr/umlv/java/wallj/board/BoardConverter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/main/java/fr') diff --git a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java index 0f8359b..6231875 100644 --- a/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java +++ b/src/main/java/fr/umlv/java/wallj/board/BoardConverter.java @@ -14,8 +14,8 @@ public final class BoardConverter { } public static Board worldToBoard(List blocks) { - int width = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getRow).max().orElse(-1) + 1; - int height = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getCol).max().orElse(-1) + 1; + int width = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getCol).max().orElse(-1) + 1; + int height = blocks.stream().map(Block::getTile).mapToInt(TileVec2::getRow).max().orElse(-1) + 1; Board.Builder builder = new Board.Builder(width, height); for (Block block : blocks) { @@ -29,9 +29,9 @@ public final class BoardConverter { int nbRow = board.getDim().getRow(); int nbCol = board.getDim().getCol(); for (int i = 0; i < nbRow; i++) { - for (int j = 0; i < nbCol; j++) { + for (int j = 0; j < nbCol; j++) { Block block; - TileVec2 location = TileVec2.of(i, j); + TileVec2 location = TileVec2.of(j,i); block = BlockFactory.build(board.getBlockTypeAt(location), location); if (block != null) { blocks.add(block); -- cgit v1.2.3