Browse Source

4gewinnt: setter for Board with player 1

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

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

@ -13,9 +13,13 @@ import javax.swing.JPanel;
public class Logic {
int[][] board;
int[][] board = new int[6][6];
int currentPlayer;
public void setField(int player, int row, int column) {
board[row][column] = 1;
}
public int playChip(int[][] playfield, int column, int player) {
//add board update

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

@ -77,6 +77,17 @@ class LogicTest {
assertEquals(expectedResult, realResult);
}
@Test
void setFieldPlayer1Test() {
int player = 1;
int row = 0;
int column = 0;
testObj.setField(player, row, column);
assertEquals(1, 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