Browse Source

4gewinnt: calcScore pointsForFirstRow added

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

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

@ -156,6 +156,10 @@ public class Logic {
} }
} }
} }
if(playfield[5][0] != 0 && playfield[5][1] != 0 && playfield[5][2] != 0
&& playfield[5][3] != 0 && playfield[5][4] != 0 && playfield[5][5] != 0) {
score += 60;
}
return score; return score;
} }
} }

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

@ -125,9 +125,16 @@ class LogicTest {
{0, 0, 1, 2, 0, 0}, {0, 0, 1, 2, 0, 0},
{0, 0, 1, 2, 0, 0}, {0, 0, 1, 2, 0, 0},
{0, 0, 1, 1, 2, 0}}; {0, 0, 1, 1, 2, 0}};
int[][] playfield2 = {{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0},
{1, 1, 1, 2, 2, 2}};
return Stream.of( return Stream.of(
Arguments.of("emptyField", new int[6][6], 1, 1000), Arguments.of("emptyField", new int[6][6], 1, 1000),
Arguments.of("9 chips played", playfield1, 1, 1090)
Arguments.of("9 chips played", playfield1, 1, 1090),
Arguments.of("first row filled", playfield2, 1, 1120)
); );
} }

Loading…
Cancel
Save