Browse Source

4gewinnt: added setter for player1Score

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

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

@ -15,6 +15,7 @@ public class Logic {
int[][] board = new int[6][6];
int currentPlayer = 1;
int player1Score = 0;
public void setField(int player, int row, int column) {
board[row][column] = player;
@ -32,6 +33,10 @@ public class Logic {
return currentPlayer;
}
public void setPlayer1Score(int score) {
player1Score = score;
}
public int playChip(int column) {
//add board update

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

@ -125,7 +125,7 @@ class LogicTest {
@Test
void setCurrentPlayerTest() {
int player = 1;
int player = 2;
testObj.setCurrentPlayer(player);
@ -142,6 +142,14 @@ class LogicTest {
assertEquals(player, realResult);
}
@Test
void setPlayer1ScoreTest() {
int expectedResult = 500;
testObj.setPlayer1Score(expectedResult);
assertEquals(expectedResult, testObj.player1Score);
}
private static Stream<Arguments> playfieldResults() {
int[][] playfield1 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},

Loading…
Cancel
Save