Lab 1430 - Blackjack


Blackjack is a popular card game in casinos. In this lab, you will simulate the game using simplified rules (no double-down, insurance, or splitting pairs).

Simplified Rules

Both the player and the dealer are given two cards. The dealer's second card is dealt face up, so all the players may see it. If the dealer has a blackjack (that is, her two cards are an ace and a face card), then all the players immediately lose or push if they too have a blackjack. The object of the game is to accumulate two or more cards with a point total as close to 21 as possible, without going over 21. Face cards (Jacks, Queens, and Kings) are all worth ten points each. Aces are worth either one or eleven. Each player, in turn, may request a card, stopping when they are satisfied with their total or when they "bust," or their total is greater than 21. After the players have taken cards, the dealer plays his hand. He must take a card if his total is 16 or less, or if he has a "soft" 17, that is, an Ace and a 6; otherwise he must "stand." If the dealer busts, all players who haven't already busted are paind. If he didn't bust, his point count is compared to all the players who have not already busted. If he is closer to 21, the dealer wins. If they are the same, there is a push, or no winner. If the player is closer to 21 than the dealer, then the player wins.


Implement a simulation of a game of Blackjack. Have one deck of cards, one dealer, and six gamblers. At the end of the game, show all played cards and whether each player won, lost or "pushed."

Sample output is shown here.


Suggested classes include:

Deck a standard deck of cards
Card a card with a value and a suit
Player abstract base class for Dealer and Gambler
Dealer a Player with simple fixed rules for taking cards and a way to "show" the up card.
Gambler a Player with different rules for taking a card, partially based on the Dealer's up card.
Blackjack   overall driver/simulation program.

Copyright © 2010 by Asylum Computer Services LLC Return to CS Labs