|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.amoebacode.blackjack.core.GameObject
|
+--com.amoebacode.blackjack.core.Participant
|
+--com.amoebacode.blackjack.core.Player
Player manages the player's hands, initial bet, and net gain.
| Field Summary | |
private int |
initialBet
The user's initial bet for the current round |
private double |
netGain
The user's net gain for the current round |
| Fields inherited from class com.amoebacode.blackjack.core.Participant |
hands |
| Fields inherited from class com.amoebacode.blackjack.core.GameObject |
listeners, parent |
| Fields inherited from interface com.amoebacode.blackjack.core.IPlayer |
MAXIMUM_NUMBER_OF_HANDS |
| Constructor Summary | |
protected |
Player(IRound round)
Default protected constructor. |
| Method Summary | |
boolean |
allHandsBustedOrSurrendered()
Indicates whether all of the player hands have busted or surrendered. |
boolean |
allHandsFinished()
Indicates whether all of the player hands have finished. |
void |
computeNetGain(int dealerScore)
Computes the total net gain for all of the player hands, based on the specified dealer score and notifies the GUI listeners. |
private void |
createSplitHand(ICard splitCard)
Creates a new hand based on the specified split card and notifies the GUI listeners. |
private IPlayerHand |
getFirstPlayer()
Returns the player's first hand. |
double |
getNetGain()
Returns the user's net gain for the current round. |
private PlayerEventListenerCollection |
getPlayerEventListenerCollection()
Returns the event listener collection for this player. |
private IPlayerHand |
getPlayerHandAt(int index)
Returns the specified user's hand. |
boolean |
hasMaximumNumberOfHands()
Indicates whether the user is playing the maximum number of hands. |
void |
setInitialBet(int initialBet)
Sets the initial bet for the current round. |
void |
setupFirstHand()
Sets up the first hand for this participant (called at the beginning of the round) and notifies the GUI listeners. |
void |
split(IPlayerHand hand)
Splits the specified hand into two hands (as long as the player has less than the maximum number of hands). |
void |
updateAvailableCommands()
Updates the set of available player hand commands for each GUI listener. |
| Methods inherited from class com.amoebacode.blackjack.core.Participant |
addHand, allHandsBlackjack, clear, getFirstHand, getHandAt, getNumberOfHands, getRound |
| Methods inherited from class com.amoebacode.blackjack.core.GameObject |
addEventListener, getEventListenerCollection, getGame, getParent, hasParent, setEventListenerCollection |
| Methods inherited from class java.lang.Object |
|
| Methods inherited from interface com.amoebacode.blackjack.core.IParticipant |
allHandsBlackjack, clear, getFirstHand, getNumberOfHands |
| Methods inherited from interface com.amoebacode.blackjack.core.IGameObject |
addEventListener, getGame, getParent |
| Field Detail |
private int initialBet
private double netGain
| Constructor Detail |
protected Player(IRound round)
round - the current IRound| Method Detail |
private PlayerEventListenerCollection getPlayerEventListenerCollection()
public void setInitialBet(int initialBet)
IPlayersetInitialBet in interface IPlayerIPlayer.setInitialBet(int)public void setupFirstHand()
IParticipantsetupFirstHand in interface IParticipantIParticipant.setupFirstHand()public boolean hasMaximumNumberOfHands()
IPlayerhasMaximumNumberOfHands in interface IPlayerIPlayer.hasMaximumNumberOfHands()private IPlayerHand getFirstPlayer()
private IPlayerHand getPlayerHandAt(int index)
index - the index of the specified handpublic void split(IPlayerHand hand)
IPlayersplit in interface IPlayerIPlayer.split(IPlayerHand)private void createSplitHand(ICard splitCard)
splitCard - the ICard split from an existing handpublic boolean allHandsFinished()
IPlayerallHandsFinished in interface IPlayerIPlayer.allHandsFinished()public boolean allHandsBustedOrSurrendered()
IPlayerallHandsBustedOrSurrendered in interface IPlayerIPlayer.allHandsBustedOrSurrendered()public void computeNetGain(int dealerScore)
IPlayercomputeNetGain in interface IPlayerIPlayer.computeNetGain(int)public double getNetGain()
IPlayergetNetGain in interface IPlayerIPlayer.getNetGain()public void updateAvailableCommands()
IPlayerupdateAvailableCommands in interface IPlayerIPlayer.updateAvailableCommands()
|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||