Blackjack

com.amoebacode.blackjack.strategy
Class BasicStrategyHand

java.lang.Object
  |
  +--com.amoebacode.blackjack.strategy.BasicStrategyHand

class BasicStrategyHand
extends java.lang.Object

BasicStrategyFactory calculates the proper strategy tables, depending on the current house rules.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  int[] hardValues
          The array of hard card values in this hand
private  int[] softValues
          The array of soft card values in this hand
 
Constructor Summary
protected BasicStrategyHand(java.lang.String cards)
          Default protected constructor.
 
Method Summary
protected  int getBestTotal()
          Returns the best score for this hand (the highest non-busting score).
protected  int getHardTotal()
          Returns the hard score for this hand (the sum of all card hard scores).
private  int getMaximumSafeHitScore()
          Returns the maximum hard score that can be safely hit.
protected  int getSoftTotal()
          Returns the soft score for this hand (the sum of all card soft scores).
protected  boolean hasBlackjack()
          Indicates whether this hand has Blackjack.
protected  boolean hasBusted()
          Indicates whether this hand has busted.
protected  boolean hasPair()
          Indicates whether this hand is a pair.
protected  boolean hasSoftTotal()
          Indicates whether this hand has a soft total.
private  boolean shouldUseMixedTotal()
          Indicates whether the optimal score involves mixing soft and hard scores.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

softValues

private int[] softValues
The array of soft card values in this hand

hardValues

private int[] hardValues
The array of hard card values in this hand
Constructor Detail

BasicStrategyHand

protected BasicStrategyHand(java.lang.String cards)
Default protected constructor.
Parameters:
cards - a String representing the cards in the hand
Method Detail

hasPair

protected boolean hasPair()
Indicates whether this hand is a pair.
Returns:
true if the hand is a pair

hasSoftTotal

protected boolean hasSoftTotal()
Indicates whether this hand has a soft total.
Returns:
true if the hand has a soft total

getMaximumSafeHitScore

private int getMaximumSafeHitScore()
Returns the maximum hard score that can be safely hit.
Returns:
the maximum safe hit score

getSoftTotal

protected int getSoftTotal()
Returns the soft score for this hand (the sum of all card soft scores).
Returns:
the soft total

getHardTotal

protected int getHardTotal()
Returns the hard score for this hand (the sum of all card hard scores).
Returns:
the hard total

getBestTotal

protected int getBestTotal()
Returns the best score for this hand (the highest non-busting score).
Returns:
the best total

shouldUseMixedTotal

private boolean shouldUseMixedTotal()
Indicates whether the optimal score involves mixing soft and hard scores.
Returns:
true if the optimal score mixes soft and hard scores

hasBusted

protected boolean hasBusted()
Indicates whether this hand has busted.
Returns:
true if the hand has busted

hasBlackjack

protected boolean hasBlackjack()
Indicates whether this hand has Blackjack.
Returns:
true if the hand has Blackjack

Blackjack

Copyright © 2002 amoebacode.com.