CS 99

Fundamental Programming Concepts
Summer 2000

Final Project

Clarification/Updates:

  1. [8/7/00] This is a game, thus ease-of-use is of paramount importance. Users aren't likely to keep playing games that the interface makes needlessly difficult.
  2. [8/7/00] The Unicode character constants for the suits in an applet are different from those in an application. For an applet, you must change the font to Arial, then use these constants: '\u2663' (clubs), '\u2666' (diamonds), '\u2665' (hearts), and '\u2660' (spades).
  3. [8/2/00] The smallest unit of cash is $1. No fractions of a dollar are needed. A player who wins with a blackjack may therefore have her winnings rounded down to the nearest dollar.
  4. [8/2/00] The game is over when the player's account falls to $0, not below $0. If you implement the betting rules correctly, it would be impossible to have less than $0.
  5. [8/2/00] Please submit your entire project folder, not just the files listed below, if you are able.

 

Overview
This project takes the place of a final exam in the course. Expect that it will take at least the same amount of work and mental energy as preparing for and taking a comprehensive final. This is your (last) chance to demonstrate mastery of material in the course.

The only people you may receive help from on this project are Michael and Rick. You may consult any textbook you wish. However, stealing an implementation of any class for this program is a violation of academic integrity.

Your project will be graded on the basis of correctness, style, and ease of use (quality of the user interface). You may either write this as a console application or as an applet. Applets will receive up to a 10% bonus. However, I strongly recommend getting the game working as an application FIRST, and then converting it to an applet. Applets that do not function correctly will be graded harshly.

 

Problem Statement
Implement a program that plays the game of Blackjack. The user will be the single player in the game, and the computer will be the dealer. Use the rules specified below. Some class specifications are also provided to help you.

 

Blackjack Rules

Basics

The player competes against the dealer. The object of the game is to have a higher point total than the dealer without going over 21. Each ace counts as either 1 point or 11 points, face cards (kings, queens, jacks) count 10 points each, and all other cards (2 through 9) count their face value. Our blackjack game will be played with a single deck of 52 cards.

Betting

Before the deal, the player places a bet. The player may bet any amount from $1 to $100. When a player's bank account falls below $0 the game is over. The player starts the game with $500.

Game Play

The dealer deals two cards to the player and two cards to himself. The player's cards are dealt faceup, while one of the dealer's cards is dealt faceup and the other is facedown. After the deal, the dealer asks the player whether she wants an additional card. The player may "Stand" -- play just the two cards originally dealt or may "Hit"-- take another card. After being dealt an additional card, the player may stop or may take still another card. A player may take as many cards as she wants, but as soon as the player's total exceeds 21, the player loses -- regardless of what the dealer has.

After the player stands, the dealer's remaining card is exposed. The dealer must then hit or stand according to these rules:

  1. The dealer must count an ace as 11 points, unless this causes the dealer to bust. Then the dealer must count the ace as 1 point.
  2. If the dealer has a total of 17 points or more, he must stand.
  3. If the dealer has a total of less than 17 points, he must hit.

If the dealer "busts" by going over 21, the player wins. In case of a tie, the player's bet is returned (no money changes hands).

If a player's or the dealer's first two cards total 21 (an ace and a 10 or face card), the holding is known as a blackjack. A player with blackjack is paid extra -- one-and-a-half times the original bet -- unless the dealer also has blackjack, in which case the player loses.

The player may leave the game between any hands.

We will not implement rules for doubling down, splitting, or insurance.

 

Class Specifications
The game (driver) program itself should be in a class called Blackjack. The game should make good use of methods to modularize repeated tasks. You must use at least two additional classes in this project: Card and Deck. You may design these yourself, or use the specifications provided below. You might also find it helpful to create other classes, such as Hand, Player, Dealer, etc.

Specifications:

 

Submitting
Submit exactly the following:
  • Final
    • Blackjack.java
    • Card.java
    • Deck.java
    • Any other .java or .html files your project requires

A project that does not immediately run as submitted will receive no credit.