Browse Source

4gewinnt: added getFreePlace method

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

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

@ -58,6 +58,10 @@ public class Logic {
return this.player2Score;
}
public int getFreePlace(int column) {
return this.getBoardSize();
}
public int playChip(int column) {
//add board update

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

@ -187,6 +187,11 @@ class LogicTest {
assertEquals(10, testObj.getPlayer1Score());
}
@Test
void getFreePlaceTest() {
assertEquals(testObj.getBoardSize(), testObj.getFreePlace(0));
}
private static Stream<Arguments> playfieldResults() {
int[][] playfield1 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},

Loading…
Cancel
Save