Browse Source

Add printGameboard method

AIPlayer
Jonas Wagner 3 years ago
parent
commit
e0b1106d0b
  1. 8
      README.md
  2. 8
      src/main/java/Gameboard.java
  3. 12
      src/test/java/GameboardTest.java

8
README.md

@ -1,8 +0,0 @@
# CIiP-WiSe-2021-Projektarbeit-Mensch_Aerger_Dich_Nicht
by Jonas Wagner und Felix Krull
## Beschreibung Projekt
## Aufbau Spiel
## Struktur Code

8
src/main/java/Gameboard.java

@ -1,3 +1,6 @@
import java.lang.reflect.Array;
import java.util.Arrays;
public class Gameboard {
int[] board;
@ -19,4 +22,9 @@ public class Gameboard {
}
}
@Override
public String toString() {
return Arrays.toString(board);
}
}

12
src/test/java/GameboardTest.java

@ -60,4 +60,16 @@ public class GameboardTest {
);
}
@Test
void checkPrintGameboard() {
String expectedResult = "[1, 0, 0, 0, 0, 0, 0, 0, 0, 2, " +
"1, 0, 0, 0, 0, 0, 0, 0, 0, 2, " +
"1, 0, 0, 0, 0, 0, 0, 0, 0, 2, " +
"1, 0, 0, 0, 0, 0, 0, 0, 0, 2, " +
"3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]";
gb.initGameboard();
String calculatedResult = gb.toString();
assertThat(calculatedResult).describedAs("Print Gameboard").isEqualTo(expectedResult);
}
}
Loading…
Cancel
Save