|
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.Game
Game manages the blackjack game, including the deck, round, house rules, basic strategy, and preferences.
| Field Summary | |
private IBasicStrategy |
basicStrategy
The basic strategy tutor |
private double |
currentBalance
The user's current balance |
private IDeck |
deck
The set of cards to be dealt |
private IHouseRules |
houseRules
The set of casino options |
private int |
initialBet
The user's initial bet for the current round |
private IPreferences |
preferences
The set of game preferences |
private IRound |
round
The current round of play |
private boolean |
roundActive
Indicates whether the current round is active |
| Fields inherited from class com.amoebacode.blackjack.core.GameObject |
listeners, parent |
| Constructor Summary | |
Game()
Default public constructor. |
|
| Method Summary | |
boolean |
canDeal()
Indicates whether the next round can be dealt. |
boolean |
canLowerBet()
Indicates whether the user can lower the initial bet. |
boolean |
canRaiseBet()
Indicates whether the user can raise the initial bet. |
private void |
changeInitialBet(int betChange)
Modifies the initial bet according to the specified change and notifies the GUI listeners. |
void |
checkAction(IPlayerHand playerHand,
java.lang.String action,
int dealerScore)
Checks whether the specified user action is the proper basic strategy play based on the specified dealer score. |
void |
deal()
Clears the current round and starts the next one (called when the deal button is clicked). |
void |
executeCommand(ICommand command)
Executes the specified game command, updates the available commands, finishes the round (when necessary). |
void |
finishRound()
Displays the game buttons, updates the current balance, and lowers the initial bet (if necessary). |
double |
getCurrentBalance()
Returns the user's current balance. |
IDeck |
getDeck()
Returns the set of cards to be dealt. |
private GameEventListenerCollection |
getGameEventListenerCollection()
Returns the event listener collection for this game. |
IHouseRules |
getHouseRules()
Returns the casino options manager. |
int |
getInitialBet()
Returns the user's initial bet for the current round. |
protected int |
getNumberOfDecks()
Returns the number of decks that are currently being dealt per shoe (as specified in the casino options). |
IRound |
getRound()
Returns the current round of play. |
void |
lowerBet()
Lowers the initial bet by the default bet interval. |
void |
raiseBet()
Raises the initial bet by the default bet interval. |
void |
saveOptions()
Saves the user-selected casino options. |
private void |
setupBasicStrategy()
Sets up the basic strategy tutor and notifies the GUI listeners. |
private void |
setupDeck()
Sets up the deck and notifies the GUI listeners. |
private void |
setupHouseRules()
Sets up the casino options and notifies the GUI listeners. |
private void |
setupPreferences()
Sets up the user preferences and notifies the GUI listeners. |
private void |
setupRound()
Sets up the current round and notifies the GUI listeners. |
void |
shuffleDeck()
Shuffles the deck of cards to be dealt. |
void |
startGame()
Sets up the game, including the current round, the casino options, the user preferences, basic strategy, and the shoe. |
private void |
startNextRound()
Starts the next round (shuffling if necessary) and hides the game buttons. |
private void |
updateAvailableCommands()
Updates the sets of available game and player hand commands for each GUI listener. |
private void |
updateAvailableGameCommands()
Updates the set of available game commands for each GUI listener. |
private void |
updateCurrentBalance()
Increases the current balance by the specified amount and notifies the GUI listeners. |
| 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.IGameObject |
addEventListener, getGame, getParent |
| Field Detail |
private IRound round
private IDeck deck
private IPreferences preferences
private IHouseRules houseRules
private IBasicStrategy basicStrategy
private int initialBet
private double currentBalance
private boolean roundActive
| Constructor Detail |
public Game()
| Method Detail |
public void startGame()
IGamestartGame in interface IGameIGame.startGame()private void setupRound()
private void setupHouseRules()
private void setupPreferences()
private void setupBasicStrategy()
private void setupDeck()
public IHouseRules getHouseRules()
IGamegetHouseRules in interface IGameIGame.getHouseRules()public void raiseBet()
IGameraiseBet in interface IGameIGame.raiseBet()public void lowerBet()
IGamelowerBet in interface IGameIGame.lowerBet()private void changeInitialBet(int betChange)
betChange - the change to the initial betpublic boolean canLowerBet()
IGamecanLowerBet in interface IGameIGame.canLowerBet()public boolean canRaiseBet()
IGamecanRaiseBet in interface IGameIGame.canRaiseBet()public boolean canDeal()
IGamecanDeal in interface IGameIGame.canDeal()public void finishRound()
IGamefinishRound in interface IGameIGame.finishRound()public void shuffleDeck()
IGameshuffleDeck in interface IGameIGame.shuffleDeck()public void deal()
IGamedeal in interface IGameIGame.deal()private void startNextRound()
private void updateCurrentBalance()
netChange - the amount by which to increase/decrease the current balancepublic IDeck getDeck()
IGamegetDeck in interface IGameIGame.getDeck()public void saveOptions()
IGamesaveOptions in interface IGameIGame.saveOptions()
public void checkAction(IPlayerHand playerHand,
java.lang.String action,
int dealerScore)
IGamecheckAction in interface IGameIGame.checkAction(IPlayerHand, String, int)protected int getNumberOfDecks()
public double getCurrentBalance()
IGamegetCurrentBalance in interface IGameIGame.getCurrentBalance()public int getInitialBet()
IGamegetInitialBet in interface IGameIGame.getInitialBet()public void executeCommand(ICommand command)
IGameexecuteCommand in interface IGameIGame.executeCommand(ICommand)private void updateAvailableCommands()
private void updateAvailableGameCommands()
public IRound getRound()
IGamegetRound in interface IGameIGame.getRound()private GameEventListenerCollection getGameEventListenerCollection()
|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||