diff options
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/board/Board.java | 6 | ||||
-rw-r--r-- | src/test/java/fr/umlv/java/wallj/board/BoardParserTest.java | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/board/Board.java b/src/main/java/fr/umlv/java/wallj/board/Board.java index a4ac421..c846fd3 100644 --- a/src/main/java/fr/umlv/java/wallj/board/Board.java +++ b/src/main/java/fr/umlv/java/wallj/board/Board.java | |||
@@ -21,7 +21,7 @@ public final class Board { | |||
21 | * @param height height in tiles | 21 | * @param height height in tiles |
22 | */ | 22 | */ |
23 | public Builder(int width, int height) { | 23 | public Builder(int width, int height) { |
24 | this.map = new BlockType[width][height]; | 24 | map = new BlockType[height][width]; |
25 | } | 25 | } |
26 | 26 | ||
27 | /** | 27 | /** |
@@ -30,7 +30,7 @@ public final class Board { | |||
30 | * @return the Builder | 30 | * @return the Builder |
31 | */ | 31 | */ |
32 | public Builder setBlockTypeAt(TileVec2 pos, BlockType type) { | 32 | public Builder setBlockTypeAt(TileVec2 pos, BlockType type) { |
33 | map[pos.getCol()][pos.getRow()] = type; | 33 | map[pos.getRow()][pos.getCol()] = type; |
34 | return this; | 34 | return this; |
35 | } | 35 | } |
36 | 36 | ||
@@ -55,7 +55,7 @@ public final class Board { | |||
55 | * @return the element at the given position | 55 | * @return the element at the given position |
56 | */ | 56 | */ |
57 | public BlockType getBlockTypeAt(TileVec2 pos) { | 57 | public BlockType getBlockTypeAt(TileVec2 pos) { |
58 | return map[pos.getCol()][pos.getRow()]; | 58 | return map[pos.getRow()][pos.getCol()]; |
59 | } | 59 | } |
60 | 60 | ||
61 | /** | 61 | /** |
diff --git a/src/test/java/fr/umlv/java/wallj/board/BoardParserTest.java b/src/test/java/fr/umlv/java/wallj/board/BoardParserTest.java index de6799b..87ca08a 100644 --- a/src/test/java/fr/umlv/java/wallj/board/BoardParserTest.java +++ b/src/test/java/fr/umlv/java/wallj/board/BoardParserTest.java | |||
@@ -35,7 +35,7 @@ final class BoardParserTest { | |||
35 | 35 | ||
36 | Board board = BoardParser.parse(getResourcePath("/maps/smallValid.txt")); | 36 | Board board = BoardParser.parse(getResourcePath("/maps/smallValid.txt")); |
37 | 37 | ||
38 | Assertions.assertEquals(board.getDim(), TileVec2.of(blocks.length, blocks[0].length)); | 38 | Assertions.assertEquals(board.getDim(), TileVec2.of(blocks[0].length, blocks.length)); |
39 | for (int row = 0; row < blocks.length; ++row) | 39 | for (int row = 0; row < blocks.length; ++row) |
40 | for (int col = 0; col < blocks[0].length; ++col) | 40 | for (int col = 0; col < blocks[0].length; ++col) |
41 | Assertions.assertEquals(board.getBlockTypeAt(TileVec2.of(row, col)), blocks[row][col]); | 41 | Assertions.assertEquals(board.getBlockTypeAt(TileVec2.of(row, col)), blocks[row][col]); |