Browse Source

4gewinnt: added getter for board

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
e5abbc26f5
  1. 4
      src/main/java/de/tims/viergewinnt/ai/Logic.java
  2. 14
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

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

@ -20,6 +20,10 @@ public class Logic {
board[row][column] = player;
}
public int getField(int row, int column) {
return board[row][column];
}
public int playChip(int[][] playfield, int column, int player) {
//add board update

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

@ -96,7 +96,19 @@ class LogicTest {
testObj.setField(player, row, column);
assertEquals(2, testObj.board[row][column]);
assertEquals(player, testObj.board[row][column]);
}
@Test
void getFieldTest() {
int player = 2;
int row = 0;
int column = 0;
testObj.setField(player, row, column);
int realResult = testObj.getField(row, column);
assertEquals(player, realResult);
}
private static Stream<Arguments> playfieldResults() {

Loading…
Cancel
Save