diff --git a/.idea/misc.xml b/.idea/misc.xml index c3dfb30..b573818 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/Command.java b/src/ch/zhaw/catan/Command.java index 3c0d40f..d7e7762 100644 --- a/src/ch/zhaw/catan/Command.java +++ b/src/ch/zhaw/catan/Command.java @@ -8,10 +8,8 @@ package ch.zhaw.catan; public enum Command { NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"), BUILD_ROAD("build road"), TRADE_WITH_BANK("trade with bank"), QUIT("quit"); - private final String commandWord; - Command(String commandWord) { this.commandWord = commandWord; } diff --git a/src/ch/zhaw/catan/Player.java b/src/ch/zhaw/catan/Player.java index 366270f..4df3448 100644 --- a/src/ch/zhaw/catan/Player.java +++ b/src/ch/zhaw/catan/Player.java @@ -11,6 +11,11 @@ import java.util.List; */ public class Player { + /** + * faction: The faction of the player + * resources: The resources the player owns + * structureToUse: The structures a player can build. + */ private final Config.Faction faction; private final HashMap resources; private final HashMap structureToUse; diff --git a/src/ch/zhaw/catan/SiedlerBoardTextView.java b/src/ch/zhaw/catan/SiedlerBoardTextView.java index bece675..d09b3d5 100644 --- a/src/ch/zhaw/catan/SiedlerBoardTextView.java +++ b/src/ch/zhaw/catan/SiedlerBoardTextView.java @@ -5,12 +5,11 @@ import ch.zhaw.hexboard.HexBoardTextView; /** * This Class extends the Class HexBoardTextView - * */ public class SiedlerBoardTextView extends HexBoardTextView { - public SiedlerBoardTextView(SiedlerBoard board) { - super(board); - } + public SiedlerBoardTextView(SiedlerBoard board) { + super(board); + } } diff --git a/src/ch/zhaw/catan/SiedlerGame.java b/src/ch/zhaw/catan/SiedlerGame.java index b32b241..2d411ae 100644 --- a/src/ch/zhaw/catan/SiedlerGame.java +++ b/src/ch/zhaw/catan/SiedlerGame.java @@ -32,9 +32,6 @@ public class SiedlerGame { * or players is not between two and four */ public SiedlerGame(int winPoints, int numberOfPlayers) { - if (winPoints < 3 || numberOfPlayers < Config.MIN_NUMBER_OF_PLAYERS || numberOfPlayers > 4) { - throw new IllegalArgumentException(); - } bank = new Bank(); board = new SiedlerBoard(); board.createFixGameField(); @@ -75,8 +72,8 @@ public class SiedlerGame { /** * This methode is used to add resources to the player. * - * @param player the active Player - * @param resource the resource to add + * @param player the active Player + * @param resource the resource to add * @param numberToAdd the quantity of resources to add * @return true if resource has been added else false */ @@ -91,8 +88,8 @@ public class SiedlerGame { /** * This methode is used to subtract resources from Player * - * @param player the active player - * @param resource the resource to subtract + * @param player the active player + * @param resource the resource to subtract * @param numberToSubtract the quantity of resource to subtract * @return true if resource has been subtracted */ @@ -154,6 +151,11 @@ public class SiedlerGame { return allPlayers.get(activePlayer).getSpecificResource(resource); } + /** + * Returns the resources of the current player. + * + * @return a hashmap with all resources the player has. Key: Resource name Value: number of resources + */ public HashMap getCurrentPlayerResource() { return allPlayers.get(activePlayer).getResources(); } diff --git a/test/ch/zhaw/catan/SiedlerGameTest.java b/test/ch/zhaw/catan/SiedlerGameTest.java index 51cdc21..46bbb1b 100644 --- a/test/ch/zhaw/catan/SiedlerGameTest.java +++ b/test/ch/zhaw/catan/SiedlerGameTest.java @@ -311,6 +311,8 @@ public class SiedlerGameTest { game.placeInitialRoad(secondRoad.first, secondRoad.second); } + System.out.println(game.getBoard().getTextView()); + return game; }