Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we can program a wide variety of traditional games like Poker and BlackJack. For this assignment, we are going to create a simplified version of the dice game Bunco. The real game involves multiple players rolling dice and trying to get the highest score at the end of the round. For our assignment, we'll just have two players – you and the computer. Each game will run for no more than 6 rounds. The player and the computer will "roll" their two dice (represented by two integer variables per player). Éach dice roll will be simulated by a random number generator that produces a random number between 1 and 6. Once all four integer values are generated, a score will be calculated for each player using these rules: Result Points Both dice match the current round number 21 points + the sum of the two dice Both dice match each other, but not the round 5 points + the sum of the two dice |1 point + the sum of the two dice The sum of the two dice One dice matches the current round number Anything else For example, if the player rolls a 1 and 2 on the first round, their score would be 4 (one bonus point for one dice matching the round number, then the value of the dice added together). If the computer rolls 2 and 2, then its score would be 9 (five bonus points for both dice matching each other but not the round number, then the value of the dice added together). After each round, the player is given the option to stop. If they choose to do so (or if six rounds have been played), their current score is compared against the computer's current score and a winner is declared. Then the player is asked if they'd like to play again, restarting the whole process.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

coding language c++

**Sample Output #1:**

Let's play Bunco!

- **Round 1:** You rolled 1 and 5.
  - Your score is 7. Do you want to stop?: **N**

- **Round 2:** You rolled 3 and 3.
  - Your score is 11. Do you want to stop?: **Y**

Okay, the computer’s score is... 4!
You win!

Do you want to play again?: **N**

Game Over...

---

**Sample Output #2:**

Let's play Bunco!

- **Round 1:** You rolled 2 and 4.
  - Your score is 6. Do you want to stop?: **Y**

Okay, the computer’s score is... 23!
Sorry, you lose.

Do you want to play again?: **Y**

---

Let's play Bunco!

- **Round 1:** You rolled 1 and 1.
  - Your score is 23. Do you want to stop?: **N**

  *//Rest of iterations go here (do not print this line!)*

- **Round 6:** You rolled 5 and 5.
  - Your score is 15. You’ve played all six rounds.

Okay, the computer’s score is... 7!
You win!

Do you want to play again?: **N**

Game Over...
Transcribed Image Text:**Sample Output #1:** Let's play Bunco! - **Round 1:** You rolled 1 and 5. - Your score is 7. Do you want to stop?: **N** - **Round 2:** You rolled 3 and 3. - Your score is 11. Do you want to stop?: **Y** Okay, the computer’s score is... 4! You win! Do you want to play again?: **N** Game Over... --- **Sample Output #2:** Let's play Bunco! - **Round 1:** You rolled 2 and 4. - Your score is 6. Do you want to stop?: **Y** Okay, the computer’s score is... 23! Sorry, you lose. Do you want to play again?: **Y** --- Let's play Bunco! - **Round 1:** You rolled 1 and 1. - Your score is 23. Do you want to stop?: **N** *//Rest of iterations go here (do not print this line!)* - **Round 6:** You rolled 5 and 5. - Your score is 15. You’ve played all six rounds. Okay, the computer’s score is... 7! You win! Do you want to play again?: **N** Game Over...
**Assignment 4A: Let’s Play Bunco!**

Now that we can easily repeat actions with loops, we can program various traditional games like Poker and Blackjack. For this assignment, we'll create a simplified version of the dice game Bunco. The real game involves multiple players rolling dice to get the highest score at the end of the round. For our assignment, we’ll have two players – you and the computer.

Each game will run for no more than **6 rounds**. The player and the computer will “roll” their two dice (represented by two integer variables per player). Each dice roll will be simulated by a random number generator that produces a number between 1 and 6. Once all four integer values are generated, a score will be calculated for each player using these rules:

| Result                                         | Points                                |
|------------------------------------------------|---------------------------------------|
| Both dice match the current round number       | 21 points + the sum of the two dice   |
| Both dice match each other, but not the round  | 5 points + the sum of the two dice    |
| One dice matches the current round number      | 1 point + the sum of the two dice     |
| Anything else                                  | The sum of the two dice               |

For example, if the player rolls a 1 and 2 on the first round, their score would be 4 (one bonus point for one dice matching the round number, plus the sum of the dice). If the computer rolls 2 and 2, its score would be 9 (five bonus points for both dice matching each other but not the round number, plus the sum of the dice).

After each round, the player is given the option to stop. If they choose to do so (or if six rounds have been played), their current score is compared against the computer’s score, and a winner is declared. Then, the player is asked if they’d like to play again, restarting the whole process.
Transcribed Image Text:**Assignment 4A: Let’s Play Bunco!** Now that we can easily repeat actions with loops, we can program various traditional games like Poker and Blackjack. For this assignment, we'll create a simplified version of the dice game Bunco. The real game involves multiple players rolling dice to get the highest score at the end of the round. For our assignment, we’ll have two players – you and the computer. Each game will run for no more than **6 rounds**. The player and the computer will “roll” their two dice (represented by two integer variables per player). Each dice roll will be simulated by a random number generator that produces a number between 1 and 6. Once all four integer values are generated, a score will be calculated for each player using these rules: | Result | Points | |------------------------------------------------|---------------------------------------| | Both dice match the current round number | 21 points + the sum of the two dice | | Both dice match each other, but not the round | 5 points + the sum of the two dice | | One dice matches the current round number | 1 point + the sum of the two dice | | Anything else | The sum of the two dice | For example, if the player rolls a 1 and 2 on the first round, their score would be 4 (one bonus point for one dice matching the round number, plus the sum of the dice). If the computer rolls 2 and 2, its score would be 9 (five bonus points for both dice matching each other but not the round number, plus the sum of the dice). After each round, the player is given the option to stop. If they choose to do so (or if six rounds have been played), their current score is compared against the computer’s score, and a winner is declared. Then, the player is asked if they’d like to play again, restarting the whole process.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education