Browse Source

4gewinnt: added setter for currentPlayer

4gewinnt
Steffen Helmke 3 years ago
committed by Lorenz Hohmann
parent
commit
2d40913c30
  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

@ -24,6 +24,10 @@ public class Logic {
return board[row][column]; return board[row][column];
} }
public void setCurrentPlayer(int player) {
currentPlayer = player;
}
public int playChip(int[][] playfield, int column, int player) { public int playChip(int[][] playfield, int column, int player) {
//add board update //add board update

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

@ -111,6 +111,15 @@ class LogicTest {
assertEquals(player, realResult); assertEquals(player, realResult);
} }
@Test
void setCurrentPlayerTest() {
int player = 1;
testObj.setCurrentPlayer(player);
assertEquals(player, testObj.currentPlayer);
}
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