COMP 303 (Fall 2005) Project Description
Over the semester you will be required to design, implement and
test a software for playing blackjack (also called twenty one). The
goal of the project is to give you hands-on experience in developing a
well thought out software product using advanced OOP features and
state of the art tools.
The Game: A Quick Look
Blackjack is the most popular table game in casinos and unlike many
other casino games, skillful play in blackjack allows the player to
gain a slight advantage over the casino. The basic premise of the
game is that you want to have a hand value that is closer to 21 than
that of the dealer, without going over 21. Other players at the table
are of no concern. Your hand is strictly played out against the hand
of the dealer. The rules of play for the dealer are strictly dictated,
leaving no decisions up to the dealer. Therefore, there is no
problem with the dealer or any of the other players at the table
seeing the cards in your hand.
Rules
There are many variations on the game of blackjack. Refer to BlackJackInfo.com
for detailed explanations of the rules briefly mentioned here.
The game will be a six deck game. Each hand begins by players making
their desired bet. Once all the bets are made, the dealer will deal
the cards to the players. He'll make two passes around the table
starting at his left so that the players and the dealer have two cards
each.
Once the cards are dealt, play proceeds around the table, starting
at the first seat to the dealer's left, also called first
base. Each player in turn indicates to the dealer how he wishes to
play the hand. The various player decisions are covered in their own
section below. After each player has finished his hand, the dealer
will complete his hand, and then pay or collect the player bets.
Value of a hand
In blackjack, the cards are valued as follows:
- An Ace can count as either 1 or 11.
- The cards from 2 through 9 are valued as indicated.
- The 10, Jack, Queen, and King are all valued at 10.
The suits of the cards do not have any meaning in the game. The value of a
hand is simply the sum of the point counts of each card in the hand. For
example, a hand containing (5,7,9) has the value of 21.
The dealer
The dealer must play his hand in a specific way, with no choices
allowed. The rule to follow is that: "Dealer stands on all
17s". This means that the dealer must continue to take cards
("hit") until his total is 17 or greater. An Ace in the
dealer's hand is always counted as 11 if possible without the dealer
going over 21. For example, (Ace,8) would be 19 and the dealer would
stop drawing cards ("stand"). Also, (Ace,6) is 17 and again
the dealer will stand. (Ace,5) is only 16, so the dealer would
hit. He will continue to draw cards until the hand's value is 17 or
more. For example, (Ace,5,7) is only 13 so he hits again. (Ace,5,7,5)
makes 18 so he would stop ("stand") at that point.
The dealer cannot split pairs, but must instead simply hit until he reaches at
least 17 or busts by going over 21.
What is a Blackjack, or a natural?
A blackjack, or natural, is a total of 21 in your first two
cards. A blackjack is therefore an Ace and any ten-valued card,
with the additional requirement that these be your first two cards. If
you split a pair of Aces for example, and then draw a ten-valued card
on one of the Aces, this is not a blackjack, but rather a total of
21. The distinction is important, because a winning blackjack pays the
player odds of 3 to 2. A bet of $10 wins $15 if the player makes a
blackjack. A player blackjack beats any dealer total other than a
dealer's blackjack, including a dealer's regular 21. If both a player
and the dealer make blackjack, the hand is a tie or push. The dealer
should pay a winning blackjack bet immediately when it is the players
turn to play.
The Player's Choices
- Hitting/Standing
The most common decision a player must make
during the game is whether to draw another card to the hand
("hit"), or stop at the current total
("stand").
- Surrender
Surrender is the choice to fold a hand at the cost
of half the original bet. This decision must be made prior to any
other action on the hand i.e. on the original two cards dealt to a
player by the dealer. This is called EARLY SURRENDER. A more common
rule is the rule of LATE SURRENDER in which a player is not allowed
to surrender if the dealer on checking his card finds a
blackjack. Late Surrender will not be implemented in this
project.
- Doubling Down
This can only be done with a two card hand,
before another card has been drawn. Doubling down allows you to
double your bet and receive one, and only one, additional card to
the hand. Players are only allowed to double the amount originally
bid. This is different from the rules most casinos follow where you
are allowed to "double for less". For sake of simplicity
this option is not to be supported. The extra card is dealt to the
player face down and the value of the card and the subsequent result
of the hand is decided only after the dealer has played his/her
hand.
- Splitting Pairs
When a player is dealt a matching pair of
cards they have the ability to split the hand into two separate
hands, and play them independently. Note that the same amount of bet
has to be added on a split, unlike a double-down, where you are
allowed to double for less. If you get additional pairs (in the
first two cards of a hand), you are allowed to re-split, making yet
another hand. For the sake of simplicity in this project you can
split as many times as there are pairs available on the first two
cards of a hand. Any 10-valued cards, e.g (Jack, Queen) can also be
split hand.
- Insurance and Even Money
For the sake of simplicity of rules in this project Insurance and Even Money
are not offered to the player.
Project Breakdown
The project has been broken down into four deliverables to help in
time management. Each deliverable will involve a design stage followed
by an implementation and testing stage. Following is the proposed
architecture for the game. Each deliverable of the project aims at
completing one or more modules of the system. Individual deliverables
are discussed in more detail in their relevant handouts. The mark for
each deliverable will be weighted in the overall project grade based
on its relative difficulty.

Deliverable One: Statistics
The stats module is responsible for gathering information regarding the games
played and the players involved. The key objectives are to stress the need for
good class design with the help of UML, Design by Contract and Unit
testing.
Deliverable Two: Game Engine (Dealer)
The Game Engine deliverable involves the implementation of the dealer who
controls the state of the game. To give you practice of design by contract a
complete set of pre and post conditions have already been defined for the
dealer. The key objectives are to practice closely following the specifications
and thorough unit testing.
Deliverable Three: GUI
Most software nowadays come with Graphical User Interfaces (GUI). Good GUI design
plays a crucial role in the success of a software. In this deliverable you are
required to design a graphical interface for your blackjack game.