diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index 33636f6..dd8f643 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/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 diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index 9bd71da..3b5ac6c 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/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 playfieldResults() { int[][] playfield1 = {{0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0},