Browse Source

4gewinnt: calcScore bonusForFullField

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

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

@ -170,6 +170,9 @@ public class Logic {
}
}
}
if(score == 2080) {
score += 500;
}
return score;
}
}

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

@ -149,13 +149,20 @@ class LogicTest {
{2, 0, 2, 0, 0, 0},
{1, 0, 2, 0, 0, 0},
{1, 0, 1, 0, 0, 0}};
int[][] playfield6 = {{1, 1, 1, 1, 2, 2},
{2, 1, 1, 1, 1, 2},
{2, 1, 1, 2, 1, 2},
{2, 1, 1, 2, 1, 2},
{2, 1, 2, 2, 1, 2},
{2, 1, 2, 2, 1, 2}};
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("first column filled", playfield4, 1, 1120),
Arguments.of("2 column filled", playfield5, 1, 1240)
Arguments.of("2 column filled", playfield5, 1, 1240),
Arguments.of("fullyFilled", playfield6, 1, 2580)
);
}

Loading…
Cancel
Save