diff --git a/src/main/java/de/tims/viergewinnt/ai/Logic.java b/src/main/java/de/tims/viergewinnt/ai/Logic.java index f0cc5e6..63ecf74 100644 --- a/src/main/java/de/tims/viergewinnt/ai/Logic.java +++ b/src/main/java/de/tims/viergewinnt/ai/Logic.java @@ -160,6 +160,10 @@ public class Logic { score += 60; } } + if(playfield[0][0] != 0 && playfield[1][0] != 0 && playfield[2][0] != 0 && + playfield[3][0] != 0 && playfield[4][0] != 0 && playfield[5][0] != 0) { + score += 60; + } return score; } } diff --git a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java index e66c8c6..49a5794 100644 --- a/src/test/java/de/tims/viergewinnt/ai/LogicTest.java +++ b/src/test/java/de/tims/viergewinnt/ai/LogicTest.java @@ -137,11 +137,18 @@ class LogicTest { {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0}, {1, 1, 1, 2, 2, 2}}; + int[][] playfield4 = {{2, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0}, + {2, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0}, + {1, 0, 0, 0, 0, 0}}; return Stream.of( Arguments.of("emptyField", new int[6][6], 1, 1000), Arguments.of("9 chips played", playfield1, 1, 1090), Arguments.of("first row filled", playfield2, 1, 1120), - Arguments.of("2 rows filled", playfield3, 1, 1240) + Arguments.of("2 rows filled", playfield3, 1, 1240), + Arguments.of("first column filled", playfield4, 1, 1120) ); }