19-04-2002 A V Peterson Assignment 4 Game Rules (See URL http://www.blackjackinfo.com/bjrules.htm) Assignment 4 is an implementation of an interactive program for playing (a simplified version of) the card game Blackjack, also fairly frequently known as Twenty-one (Vingt-et-un). It is a common casino game played around a table with one dealer and a number of players. Since each player plays only against the dealer, not other players, we can implement this interactive program for just two players, the dealer and the 'gambler'. Furthermore, since the dealer's play is bound strictly by rules in which the dealer has no choices, the dealer's part can be played by the computer. The aim of the game is to have the hand with the highest value, but still <= 21. A hand with value > 21 is worthless. The value of an individual card with rank 2 through 10 is just the rank of the card. Jacks, queens and kings all have the value 10. Aces can have the value 11 or 1 depending on which value gives you the most favorable hand. The suit of a card does not matter. Cards are dealt from a shuffled deck. Cards are not re-used until the deck is exhausted and the whole deck reshuffled. 1. In the first phase, the dealer deals a card to the player, a card to himself, and a second card to the player. All these cards are visible to everyone. 2. Next the player's hand is completed. The dealer asks whether the player wants another card. The player indicates whether he is happy with the cards he has, or whether he wants an additional card. If the player wants another card, then it is dealt to his hand. The hand is complete when the player indicates he does not want any more cards. 3. The dealer's hand is completed The dealer gets his second card. As long as the value of the dealer's hand is < 17 he gets additional cards. 4. The hand with the highest value (but still <= 21) wins. If the two hand have the same value or they are both over 21, then no one wins (a draw). 5. Scoring For the standard program scores start at zero and may be negative or positive. Each hand is worth 1; the winner will add 1 to his score; the loser will subtract 1 from his score. Optional Extras A 'blackjack' is a hand with a value of 21 on the first two cards. 1. Modify the program so that a blackjack wins over an ordinary 21. 2. Allow the player (not the dealer) to set the value of the bet (1<=bet<=100) instead of the default of 1 indicated in step 5 above. In the case of a player blackjack the player will add 1.5 times the bet to his score (and the losing dealer subtract 1.5 times the bet). If both player and dealer have a blackjack then it is a draw. In all cases of the dealer winning, the dealer adds the bet to his score and the player subtracts the bet from his score.