updated javaodoc SiedlerGame

updated constructor SiedlerGame
This commit is contained in:
Andrin Fassbind 2021-12-10 13:39:19 +01:00
parent faca966394
commit 0ea44905e2
6 changed files with 20 additions and 14 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="openjdk-17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -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;
}

View File

@ -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<Config.Resource, Integer> resources;
private final HashMap<Config.Structure, Integer> structureToUse;

View File

@ -5,7 +5,6 @@ import ch.zhaw.hexboard.HexBoardTextView;
/**
* This Class extends the Class HexBoardTextView
*
*/
public class SiedlerBoardTextView extends HexBoardTextView<Land, Settlement, Road, String> {

View File

@ -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();
@ -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<Config.Resource, Integer> getCurrentPlayerResource() {
return allPlayers.get(activePlayer).getResources();
}

View File

@ -311,6 +311,8 @@ public class SiedlerGameTest {
game.placeInitialRoad(secondRoad.first, secondRoad.second);
}
System.out.println(game.getBoard().getTextView());
return game;
}