Browse Source

4gewinnt: finished clearField method

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

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

@ -31,7 +31,7 @@ public class Logic {
}
public void clearField() {
this.setField(0, 0, 0);
this.board = new int[getBoardSize()][getBoardSize()];
}
public int getBoardSize() {

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

@ -196,6 +196,15 @@ class LogicTest {
assertEquals(0, testObj.getField(0, 0));
}
@Test
void clearFieldTestCompleteClear() {
testObj.setField(1, 5, 5);
testObj.clearField();
assertEquals(0, testObj.getField(5, 5));
}
@Test
void getFreePlaceTestWithEmptyField() {
assertEquals(testObj.getBoardSize() - 1, testObj.getFreePlace(0));

Loading…
Cancel
Save