Blackjack

com.amoebacode.blackjack.core
Interface IPlayer

All Superinterfaces:
IGameObject, IParticipant
All Known Implementing Classes:
Player

public interface IPlayer
extends IParticipant

IPlayer definies public API for a player, including access to the hands, initial bet, and net gain.

Version:
0.9
Author:
Jason Gurney

Field Summary
static int MAXIMUM_NUMBER_OF_HANDS
          The maximum number of hands that can be played
 
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.
 double getNetGain()
          Returns the user's net gain for the current round.
 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 split(IPlayerHand playerHand)
          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 interface com.amoebacode.blackjack.core.IParticipant
allHandsBlackjack, clear, getFirstHand, getNumberOfHands, setupFirstHand
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Field Detail

MAXIMUM_NUMBER_OF_HANDS

public static final int MAXIMUM_NUMBER_OF_HANDS
The maximum number of hands that can be played
Method Detail

getNetGain

public double getNetGain()
Returns the user's net gain for the current round.
Returns:
the net gain

allHandsFinished

public boolean allHandsFinished()
Indicates whether all of the player hands have finished.
Returns:
true if none of the player hands can act

updateAvailableCommands

public void updateAvailableCommands()
Updates the set of available player hand commands for each GUI listener.

allHandsBustedOrSurrendered

public boolean allHandsBustedOrSurrendered()
Indicates whether all of the player hands have busted or surrendered. (This means that the dealer does not need to take any cards.)
Returns:
true if all of the player hands have busted or surrendered

setInitialBet

public void setInitialBet(int initialBet)
Sets the initial bet for the current round.
Parameters:
initialBet - the player's initial bet for the current round

computeNetGain

public 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.
Parameters:
dealerScore - the dealer score

hasMaximumNumberOfHands

public boolean hasMaximumNumberOfHands()
Indicates whether the user is playing the maximum number of hands.
Returns:
true if the user is playing the maximum number of hands

split

public void split(IPlayerHand playerHand)
Splits the specified hand into two hands (as long as the player has less than the maximum number of hands).
Parameters:
hand - the IPlayerHand to split

Blackjack

Copyright © 2002 amoebacode.com.