diff --git a/README.md b/README.md index d963ced..f733327 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Test-Driven entwickelt, daher haben wir eine sehr große Testabdeckung für unse ## Voraussetzungen -- [Java 1.15](https://www.java.com/de/) (sollte aber auch mit fast allen weiteren Versionen funktionieren) +- [Java 1.15+](https://www.java.com/de/) ### Dependencies für Maven diff --git a/src/main/java/Gameboard.java b/src/main/java/Gameboard.java index 379d09d..638de2b 100644 --- a/src/main/java/Gameboard.java +++ b/src/main/java/Gameboard.java @@ -182,16 +182,4 @@ public class Gameboard { } return res; } -} - -/* - 0-39 Spielfelder - Rot Ziel: 40,41,42,43 - Blau Ziel: 44,45,46,47 - Gelb Ziel: 48,49,50,51 - Grün Ziel: 52.53.54.55 - Rot Daneben: 56,57,58,59 - Blau Daneben: 60,61,62,63 - Gelb Daneben: 64.65.66.67 - Grün Daneben: 68.69,70,71 - */ \ No newline at end of file +} \ No newline at end of file diff --git a/src/main/java/Player.java b/src/main/java/Player.java index 70cc734..a562df0 100644 --- a/src/main/java/Player.java +++ b/src/main/java/Player.java @@ -70,7 +70,6 @@ public class Player { */ public int choose(ArrayList usableFigures) { StringBuilder out = new StringBuilder("["); - Iterator it = usableFigures.iterator(); for(int i = 0; i usableFiguresData () { return Stream.of( - Arguments.of( //Würfel 1-6 - Keine Figur im Ziel - Alle Figuren auf dem Spielfeld - StartFeld frei - Keine Figur vor Ziel + Arguments.of( "Alle Figuren", 1, Arrays.asList(10, 25, 2, 17), new ArrayList<>(Arrays.asList(0, 1, 2, 3)) ), - Arguments.of( //Würfel 6 - Keine Figur im Ziel - 1 Figur auf dem Spielfeld - StartFeld frei - Keine Figur vor Ziel - "Figuren die nicht am Spielfeld stehen", + Arguments.of( + "Nur Figuren aus der Base", 6, Arrays.asList(10, -1, -1, -1), new ArrayList<>(Arrays.asList(1, 2, 3)) ), - Arguments.of( //Würfel 6 - Keine Figur im Ziel - 1 Figur auf dem Spielfeld - StartFeld besetzt - Keine Figur vor Ziel + Arguments.of( "Figur die das Startfeld besetzt", 6, Arrays.asList(10, 0, -1, -1), new ArrayList<>(List.of(1)) ), - Arguments.of( //Würfel 5 - Keine Figur im Ziel - 1 Figur auf dem Spielfeld - StartFeld besetzt - Figur vor Ziel + Arguments.of( "Figur vor dem Ziel - kann man benutzen", 5, Arrays.asList(10, 37, -1, -1), new ArrayList<>(Arrays.asList(0,1)) ), - Arguments.of( //Würfel 5 - Keine Figur im Ziel - 1 Figur auf dem Spielfeld - StartFeld besetzt - Figur vor Ziel + Arguments.of( "Figur vor dem Ziel - kann man nicht benutzen", 5, Arrays.asList(10, 39, -1, -1), new ArrayList<>(List.of(0)) ), - Arguments.of( //Würfel 5 - Figur im Ziel - 1 Figur auf dem Spielfeld - StartFeld besetzt - Figur vor Ziel + Arguments.of( "Nur Figuren die auf ein freies Feld kommen", 2, Arrays.asList(10, 12, -1, -1), new ArrayList<>(List.of(1)) ), - Arguments.of( //Würfel 6 - 1 Figur auf dem Spielfeld - StartFeld besetzt + Arguments.of( "Figur auf Startfeld", 6, Arrays.asList(-1, -1, -1, 0), new ArrayList<>(List.of(3)) ), - Arguments.of( //Würfel 6 - 1 Figur auf dem Spielfeld - StartFeld besetzt - "Figur auf Startfeld", + Arguments.of( + "Im Ziel überworfen nur andere Figuren möglich", 5, Arrays.asList(-1, 41, -1, 0), new ArrayList<>(List.of(3)) + ), + Arguments.of( + "Im Haus bewegen", + 2, + Arrays.asList(-1, 41, -1, 0), + new ArrayList<>(List.of(1, 3)) ) ); } diff --git a/src/test/java/GameboardTest.java b/src/test/java/GameboardTest.java index 0bacb50..21d7d4c 100644 --- a/src/test/java/GameboardTest.java +++ b/src/test/java/GameboardTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.params.provider.MethodSource; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; import java.util.Iterator; import java.util.stream.Stream; @@ -44,7 +43,7 @@ public class GameboardTest { void checkGameboardFieldType(String testname, int Pos, int expectedResult) { gb.initGameboard(); int currentType = gb.board[Pos]; - assertThat(currentType).describedAs("Field Type").isEqualTo(expectedResult); + assertThat(currentType).describedAs(testname).isEqualTo(expectedResult); } static Stream FieldStream () { @@ -92,9 +91,12 @@ public class GameboardTest { " "," "," "," "," "," "," "," "," "," ", " "," "," "," "," "," "," "," "," "," ", " "," "," "," "," "," "," "," "," "," ", - " "," "," "," "," "," ","\u001b[31;1m1\u001b[0m", "\u001b[31;1m2\u001b[0m","\u001b[31;1m3\u001b[0m","\u001b[31;1m4\u001b[0m", - "\u001b[34;1m1\u001b[0m","\u001b[34;1m2\u001b[0m","\u001b[34;1m3\u001b[0m","\u001b[34;1m4\u001b[0m","\u001b[33;1m1\u001b[0m","\u001b[33;1m2\u001b[0m","\u001b[33;1m3\u001b[0m","\u001b[33;1m4\u001b[0m","\u001b[32;1m1\u001b[0m","\u001b[32;1m2\u001b[0m", - "\u001b[32;1m3\u001b[0m","\u001b[32;1m4\u001b[0m"} + " "," "," "," "," "," ","\u001b[31;1m1\u001b[0m", + "\u001b[31;1m2\u001b[0m","\u001b[31;1m3\u001b[0m","\u001b[31;1m4\u001b[0m", + "\u001b[34;1m1\u001b[0m","\u001b[34;1m2\u001b[0m","\u001b[34;1m3\u001b[0m", + "\u001b[34;1m4\u001b[0m","\u001b[33;1m1\u001b[0m","\u001b[33;1m2\u001b[0m", + "\u001b[33;1m3\u001b[0m","\u001b[33;1m4\u001b[0m","\u001b[32;1m1\u001b[0m", + "\u001b[32;1m2\u001b[0m", "\u001b[32;1m3\u001b[0m","\u001b[32;1m4\u001b[0m"} ), Arguments.of( "Figures on Board", @@ -117,9 +119,10 @@ public class GameboardTest { " "," "," "," ", " "," "," "," ", " "," "," "," ", - "\u001b[34;1m1\u001b[0m","\u001b[34;1m2\u001b[0m","\u001b[34;1m3\u001b[0m","\u001b[34;1m4\u001b[0m", - " "," "," ","\u001b[33;1m4\u001b[0m", - "\u001b[32;1m1\u001b[0m","\u001b[32;1m2\u001b[0m","\u001b[32;1m3\u001b[0m","\u001b[32;1m4\u001b[0m"} + "\u001b[34;1m1\u001b[0m","\u001b[34;1m2\u001b[0m","\u001b[34;1m3\u001b[0m", + "\u001b[34;1m4\u001b[0m", " "," "," ","\u001b[33;1m4\u001b[0m", + "\u001b[32;1m1\u001b[0m","\u001b[32;1m2\u001b[0m","\u001b[32;1m3\u001b[0m", + "\u001b[32;1m4\u001b[0m"} ) ); }