Browse Source

4gewinnt: finished setter for Board

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

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

@ -17,7 +17,7 @@ public class Logic {
int currentPlayer;
public void setField(int player, int row, int column) {
board[row][column] = 1;
board[row][column] = player;
}
public int playChip(int[][] playfield, int column, int player) {

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

@ -88,6 +88,17 @@ class LogicTest {
assertEquals(1, testObj.board[row][column]);
}
@Test
void setFieldPlayer2Test() {
int player = 2;
int row = 0;
int column = 0;
testObj.setField(player, row, column);
assertEquals(2, testObj.board[row][column]);
}
private static Stream<Arguments> playfieldResults() {
int[][] playfield1 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},

Loading…
Cancel
Save