Description In the game Blackjack players get two cards to start with. Then they are asked if
Question:
Description
In the game "Blackjack" players get two cards to start with. Then they are asked if they want more cards. Players can continue to take as many cards as they like. The goal is to get close to 21 without going over. If the total is greater than 21 we say the player "busted".
Write a command line game that plays a simple version of blackjack. The program should generate random numbers between 1 and 10 each time the player gets a card. It should keep a running total of the players cards, and ask the player whether or not it should deal another card. Sample output for the game is written below. Your program should produce the same output.
> First cards: 3, 2
> Total: 5
> Do you want another card? (y/n): y
> Card: 6
> Total: 11
> Do you want another card? (y/n): y
> Card: 7
> Total: 19
> Do you want another card? (y/n): n
Here is another sample run
> First cards: 10, 2
> Total: 12
> Do you want another card? (y/n): y
> Card: 6
> Total: 18
> Do you want another card? (y/n): y
> Card: 7
> Total: 25
> Busted.
Auditing Cases An Interactive Learning Approach
ISBN: 978-0132423502
4th Edition
Authors: Steven M Glover, Douglas F Prawitt