public class SimpleGinRummyPlayer extends java.lang.Object implements GinRummyPlayer
| Constructor and Description |
|---|
SimpleGinRummyPlayer() |
| Modifier and Type | Method and Description |
|---|---|
Card |
getDiscard()
Get the player's discarded card.
|
java.util.ArrayList<java.util.ArrayList<Card>> |
getFinalMelds()
At the end of each turn, this method is called and the player that cannot (or will not) end the round will return a null value.
|
void |
reportDiscard(int playerNum,
Card discardedCard)
Report that the given player has discarded a given card.
|
void |
reportDraw(int playerNum,
Card drawnCard)
Report that the given player has drawn a given card and, if known, what the card is.
|
void |
reportFinalMelds(int playerNum,
java.util.ArrayList<java.util.ArrayList<Card>> melds)
When an player has ended play and formed melds, the melds are reported to both players.
|
void |
reportScores(int[] scores)
Report current player scores, indexed by 0-based player number.
|
void |
startGame(int playerNum,
int startingPlayerNum,
Card[] cards)
Inform player of 0-based player number (0/1), starting player number (0/1), and dealt cards
|
boolean |
willDrawFaceUpCard(Card card)
Return whether or not player will draw the given face-up card on the draw pile.
|
public void startGame(int playerNum,
int startingPlayerNum,
Card[] cards)
GinRummyPlayerstartGame in interface GinRummyPlayerplayerNum - player's 0-based player number (0/1)startingPlayerNum - starting player number (0/1)cards - dealt cardspublic boolean willDrawFaceUpCard(Card card)
GinRummyPlayerwillDrawFaceUpCard in interface GinRummyPlayercard - face-up card on the draw pilepublic void reportDraw(int playerNum,
Card drawnCard)
GinRummyPlayerreportDraw in interface GinRummyPlayerplayerNum - - player drawing a carddrawnCard - - the card drawn or null, depending on whether the card is known to the player or not, respectively.public Card getDiscard()
GinRummyPlayergetDiscard in interface GinRummyPlayerpublic void reportDiscard(int playerNum,
Card discardedCard)
GinRummyPlayerreportDiscard in interface GinRummyPlayerplayerNum - the discarding playerdiscardedCard - the card that was discardedpublic java.util.ArrayList<java.util.ArrayList<Card>> getFinalMelds()
GinRummyPlayergetFinalMelds in interface GinRummyPlayerpublic void reportFinalMelds(int playerNum,
java.util.ArrayList<java.util.ArrayList<Card>> melds)
GinRummyPlayerreportFinalMelds in interface GinRummyPlayerplayerNum - player that has revealed meldsmelds - an ArrayList of ArrayLists of melded cardspublic void reportScores(int[] scores)
GinRummyPlayerreportScores in interface GinRummyPlayerscores - current player scores, indexed by 0-based player number