|
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.CardCollection
|
+--com.amoebacode.blackjack.core.Hand
Hand is the base class for all hands (PlayerHand and DealerHand).
| Field Summary | |
private static int |
MAXIMUM_HARD_CARD_SCORE
The maximum hard score for a single card |
private static int |
MAXIMUM_NUMBER_OF_CARDS
The maximum number of cards per hand |
protected static int |
MAXIMUM_SCORE
The maximum non-bust score for a hand |
| Fields inherited from class com.amoebacode.blackjack.core.CardCollection |
cards |
| Fields inherited from class com.amoebacode.blackjack.core.GameObject |
listeners, parent |
| Constructor Summary | |
protected |
Hand(IParticipant participant)
Default public constructor. |
| Method Summary | |
void |
addCard(ICard card)
Adds the specified card to this collection and notifies the GUI listeners. |
void |
clear()
Removes this hand from the table and notifies the GUI listeners. |
int |
getBestTotal()
Returns the best score for this hand (the highest non-busting score). |
int |
getBestTotal(int cardIndex)
Returns the best score for this hand (the highest non-busting score), not including cards beyond the specified index. |
java.lang.String |
getCurrentScore(int cardIndex)
Returns a displayable current score (or "busted" if this hand has busted), not including cards beyond the specified index. |
protected HandEventListenerCollection |
getHandEventListenerCollection()
Returns the event listener collection for this hand. |
int |
getHardTotal()
Returns the hard score for this hand (the sum of all card hard scores). |
protected int |
getHardTotal(int cardIndex)
Returns the hard score for this hand (the sum of all card hard scores), not including cards beyond the specified index. |
protected IHouseRules |
getHouseRules()
Returns the casino options manager. |
private static int |
getMaximumSafeHitScore()
Returns the maximum hand score that is safe to hit. |
protected IRound |
getRound()
Returns the current round this hand belongs to. |
int |
getSoftTotal()
Returns the soft score for this hand (the sum of all card soft scores). |
protected int |
getSoftTotal(int cardIndex)
Returns the soft score for this hand (the sum of all card soft scores), not including cards beyond the specified index. |
protected abstract java.lang.String |
getTotalLabel()
Returns the prefix for the current score label (for example, "Score:"). |
boolean |
hasBlackjack()
Indicates whether this hand has blackjack. |
boolean |
hasBusted()
Indicates whether this hand has busted. |
protected boolean |
hasMaximumNumberOfCards()
Indicates whether this hand has the maximum number of cards. |
protected boolean |
hasMaximumScore()
Indicates whether this hand has the maximum score. |
boolean |
hasPair()
Indicates whether this hand contains a pair of matching scores. |
boolean |
hasSoftTotal()
Indicates whether this hand has a soft total |
void |
hit()
Adds a card from the deck to this hand and begins its animation. |
private boolean |
shouldUseMixedTotal(int cardIndex)
Indicates whether the optimal score involves mixing soft and hard scores. |
| Methods inherited from class com.amoebacode.blackjack.core.CardCollection |
getCardAt, getNextCard, getNumberOfCards, setCards |
| 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.ICardCollection |
getCardAt, getNextCard, getNumberOfCards, setCards |
| Methods inherited from interface com.amoebacode.blackjack.core.IGameObject |
addEventListener, getGame, getParent |
| Field Detail |
private static final int MAXIMUM_NUMBER_OF_CARDS
protected static final int MAXIMUM_SCORE
private static final int MAXIMUM_HARD_CARD_SCORE
| Constructor Detail |
protected Hand(IParticipant participant)
participant - the participant that owns this hand| Method Detail |
protected HandEventListenerCollection getHandEventListenerCollection()
protected abstract java.lang.String getTotalLabel()
public int getSoftTotal()
IHandgetSoftTotal in interface IHandIHand.getSoftTotal()protected int getSoftTotal(int cardIndex)
cardIndex - the last card in this hand to include in the soft scorepublic int getHardTotal()
IHandgetHardTotal in interface IHandIHand.getHardTotal()protected int getHardTotal(int cardIndex)
cardIndex - the last card in this hand to include in the hard scorepublic int getBestTotal()
IHandgetBestTotal in interface IHandIHand.getBestTotal()public int getBestTotal(int cardIndex)
IHandgetBestTotal in interface IHandIHand.getBestTotal(int)private boolean shouldUseMixedTotal(int cardIndex)
public java.lang.String getCurrentScore(int cardIndex)
IHandgetCurrentScore in interface IHandIHand.getCurrentScore(int)public boolean hasBusted()
IHandhasBusted in interface IHandIHand.hasBusted()protected boolean hasMaximumNumberOfCards()
protected boolean hasMaximumScore()
public void hit()
IHandhit in interface IHandIHand.hit()public void addCard(ICard card)
ICardCollectionaddCard in interface ICardCollectionaddCard in class CardCollectionICardCollection.addCard(ICard)public boolean hasBlackjack()
IHandhasBlackjack in interface IHandIHand.hasBlackjack()public boolean hasPair()
IHandhasPair in interface IHandIHand.hasPair()private static int getMaximumSafeHitScore()
public boolean hasSoftTotal()
IHandhasSoftTotal in interface IHandIHand.hasSoftTotal()public void clear()
IHandclear in interface IHandIHand.clear()protected IRound getRound()
protected IHouseRules getHouseRules()
|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||