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)
GinRummyPlayer
startGame
in interface GinRummyPlayer
playerNum
- player's 0-based player number (0/1)startingPlayerNum
- starting player number (0/1)cards
- dealt cardspublic boolean willDrawFaceUpCard(Card card)
GinRummyPlayer
willDrawFaceUpCard
in interface GinRummyPlayer
card
- face-up card on the draw pilepublic void reportDraw(int playerNum, Card drawnCard)
GinRummyPlayer
reportDraw
in interface GinRummyPlayer
playerNum
- - 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()
GinRummyPlayer
getDiscard
in interface GinRummyPlayer
public void reportDiscard(int playerNum, Card discardedCard)
GinRummyPlayer
reportDiscard
in interface GinRummyPlayer
playerNum
- the discarding playerdiscardedCard
- the card that was discardedpublic java.util.ArrayList<java.util.ArrayList<Card>> getFinalMelds()
GinRummyPlayer
getFinalMelds
in interface GinRummyPlayer
public void reportFinalMelds(int playerNum, java.util.ArrayList<java.util.ArrayList<Card>> melds)
GinRummyPlayer
reportFinalMelds
in interface GinRummyPlayer
playerNum
- player that has revealed meldsmelds
- an ArrayList of ArrayLists of melded cardspublic void reportScores(int[] scores)
GinRummyPlayer
reportScores
in interface GinRummyPlayer
scores
- current player scores, indexed by 0-based player number