Browse Source

4gewinnt: refactored and updated GameOver method and tests

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

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

@ -234,6 +234,11 @@ public class Logic {
} }
public void gameover() { public void gameover() {
if(getCurrentPlayer() == 1) {
setPlayer1Score(calcScore()); setPlayer1Score(calcScore());
} else {
setPlayer2Score(calcScore());
}
clearField();
} }
} }

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

@ -184,7 +184,7 @@ class LogicTest {
testObj.gameover(); testObj.gameover();
assertEquals(1010, testObj.getPlayer1Score());
assertEquals(1010 == testObj.getPlayer1Score(), 0 == testObj.getField(0,0));
} }
@Test @Test

Loading…
Cancel
Save