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()
BlackjackEngine
getNumberOfDecks
in interface BlackjackEngine
public void createAndShuffleGameDeck()
BlackjackEngine
createAndShuffleGameDeck
in interface BlackjackEngine
public Card[] getGameDeck()
BlackjackEngine
getGameDeck
in interface BlackjackEngine
public void deal()
BlackjackEngine
deal
in interface BlackjackEngine
public Card[] getDealerCards()
BlackjackEngine
getDealerCards
in interface BlackjackEngine
public int[] getDealerCardsTotal()
BlackjackEngine
getDealerCardsTotal
in interface BlackjackEngine
public int getDealerCardsEvaluation()
BlackjackEngine
getDealerCardsEvaluation
in interface BlackjackEngine
public Card[] getPlayerCards()
BlackjackEngine
getPlayerCards
in interface BlackjackEngine
public int[] getPlayerCardsTotal()
BlackjackEngine
getPlayerCardsTotal
in interface BlackjackEngine
public int getPlayerCardsEvaluation()
BlackjackEngine
getPlayerCardsEvaluation
in interface BlackjackEngine
public void playerHit()
BlackjackEngine
playerHit
in interface BlackjackEngine
public void playerStand()
BlackjackEngine
playerStand
in interface BlackjackEngine
public int getGameStatus()
BlackjackEngine
getGameStatus
in interface BlackjackEngine
public void setBetAmount(int amount)
BlackjackEngine
setBetAmount
in interface BlackjackEngine
public int getBetAmount()
BlackjackEngine
getBetAmount
in interface BlackjackEngine
public void setAccountAmount(int amount)
BlackjackEngine
setAccountAmount
in interface BlackjackEngine
public int getAccountAmount()
BlackjackEngine
getAccountAmount
in interface BlackjackEngine