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.


There are many variations on the game of blackjack. Refer to 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:

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

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.