public class Blackjack extends java.lang.Object implements BlackjackEngine
BLACKJACK, BUST, DEALER_WON, DRAW, GAME_IN_PROGRESS, HAS_21, LESS_THAN_21, PLAYER_WON| Constructor and Description |
|---|
Blackjack(java.util.Random randomGenerator,
int numberOfDecks)
Initializes the player's account
to 200.00 and the initial bet to 5.
|
| Modifier and Type | Method and Description |
|---|---|
void |
createAndShuffleGameDeck()
Creates and shuffles the card deck(s) using the random
number generator that was passed in to the constructor.
|
void |
deal()
Creates new deck(s) of cards and shuffles them;
assigns cards to the dealer and player.
|
int |
getAccountAmount()
Returns the player's account amount
|
int |
getBetAmount()
Returns an integer representing the bet amount.
|
Card[] |
getDealerCards()
Returns dealer's cards.
|
int |
getDealerCardsEvaluation()
Returns an integer value that can assume the values
LESS_THAN_21 if the dealer's cards have a value less than 21,
BUST if the dealer's cards have a value greater than 21, and
BLACKJACK if the dealer has an Ace along with a "10", Jack, Queen, or King.
|
int[] |
getDealerCardsTotal()
Returns an array representing the possible value(s) associated with the
dealer's cards if the cards represent a value less than or equal to 21.
|
Card[] |
getGameDeck()
Returns the current deck(s) of cards.
|
int |
getGameStatus()
Returns an integer representing the game status.
|
int |
getNumberOfDecks()
Returns the number of decks being used.
|
Card[] |
getPlayerCards()
Returns player's cards.
|
int |
getPlayerCardsEvaluation()
Returns an integer value that can assume the values
LESS_THAN_21 if the player's cards have a value less than 21,
BUST if the players's cards have a value greater than 21, and
BLACKJACK if the player has an Ace along with a "10", Jack, Queen, or King.
|
int[] |
getPlayerCardsTotal()
Returns an array representing the possible value(s) associated with the
player's cards if the cards represent a value less than or equal to 21.
|
void |
playerHit()
Retrieves a card from the deck and assigns the card to the player.
|
void |
playerStand()
Flips the dealer's card that is currently face down
and assigns cards to the dealer as long as the dealer
doesn't bust and the cards have a value less than 16.
|
void |
setAccountAmount(int amount)
Updates the player's account with the parameter value.
|
void |
setBetAmount(int amount)
Updates the bet amount to the provided value
|
public Blackjack(java.util.Random randomGenerator,
int numberOfDecks)
numberOfDecks - public int getNumberOfDecks()
BlackjackEnginegetNumberOfDecks in interface BlackjackEnginepublic void createAndShuffleGameDeck()
BlackjackEnginecreateAndShuffleGameDeck in interface BlackjackEnginepublic Card[] getGameDeck()
BlackjackEnginegetGameDeck in interface BlackjackEnginepublic void deal()
BlackjackEnginedeal in interface BlackjackEnginepublic Card[] getDealerCards()
BlackjackEnginegetDealerCards in interface BlackjackEnginepublic int[] getDealerCardsTotal()
BlackjackEnginegetDealerCardsTotal in interface BlackjackEnginepublic int getDealerCardsEvaluation()
BlackjackEnginegetDealerCardsEvaluation in interface BlackjackEnginepublic Card[] getPlayerCards()
BlackjackEnginegetPlayerCards in interface BlackjackEnginepublic int[] getPlayerCardsTotal()
BlackjackEnginegetPlayerCardsTotal in interface BlackjackEnginepublic int getPlayerCardsEvaluation()
BlackjackEnginegetPlayerCardsEvaluation in interface BlackjackEnginepublic void playerHit()
BlackjackEngineplayerHit in interface BlackjackEnginepublic void playerStand()
BlackjackEngineplayerStand in interface BlackjackEnginepublic int getGameStatus()
BlackjackEnginegetGameStatus in interface BlackjackEnginepublic void setBetAmount(int amount)
BlackjackEnginesetBetAmount in interface BlackjackEnginepublic int getBetAmount()
BlackjackEnginegetBetAmount in interface BlackjackEnginepublic void setAccountAmount(int amount)
BlackjackEnginesetAccountAmount in interface BlackjackEnginepublic int getAccountAmount()
BlackjackEnginegetAccountAmount in interface BlackjackEngine