com.amoebacode.blackjack.strategy
Class StrategyTable
java.lang.Object
|
+--com.amoebacode.blackjack.strategy.StrategyTable
- Direct Known Subclasses:
- HardStrategy, PairStrategy, SoftStrategy
- abstract class StrategyTable
- extends java.lang.Object
StrategyTable is the base class for all strategy tables (hard, soft, pair).
- Version:
- 0.9
- Author:
- Jason Gurney
|
Field Summary |
protected java.util.Map |
actionTable
The collection of strategy table rows |
|
Method Summary |
protected StrategyReminder |
checkAction(IPlayerHand playerHand,
int playerScore,
java.lang.String action,
int dealerScore)
Checks whether the specified user action is the proper basic strategy
play. |
private boolean |
firstChoiceUnavailable(IPlayerHand playerHand,
java.lang.String firstChoice)
Indicates whether the first choice from the correct action is
unavailable. |
protected CorrectAction |
getAction(int playerScore,
int dealerScore)
Returns the correct action for the specified player and dealer scores. |
protected abstract java.lang.String |
getPlayerScore(int playerScore)
Returns a text description of the user's current situation. |
protected StrategyTableRow |
getRow(int playerScore)
Returns the strategy table row corresponding to the specified player
score. |
protected abstract void |
setupRows(StrategyTableRow[] rows)
Loads the strategy table rows into the action table hash map. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
actionTable
protected java.util.Map actionTable
- The collection of strategy table rows
StrategyTable
protected StrategyTable(StrategyTableRow[] rows)
- Default protected constructor.
- Parameters:
rows - an array of strategy table rows
setupRows
protected abstract void setupRows(StrategyTableRow[] rows)
- Loads the strategy table rows into the action table hash map.
- Parameters:
rows - an array of strategy table rows
getPlayerScore
protected abstract java.lang.String getPlayerScore(int playerScore)
- Returns a text description of the user's current situation.
- Returns:
- a text description of the user's current situation
getRow
protected StrategyTableRow getRow(int playerScore)
- Returns the strategy table row corresponding to the specified player
score.
- Parameters:
playerScore - the current player's score- Returns:
- the appropriate strategy table row
getAction
protected CorrectAction getAction(int playerScore,
int dealerScore)
- Returns the correct action for the specified player and dealer scores.
- Parameters:
playerScore - the current player's scoredealerScore - the dealer score- Returns:
- the CorrectAction for this situation
checkAction
protected StrategyReminder checkAction(IPlayerHand playerHand,
int playerScore,
java.lang.String action,
int dealerScore)
- Checks whether the specified user action is the proper basic strategy
play.
- Parameters:
playerHand - the PlayerHand making the actionplayerScore - the current player's scoreaction - a String representing the decision chosendealerScore - the dealer score- Throws:
thows - a StrategyException if the user action is incorrect
firstChoiceUnavailable
private boolean firstChoiceUnavailable(IPlayerHand playerHand,
java.lang.String firstChoice)
- Indicates whether the first choice from the correct action is
unavailable.
- Parameters:
playerHand - the PlayerHand making the actionfirstChoice - the first correct action choice
Copyright © 2002 amoebacode.com.