|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gbayer.basicblackjack.Player
public abstract class Player
A Player
has a name assigned, holds a Hand
of
Cards
, and is capable of taking actions.
Nested Class Summary | |
---|---|
static class |
Player.Action
Action a player can take (or be forced to take). |
Constructor Summary | |
---|---|
Player(java.lang.String name)
Instantiates a new player. |
Method Summary | |
---|---|
void |
dealCard(Card card)
Deal card to player. |
Hand |
getHand()
Gets the player's hand. |
java.lang.String |
getName()
Gets the player's assigned name. |
void |
newHand()
Clear all cards in hand. |
abstract Player.Action |
takeAction(UI ui)
Player takes one or more permitted actions. |
java.lang.String |
toString()
Generates a string containing player's assigned name concatenated with a string representing the player's hand. |
java.lang.String |
toStringShowingTopCardOnly()
Generates a string containing player's assigned name concatenated with a string representing the player's hand with all but the first card face-down. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Player(java.lang.String name)
name
- the nameMethod Detail |
---|
public void newHand()
public void dealCard(Card card)
card
- the cardpublic java.lang.String getName()
public Hand getHand()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringShowingTopCardOnly()
public abstract Player.Action takeAction(UI ui)
ui
- the user interface
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |