CSE 111 - Fall 2002
Lab #10 - Blackjack
Background
For this lab, you will build a simplified game of blackjack. The user will play against the computer dealer. The computer is not very smart in this game. The computer always takes three cards no matter what cards it has. The user can choose to hit on their hand, or to stay with the hand they have if they believe it will beat the dealer. When the user decides to stay, the totals for the cards are computed for both the dealer and the player, and the winner is announced. For those unfamiliar with the game of blackjack. Cards count with their face value. Face cards are worth 10. The Ace is a switch hitter - it can either be worth 1 or 11, whichever benefits the player more. However, in our implementation, always assume it is worth 11. If the player gets to five cards without going over 21, they automatically win as well. If the total on the cards is greater than 21, the player goes bust, and the dealer automatically wins. If the dealer goes over 21, the dealer goes bust, and the player automatically wins.
It is important to note that the dealer does not show their cards until after the player has decided to stay. Then the dealer's first two cards are revealed. The dealer then gets another card and the winner is announced. Play should continue until there are less than 6 cards left in the deck. If the deck runs out of cards in the middle of a hand, the hand is declared a draw.
Extra Credit
For additional credit, you can implement a smarter dealer, that follows rules about whether or not to get more cards, and the dealer can also pick to get more than 3 cards. You can also implement that when a hand is "Blackjack" or two cards that total 21, the winner is automatically declared, and when the hand goes bust, that is automatically declared.
Sample Interaction
Below is a sample interaction that you may use as a guide for how to implement the game.







