Browse Source

4gewinnt: added gameover method

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

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

@ -220,4 +220,8 @@ public class Logic {
} }
return score; return score;
} }
public void gameover() {
setPlayer1Score(10);
}
} }

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

@ -178,6 +178,15 @@ class LogicTest {
assertEquals(expectedResult, realResult); assertEquals(expectedResult, realResult);
} }
@Test
void gameoverTest() {
testObj.setField(1, 0, 0);
testObj.gameover();
assertEquals(10, testObj.getPlayer1Score());
}
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