EECS 280 -- Winter 2009
Out: Thursday, March 12th
Due: Tuesday, March 31st, 11:59 PM
This project will give you experience implementing abstract data
types, using interfaces (abstract base classes), and using
Blackjack, also sometimes called 21, is a relatively simple game
played with a standard deck of 52 playing cards.
There are two
principals, a dealer and a player.
The player starts with a bankroll,
and the game progresses in rounds called hands.
At the start of each hand, the player decides how much to wager on
It can be any amount between some minimum allowable wager
and the player's total bankroll, inclusive.
After the wager, the dealer deals a total of four cards: the first
face-up to the player, the second face-up to himself, the third
face-up to the player, the fourth face-down to himself.
The player then examines their cards, forming a total.
Each card 2-10
is worth its spot value; each face card (jack, king, queen) is also
An ace is worth either 1 or 11--whichever is more
advantageous to the player.
If the total includes an ace counted as
11, the total is called "soft", otherwise it is called "hard".
Play progresses first with the player, then the dealer.
goal is to build a hand that is as close to 21 as possible without
going over---the latter is called a "bust", and a player who busts
loses the hand without forcing the dealer to play.
As long as the
player believes another card will help, the player "hits"---asks the
dealer for another card.
Each of these additional cards is dealt
This process ends either when the player decides to
"stand"---ask for no cards---or the player busts.
Note that a player
can stand with two cards; one need not hit at all in a hand.
If the player is dealt an ace plus any ten or face card, the player's
hand is called a "natural 21", and the player's wager is paid off with
3 to 2 odds, without examining the dealer's cards.
In other words, if
the player had wagered 10, the player would win 15 if dealt a natural
If the player neither busts nor is dealt a natural 21, play then
progresses to the dealer.
The dealer *must* hit until he either
reaches a total greater than or equal to 17 (hard or soft), or busts.
If the dealer busts, the player wins.
Otherwise, the two totals are
If the dealer's total is higher, the player's bankroll
decreases by the amount of her wager.
If the player's total is
higher, her bankroll increases by the amount of her wager. If the
totals are equal, the bankroll is unchanged; this is called a "push".
The only case where the hands are equal that is not a push is when the
player and dealer are each dealt natural 21s.
In that case, the
player is still paid 3:2.