public class HeartsGameMaster extends GameMaster
jpleal@fc.up.pt| Modifier and Type | Field and Description |
|---|---|
(package private) int |
countHeartsInTurn |
(package private) java.lang.String |
holdTurn |
| Constructor and Description |
|---|
HeartsGameMaster() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
beforeRoundConclusion()
Check the cards played by each player.
|
protected void |
checkCards(java.lang.String nick,
java.util.List<Card> cards)
In HEARTS the player must play a single card per turn.
|
protected GamePlayingStrategy |
getCardGameStrategy()
Produce a game strategy for this game instance.
|
protected int |
getCardsPerPlayer()
All players get 1/4 of the deck cards.
|
protected java.lang.String |
getGameName()
Name of this game in capitals, as in
GameFactory. |
protected int |
getNumberOfPlayers()
The number of players in HEARTS is 4.
|
protected int |
getRoundPoints(java.lang.String nick)
Report the points of given player, as computed in
beforeRoundConclusion(). |
protected java.lang.String |
getWinner()
The winner is the player with most points (less negative points).
|
protected boolean |
hasEnded()
The game ends after 13 rounds.
|
protected java.lang.String |
initialTurnInRound()
The player that played the highest card from the suit to follow
start the next round, as computed in
beforeRoundConclusion(). |
protected boolean |
isWithTurns()
HEARTS is a played in turns.
|
protected void |
startGame()
No preparation is needed for HEARTS
|
acceptsPlayers, addPlayer, expired, getCardComparator, getCardOnTable, getCardsOnTable, getDeck, getExpirationtime, getGameId, getHand, getInfo, getMode, getNickWithTurn, getPlayerNicks, getRoundsCompleted, getSuitToFollow, newCardCollection, nickWithMostPoints, playCard, playCards, sendCards, setExpirationtime, setModeaddObserver, broadcast, broadcast, broadcast, notifyprotected java.lang.String getGameName()
GameFactory.getGameName in class GameMasterprotected int getNumberOfPlayers()
getNumberOfPlayers in class GameMasterprotected int getCardsPerPlayer()
getCardsPerPlayer in class GameMasterprotected boolean isWithTurns()
isWithTurns in class GameMastertrue if game is with turns; false otherwise.protected void startGame()
startGame in class GameMasterprotected void checkCards(java.lang.String nick,
java.util.List<Card> cards)
throws CardGameException
checkCards in class GameMasternick - of player.cards - to check.CardGameException - if a rule was violated.protected void beforeRoundConclusion()
beforeRoundConclusion in class GameMasterprotected int getRoundPoints(java.lang.String nick)
beforeRoundConclusion().
Hearts count as negative pointsgetRoundPoints in class GameMasternick - of player.protected java.lang.String initialTurnInRound()
beforeRoundConclusion().initialTurnInRound in class GameMasterprotected boolean hasEnded()
hasEnded in class GameMastertrue if game ended; false otherwise.protected java.lang.String getWinner()
getWinner in class GameMasterprotected GamePlayingStrategy getCardGameStrategy()
HeartsGameSimpleStrategy and
HeartsGameStrategy.getCardGameStrategy in class GameMaster