Sei sulla pagina 1di 3

THE

BLACKJACK ASSIGNMENT

!
!

Goal
The goal of the assignment is to implement a simplified version of the popular card game
Blackjack that can be played by a single player from the command prompt.

Much of the implementation is already done (see the attached archive) and only a segment of
the code needs to be populated by you.

!
But first, lets see the rules.

!
!

The game of Blackjack


In the game of blackjack, one or more players play against the dealer. In the version we need to
implement only a single player can play vs. the dealer. At the start of the game the player is
dealt two cards face up. The dealer is dealt one card face up and one card face down. Then,
the player can get more cards (hits) until he/she stands orbusts.

The dealer is the last person to play. When the dealer starts to play, he/she turns his second
card to face up. The dealer has no choice in how he/she plays his/her hand: if his/her total is 17
or higher, he/she must stand, and if his/her total is 16 or less he/she must hit. If the dealer has
an ace and one of the possible totals is greater than 16 but less than or equal to 21, then the
dealer must stand.

The object of the game is to get a total thats as close to 21 as possible, without getting a total
over 21. Each card with a numerical rank (2, 3, ..., 10) is worth its numerical value, face cards
are worth 10, and an ace is worth 1 or 11. (Suits dont matter.) A total over 21 is a bust. A
total of 21 in the first two cards is called a natural or blackjack.. A natural beats a score of
21 in three or more cards. Otherwise a score closer to (but less than or equal to) 21 wins.

!
If the score is a tie, than the dealer is considered a winner of the game.

!
!
The Program

The archive attached to this assignment contains the project for this program written for Java 6
SE. Our developer has written and documented most of the code needed for the
implementation aside for the game logic itself. The project includes the following Java classes:

Card - bean representing a single playing card. The bean contains the properties of the card
suit (one of Spades, Hearts, Diamonds or Clubs) and card value (1 to 13) along with helper

THE

BLACKJACK ASSIGNMENT

methods to form a string representation of the object.

Deck - bean representing a collection of 52 playing cards consisting of all combinations of


suits and card values. The class has a method to shue the cards order in the deck and deal
a single card from the deck.

Hand - a representation of a player or dealer's hand. The object contains the cards dealt to a
player or dealer from the playing deck. The class contains methods to calculate the value of
the hand according to Blackjack rules.

App - the main entry point of the program. It constructs a Blackjack object and invokes it's
play method.

Blackjack - the implementation of the game itself. Upon construction of the object the
object creates a new deck of cards, shues it and than performs initial dealing of cards to
the player and dealer.

The goal of the assignment is to implement the play method in the Blackjack class
according to the instructions given inside the method itself as seen in the following image:

You are free to use any additional helper methods and classes as long as they are written by
you :)

THE

BLACKJACK ASSIGNMENT

!
!
!

Valuation
The valuation of the assignment will be done by the following criteria's, listed by priority in a
descending order (most important first):

!1.

Correctness - the program implementation needs to perform correctly according to the


rules of the game described above and the instructions given in the code.

2. Quality - is the code comprehensible and does it oer the best solution or does it contain
unnecessary calculations or other overhead.

3. Cleanliness - is the code formatted and documented properly.

!!
!
Thank you and good luck!
!
!
!!
!
!

Potrebbero piacerti anche