![]() ![]() If a player is dealt an ace, the program should decide the value of the card according to the following rule: The ace will be worth 11 points unless that makes the player's hand exceed 21 points. ![]() (It is possible that both players' hands will simultaneously exceed 21 points, in which case neither player wins.) The program should repeat until all the cards have been dealt from the deck. When that happens, the other player is the winner. The program should deal cards to each player until one player's hand is worth more than 21 points. Aces are valued at 1 or 11, depending on the player's choice. Jacks, queens, and kings are valued at 10. ![]() For example, the value of the 2 of spades is 2, and the value of the 5 of diamonds is 5. The cards have the following values: Numeric cards are assigned the value they have printed on them. Enhance the program so it simulates a simplified version of the game of Blackjack between two virtual players. SOLVED: Previously in this chapter, you saw the carddealer.py program that simulates cards being dealt from a deck. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |