Browse Source

4gewinnt: updated playChip method and tests

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

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

@ -71,12 +71,10 @@ public class Logic {
}
public int playChip(int column) {
//add board update
setField(getCurrentPlayer(), getFreePlace(column), column);
updateGui();
if(testForWin()) {
calcScore();
gameover();
}
setCurrentPlayer((getCurrentPlayer() % 2) + 1);
return 0;

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

@ -44,7 +44,7 @@ class LogicTest {
int realResult = testObj.playChip(column);
assertEquals(expectedResult, realResult);
assertEquals(expectedResult == realResult, 1 == testObj.getField(5, 0));
}
@Test

Loading…
Cancel
Save