blackjackGUILibrary
Interface BlackjackEngine

All Known Implementing Classes:
Blackjack

public interface BlackjackEngine

BlackJackEngine - interface defining the methods expected from a class implementing the Blackjack game logic.

Author:
cmsc132 Fall 2005 Copyright (C) 2005 University of Maryland
See Also:
Card

Field Summary
static int BLACKJACK
           
static int BUST
           
static int DEALER_WON
           
static int DRAW
           
static int GAME_IN_PROGRESS
           
static int HAS_21
           
static int LESS_THAN_21
           
static int PLAYER_WON
           
 
Method Summary
 void createAndShuffleGameDeck()
          Creates and shuffles the card deck using a random number generator.
 void deal()
          Creates and shuffles the deck.
 double getAccountAmount()
          Returns the player's account amount
 double getBetAmount()
          Returns a double 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 dealers's cards have a value less than 21, BUST if the dealers's cards have a value greater than 21, and BLACKJACK if the dealer has an Ace along with a Jack, Queen, or King.
 int[] getDealerCardsTotal()
          Returns an array representing the possible value(s) associated with the dealers's cards if the card's represent a value less than or equal to 21.
 Card[] getGameDeck()
          Returns the current deck 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 player's cards have a value greater than 21, and BLACKJACK if the player has an Ace along with a Jack, Queen, or King.
 int[] getPlayerCardsTotal()
          Returns an array representing the possible value(s) associated with the player's cards if the card's represent a value less than or equal to 21.
 void playerHit()
          Retrieves cards from the deck and assigns the card to 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(double amount)
          Updates the player's account with the parameter value.
 boolean setBetAmount(double amount)
          Updates the bet amount to the provided value if the bet amount does not exceeds the current account amount.
 

Field Detail

DRAW

static final int DRAW
See Also:
Constant Field Values

LESS_THAN_21

static final int LESS_THAN_21
See Also:
Constant Field Values

BUST

static final int BUST
See Also:
Constant Field Values

BLACKJACK

static final int BLACKJACK
See Also:
Constant Field Values

HAS_21

static final int HAS_21
See Also:
Constant Field Values

DEALER_WON

static final int DEALER_WON
See Also:
Constant Field Values

PLAYER_WON

static final int PLAYER_WON
See Also:
Constant Field Values

GAME_IN_PROGRESS

static final int GAME_IN_PROGRESS
See Also:
Constant Field Values
Method Detail

getNumberOfDecks

int getNumberOfDecks()
Returns the number of decks being used.

Returns:
number of decks

createAndShuffleGameDeck

void createAndShuffleGameDeck()
Creates and shuffles the card deck using a random number generator. When creating the deck of cards load the suits in the following order: SPADES, DIAMONDS, HEARTS and CLUBS. At the same time, each suit should be loading starting with the ACE, followed by cards with a face value of "2" through "10", followed by the "JACK", "QUEEN", and "KING".


getGameDeck

Card[] getGameDeck()
Returns the current deck of cards .

Returns:
Card array representing deck of cards.

deal

void deal()
Creates and shuffles the deck. It then retrieves cards from the deck and assigns cards to the dealer and player. A total of four cards are dealt where the player receives the first card. The first card the dealer receives must be face down. Once the cards have been dealt the game's status will be GAME_IN_PROGRESS.

See Also:
createAndShuffleGameDeck

getDealerCards

Card[] getDealerCards()
Returns dealer's cards.

Returns:
Card array representing the dealer's cards.

getDealerCardsTotal

int[] getDealerCardsTotal()
Returns an array representing the possible value(s) associated with the dealers's cards if the card's represent a value less than or equal to 21.

Returns:
Integer array representing the possible value(s) or null if cards represent a value higher than 21.

getDealerCardsEvaluation

int getDealerCardsEvaluation()
Returns an integer value that can assume the values LESS_THAN_21 if the dealers's cards have a value less than 21, BUST if the dealers's cards have a value greater than 21, and BLACKJACK if the dealer has an Ace along with a Jack, Queen, or King. If the dealers's cards have a value equivalent to 21 and the hand does not correspond to a blackjack, HAS_21 will be returned.

Returns:
Integer value that corresponds to one of the following: LESS_THAN_21, BUST, BLACKJACK, HAS_21

getPlayerCards

Card[] getPlayerCards()
Returns player's cards.

Returns:
Card array representing the player's cards.

getPlayerCardsTotal

int[] getPlayerCardsTotal()
Returns an array representing the possible value(s) associated with the player's cards if the card's represent a value less than or equal to 21.

Returns:
Integer array representing the possible value(s) or null if cards represent a value higher than 21.

getPlayerCardsEvaluation

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 player's cards have a value greater than 21, and BLACKJACK if the player has an Ace along with a Jack, Queen, or King. If the player's cards have a value equivalent to 21 and the hand does not correspond to a blackjack, HAS_21 will be returned.

Returns:
Integer value that corresponds to one of the following: LESS_THAN_21, BUST, BLACKJACK, HAS_21

playerHit

void playerHit()
Retrieves cards from the deck and assigns the card to player. The new sets of cards will be evaluated. If the player busts the game is over and the games's status will be updated to DEALER_WON. Otherwise the game's status is GAME_IN_PROGRESS.


playerStand

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. Once the dealer has a hand with a value greater than or equal to 16, and less than or equal to 21, the hand will be compared against the player's hand and whoever has the hand with a highest value will win the game. If both have the same value we have a draw. The game's status will be updated to one of the following values: DEALER_WON, PLAYER_WON, or DRAW. The player's account will be updated with a value corresponding to twice the bet amount if the player wins. If there is a draw the player's account will be updated with the only the bet amount.


setBetAmount

boolean setBetAmount(double amount)
Updates the bet amount to the provided value if the bet amount does not exceeds the current account amount.

Returns:
true if the bet has been set and false otherwise.

getBetAmount

double getBetAmount()
Returns a double representing the bet amount.

Returns:
bet amount.

setAccountAmount

void setAccountAmount(double amount)
Updates the player's account with the parameter value.

Parameters:
amount -

getAccountAmount

double getAccountAmount()
Returns the player's account amount

Returns:

getGameStatus

int getGameStatus()
Returns an integer representing the game status.

Returns:
DRAW, PLAYER_WON, DEALER_WON OR GAME_IN_PROGRESS