Comp 1672, Winter 2003
Programming Project 3
Due Monday, February 24, 2003
Extended to Friday, February 28, 2003

These are the instructions for your third programming project. Recall that all code must be written individually and independently.

This program plays the game of blackjack with the user. While blackjack played in casinos involves aspects such as betting, insurance, surrender, and splitting pairs, we will play a more simplified version, as described below.

The game uses a standard deck of 52 playing cards, which has 13 different values (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K and A) in each of 4 different suits (spades, hearts, diamonds, and clubs). The value of each of the card in a hand is added (with J, Q and K each being worth 10, and A being worth either 1 or 11), and the goal is to end with a total of 21, or as close as possible without going over. The game begins with the dealer dealing two cards to itself, and two cards to the player. The player's hand is shown face-up, but only the 2nd of the two dealer's cards can be seen. The player can at this point choose to stand (accept the hand as it is), hit (ask for another card), or double (ask for exactly one more card). If the player chose to hit, then they may then continue to ask for additional cards, until finally choosing to stand, or until "busting" (going over 21). If the player busts, the player immediately loses the hand. If the player stands without busting, then Aces in their hand are counted as either 1 or 11, whichever is to their advantage. The dealer then receives its additional cards. The dealer, however, is not allowed to choose whether to hit or stand, but rather must always receive a new card until the total reaches 17 or over, at which point the dealer must stand. If counting an Ace as an 11 gives a total of 17 or over, the dealer must stand in this case as well. At this point, the winner is the player with a total closer to 21. If the dealer has busted and the player has not, then the player wins. After the hand is over, then the deck is re-shuffled.

Repeat the game until the user wants to quit. Keep track of the total number of wins for dealer, wins for player, and ties (called "pushes"), and output this total before exiting the program.

Your program must make use of classes. The interfaces for these classes will be discussed in class.

Instructions for submitting:
Your program should start with a few lines of comments giving your name, the date, the course this is for, and the assignment number. The program should be written with a well organized structure, and the variables should be named in a useful way. The program should be formatted consistently and clearly, and should include comments that explain the code. When you're done writing and testing the program, print out a copy of your source code. Bring it to class on the due date and turn them in at the beginning of class. Also, before the beginning of class on the due date, mail your source code files, your header files, and your makefile to comp1672@cs.du.edu.

If you need further challenge:
Augment your program to handle any or all of the following: