Previously in this chapter you saw the card_dealer.py program that simulates cards being dealtfrom a deck. Enhance the program so it simulates a simplified version of the game of Blackjackbetween two virtual players. The cards have the following values:Numeric cards are assigned the value they have printed on them. For example, the value ofthe 2 of spades is 2, and the value of the 5 of diamonds is 5.Jacks, queens, and kings are valued at 10.Aces are valued at 1 or 11, depending on the player’s choice.The program should deal cards to each player until one player’s hand is worth more than 21points. When that happens, the other player is the winner. (It is possible that both players’ handswill simultaneously exceed 21 points, in which case neither player wins.) The program shouldrepeat until all the cards have been dealt from the deck.If a player is dealt an ace, the program should decide the value of the card according to thefollowing rule: The ace will be worth 11 points, unless that makes the player’s hand exceed 21points. In that case, the ace will be worth 1 point.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Previously in this chapter you saw the card_dealer.py program that simulates cards being dealt
from a deck. Enhance the program so it simulates a simplified version of the game of Blackjack
between two virtual players. The cards have the following values:
Numeric cards are assigned the value they have printed on them. For example, the value of
the 2 of spades is 2, and the value of the 5 of diamonds is 5.
Jacks, queens, and kings are valued at 10.
Aces are valued at 1 or 11, depending on the player’s choice.
The program should deal cards to each player until one player’s hand is worth more than 21
points. When that happens, the other player is the winner. (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.
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. In that case, the ace will be worth 1 point.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY