Browse Source

4gewinnt: added getter for currentPlayer

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

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

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

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

@ -120,6 +120,16 @@ class LogicTest {
assertEquals(player, testObj.currentPlayer); assertEquals(player, testObj.currentPlayer);
} }
@Test
void getCurrentPlayerTest() {
int player = 2;
testObj.setCurrentPlayer(player);
int realResult = testObj.getCurrentPlayer();
assertEquals(player, realResult);
}
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