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, setMode
addObserver, broadcast, broadcast, broadcast, notify
protected java.lang.String getGameName()
GameFactory
.getGameName
in class GameMaster
protected int getNumberOfPlayers()
getNumberOfPlayers
in class GameMaster
protected int getCardsPerPlayer()
getCardsPerPlayer
in class GameMaster
protected boolean isWithTurns()
isWithTurns
in class GameMaster
true
if game is with turns; false
otherwise.protected void startGame()
startGame
in class GameMaster
protected void checkCards(java.lang.String nick, java.util.List<Card> cards) throws CardGameException
checkCards
in class GameMaster
nick
- of player.cards
- to check.CardGameException
- if a rule was violated.protected void beforeRoundConclusion()
beforeRoundConclusion
in class GameMaster
protected int getRoundPoints(java.lang.String nick)
beforeRoundConclusion()
.
Hearts count as negative pointsgetRoundPoints
in class GameMaster
nick
- of player.protected java.lang.String initialTurnInRound()
beforeRoundConclusion()
.initialTurnInRound
in class GameMaster
protected boolean hasEnded()
hasEnded
in class GameMaster
true
if game ended; false
otherwise.protected java.lang.String getWinner()
getWinner
in class GameMaster
protected GamePlayingStrategy getCardGameStrategy()
HeartsGameSimpleStrategy
and
HeartsGameStrategy
.getCardGameStrategy
in class GameMaster