Browse Source

4gewinnt: added constructor to create game logic

4gewinnt
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
ddf26d199a
  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

@ -18,7 +18,11 @@ public class Logic {
private int player1Score = 0;
private int player2Score = 0;
public void setField(int player, int row, int column) {
public Logic(int size) {
// TODO Auto-generated constructor stub
}
public void setField(int player, int row, int column) {
board[row][column] = player;
}

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

@ -16,7 +16,7 @@ class LogicTest {
@BeforeEach
void setUp() throws Exception {
testObj = new Logic();
testObj = new Logic(6);
}
@ParameterizedTest(name = "[{index}] {0} Player {2} {3}")
@ -160,6 +160,15 @@ class LogicTest {
assertEquals(expectedResult, realResult);
}
@Test
void createGameLogicTest() {
int size = 6;
Logic expectedResult = testObj;
Logic realResult = new Logic(size);
assertEquals(expectedResult.getClass(), realResult.getClass());
}
private static Stream<Arguments> playfieldResults() {
int[][] playfield1 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},

Loading…
Cancel
Save