diff --git a/.idea/misc.xml b/.idea/misc.xml
index b573818..c3dfb30 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/src/ch/zhaw/catan/SiedlerBoard.java b/src/ch/zhaw/catan/SiedlerBoard.java
index 864a217..1f8656a 100644
--- a/src/ch/zhaw/catan/SiedlerBoard.java
+++ b/src/ch/zhaw/catan/SiedlerBoard.java
@@ -45,11 +45,9 @@ public class SiedlerBoard extends HexBoard {
return view.toString();
}
-
//TODO: Add fields, constructors and methods as you see fit. Do NOT change the signature
// of the methods below.
-
/**
* Returns the fields associated with the specified dice value.
*
diff --git a/test/ch/zhaw/catan/SiedlerGameTest.java b/test/ch/zhaw/catan/SiedlerGameTest.java
index 2d68560..8332480 100644
--- a/test/ch/zhaw/catan/SiedlerGameTest.java
+++ b/test/ch/zhaw/catan/SiedlerGameTest.java
@@ -1,13 +1,21 @@
package ch.zhaw.catan;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import ch.zhaw.catan.games.ThreePlayerStandard;
import org.beryx.textio.TextIO;
import org.beryx.textio.TextIoFactory;
import org.beryx.textio.TextTerminal;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import java.awt.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
/***
@@ -17,12 +25,12 @@ import java.awt.*;
* to get several different game states.
*
*/
+
+
public class SiedlerGameTest {
- @Test
- public void dummyTestMethod() {
- assertTrue(false);
- }
+ private final static int DEFAULT_WINPOINTS = 10;
+ private final static int DEFAULT_PLAYERAMOUNT = 4;
/**
* To Test getLongestRoad in SiedlerGame isolatet do:
@@ -48,7 +56,108 @@ public class SiedlerGameTest {
board.setEdge(new Point(4, 10), new Point(5, 9), new Road(Config.Faction.BLUE,new Point(4, 10),new Point(5, 9)));
board.setCorner(new Point(3,7),new Settlement(Config.Faction.BLUE,new Point(3,7)));
//SiedlerGame.getLongestRoadFaction(board,faction);
+ }
+
+ /**
+ * Tests if the method will fail when given false Data
+ * {@link ThreePlayerStandard#getAfterSetupPhaseAlmostEmptyBank(int)}
+ */
+ @Test
+ public void destructiveTestBuildCity() {
+ SiedlerGame model = ThreePlayerStandard.getAfterSetupPhaseAlmostEmptyBank(DEFAULT_WINPOINTS);
+
+ //Too
+ Assertions.assertFalse(model.buildCity(new Point(50, 60)));
+
+ //Factions wants to build a city on a city from another faction
+ Assertions.assertFalse(model.buildCity(new Point(3, 3)));
+ }
+
+ /**
+ * Tests if the method fails when given false Data
+ * {@link ThreePlayerStandard#getAfterSetupPhase(int)}
+ */
+ @Test
+ public void destructiveTestBuildRoad() {
+
+ SiedlerGame model = ThreePlayerStandard.getAfterSetupPhase(DEFAULT_WINPOINTS);
+
+ System.out.println(model.buildRoad(new Point(3, 7),new Point(3, 9)));
+ }
+
+ /**
+ * Tests if the method fails when trading material with the same material
+ * {@link ThreePlayerStandard#getAfterSetupPhaseAlmostEmptyBank(int)}
+ */
+ @Test
+ public void destructiveTestTradeWithBank() {
+ SiedlerGame model = ThreePlayerStandard.getAfterSetupPhaseAlmostEmptyBank(DEFAULT_WINPOINTS);
+ model.switchToNextPlayer();
+
+ Map expectedResourceCards = ThreePlayerStandard.BANK_ALMOST_EMPTY_RESOURCE_CARD_STOCK.get(model.getCurrentPlayerFaction());
+ assertEquals(expectedResourceCards.get(Config.Resource.WOOL), model.getCurrentPlayerResourceStock(Config.Resource.WOOL));
+ assertEquals(expectedResourceCards.get(Config.Resource.LUMBER), model.getCurrentPlayerResourceStock(Config.Resource.LUMBER));
+
+ System.out.println(model.tradeWithBankFourToOne(Config.Resource.WOOL, Config.Resource.WOOL));
+ }
+
+ @Test
+ public void TestGameInSetupPhase() {
+ SiedlerGame game = new SiedlerGame(DEFAULT_WINPOINTS, DEFAULT_PLAYERAMOUNT);
+
+ for (Config.Faction faction: game.getPlayerFactions()) {
+ HashMap resources = game.getCurrentPlayerResource();
+
+ Assertions.assertEquals(0, resources.get(Config.Resource.BRICK));
+ Assertions.assertEquals(0, resources.get(Config.Resource.GRAIN));
+ Assertions.assertEquals(0, resources.get(Config.Resource.LUMBER));
+ Assertions.assertEquals(0, resources.get(Config.Resource.ORE));
+ Assertions.assertEquals(0, resources.get(Config.Resource.WOOL));
+
+ game.switchToNextPlayer();
+ }
+ }
+
+ @Test
+ public void TestGameAfterSetupPhase() {
+ SiedlerGame game = new SiedlerGame(DEFAULT_WINPOINTS, DEFAULT_PLAYERAMOUNT);
+
+ throwDiceSeveralTimes(game, 5, 5);
+
+ System.out.println("\n\nVerteilung \n\n");
+ for (Config.Faction faction: game.getPlayerFactions()) {
+ HashMap resources = game.getCurrentPlayerResource();
+ System.out.printf(faction.toString() + "\n");
+ System.out.println(" BRICK " + resources.get(Config.Resource.BRICK).toString());
+ System.out.println(" GRAIN " + resources.get(Config.Resource.GRAIN));
+ System.out.println(" LUMBER " + resources.get(Config.Resource.LUMBER));
+ System.out.println(" ORE " + resources.get(Config.Resource.ORE));
+ System.out.println(" WOOL " + resources.get(Config.Resource.WOOL));
+
+ game.switchToNextPlayer();
+ }
+ }
+
+
+ @Test
+ public void TestGameInMiddle() {
}
+ private void throwDiceSeveralTimes(SiedlerGame game, int dice, int amountDiceThrows) {
+ for (int i = 0; i < amountDiceThrows; i++) {
+ System.out.println(game.getCurrentPlayerFaction().toString());
+ game.throwDice(dice);
+ }
+ }
+
+ private SiedlerGame gameAfterSetupPhase() {
+ SiedlerGame game = new SiedlerGame(DEFAULT_WINPOINTS, DEFAULT_PLAYERAMOUNT);
+
+ for (Config.Faction faction: game.getPlayerFactions()) {
+
+ }
+
+ return game;
+ }
}
\ No newline at end of file