Browse Source

4gewinnt: finished board creation with individual size

4gewinnt
Malte Schellhardt 3 years ago
committed by Lorenz Hohmann
parent
commit
bd09c5783b
  1. 6
      src/main/java/de/tims/viergewinnt/ai/Logic.java
  2. 5
      src/test/java/de/tims/viergewinnt/ai/LogicTest.java

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

@ -13,13 +13,13 @@ import javax.swing.JPanel;
public class Logic {
private int[][] board = new int[6][6];
private int[][] board;
private int currentPlayer = 1;
private int player1Score = 0;
private int player2Score = 0;
public Logic(int size) {
// TODO Auto-generated constructor stub
this.board = new int[size][size];
}
public void setField(int player, int row, int column) {
@ -31,7 +31,7 @@ public class Logic {
}
public int getBoardSize() {
return 0;
return this.board.length;
}
public void setCurrentPlayer(int player) {

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

@ -173,7 +173,7 @@ class LogicTest {
@MethodSource("boardSizeParameters")
void getBoardSize(String testName, int size) {
int expectedResult = size;
int realResult = testObj.getBoardSize();
int realResult = new Logic(size).getBoardSize();
assertEquals(expectedResult, realResult);
}
@ -269,7 +269,8 @@ class LogicTest {
private static Stream<Arguments> boardSizeParameters() {
return Stream.of(
Arguments.of("board with size 0", 0)
Arguments.of("board with size 0", 0),
Arguments.of("board with size 6", 6)
);
}

Loading…
Cancel
Save