updated javaodoc SiedlerGame
updated constructor SiedlerGame
This commit is contained in:
parent
faca966394
commit
0ea44905e2
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<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" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
|
@ -8,10 +8,8 @@ package ch.zhaw.catan;
|
||||||
public enum Command {
|
public enum Command {
|
||||||
NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"),
|
NEXT_PLAYER("next player"), BUILD_SETTLEMENT("build settlement"), BUILD_CITY("build city"),
|
||||||
BUILD_ROAD("build road"), TRADE_WITH_BANK("trade with bank"), QUIT("quit");
|
BUILD_ROAD("build road"), TRADE_WITH_BANK("trade with bank"), QUIT("quit");
|
||||||
|
|
||||||
private final String commandWord;
|
private final String commandWord;
|
||||||
|
|
||||||
|
|
||||||
Command(String commandWord) {
|
Command(String commandWord) {
|
||||||
this.commandWord = commandWord;
|
this.commandWord = commandWord;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,11 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public class Player {
|
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 Config.Faction faction;
|
||||||
private final HashMap<Config.Resource, Integer> resources;
|
private final HashMap<Config.Resource, Integer> resources;
|
||||||
private final HashMap<Config.Structure, Integer> structureToUse;
|
private final HashMap<Config.Structure, Integer> structureToUse;
|
||||||
|
|
|
@ -5,7 +5,6 @@ import ch.zhaw.hexboard.HexBoardTextView;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Class extends the Class HexBoardTextView
|
* This Class extends the Class HexBoardTextView
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class SiedlerBoardTextView extends HexBoardTextView<Land, Settlement, Road, String> {
|
public class SiedlerBoardTextView extends HexBoardTextView<Land, Settlement, Road, String> {
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,6 @@ public class SiedlerGame {
|
||||||
* or players is not between two and four
|
* or players is not between two and four
|
||||||
*/
|
*/
|
||||||
public SiedlerGame(int winPoints, int numberOfPlayers) {
|
public SiedlerGame(int winPoints, int numberOfPlayers) {
|
||||||
if (winPoints < 3 || numberOfPlayers < Config.MIN_NUMBER_OF_PLAYERS || numberOfPlayers > 4) {
|
|
||||||
throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
bank = new Bank();
|
bank = new Bank();
|
||||||
board = new SiedlerBoard();
|
board = new SiedlerBoard();
|
||||||
board.createFixGameField();
|
board.createFixGameField();
|
||||||
|
@ -154,6 +151,11 @@ public class SiedlerGame {
|
||||||
return allPlayers.get(activePlayer).getSpecificResource(resource);
|
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() {
|
public HashMap<Config.Resource, Integer> getCurrentPlayerResource() {
|
||||||
return allPlayers.get(activePlayer).getResources();
|
return allPlayers.get(activePlayer).getResources();
|
||||||
}
|
}
|
||||||
|
|
|
@ -311,6 +311,8 @@ public class SiedlerGameTest {
|
||||||
game.placeInitialRoad(secondRoad.first, secondRoad.second);
|
game.placeInitialRoad(secondRoad.first, secondRoad.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println(game.getBoard().getTextView());
|
||||||
|
|
||||||
return game;
|
return game;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue