Browse Source

4gewinnt: added getter method for board size

4gewinnt
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
2530467f14
  1. 4
      src/main/java/de/tims/viergewinnt/ai/Logic.java
  2. 8
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

4
src/main/java/de/tims/viergewinnt/ai/Logic.java

@ -30,6 +30,10 @@ public class Logic {
return board[row][column]; return board[row][column];
} }
public int getBoardSize() {
return 6;
}
public void setCurrentPlayer(int player) { public void setCurrentPlayer(int player) {
currentPlayer = player; currentPlayer = player;
} }

8
src/test/java/de/tims/viergewinnt/ai/LogicTest.java

@ -169,6 +169,14 @@ class LogicTest {
assertEquals(expectedResult.getClass(), realResult.getClass()); assertEquals(expectedResult.getClass(), realResult.getClass());
} }
@Test
void getBoardSize() {
int expectedResult = 6;
int realResult = testObj.getBoardSize();
assertEquals(expectedResult, realResult);
}
private static Stream<Arguments> playfieldResults() { private static Stream<Arguments> playfieldResults() {
int[][] playfield1 = {{0, 0, 0, 0, 0, 0}, int[][] playfield1 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},

Loading…
Cancel
Save