Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ language Problem Statement We are going to create a game called TwentyOne, which is similar to the Blackjack and War card games. This game
c++ language
Problem Statement We are going to create a game called TwentyOne, which is similar to the Blackjack and War card games. This game has a dealer/computer and 1-4 players, and the game will generate random numbers from 1 to 11 to simulate the values in cards. All players start with a specified amount of money, which they determine at the start of the game, and the goal is to see if you can get closer than the dealer to twenty-one points without going over (bust). With each player's turn, they first bet against the dealer, and then play against the dealer before moving on to the next player. An initial random number, 1-11, is generated, and after each random number is generated, the player decides whether they want to generate another to add to their total points trying to get as close to 21 as possible without going over. The dealer is also given random numbers, but the strategy you use for determining whether they get another random number is your choice. (-) The rules for the game play are below. - If the player busts (goes over 21), the player automatically loses their bet, and the dealer doesn't need to play against that player. - If the player gets exactly 21 in hand, the player automatically wins their bet, and the dealer doesn't need to play. - If the dealer busts (goes over 21), the player automatically wins their bet. - If the dealer ties with the player, then the player doesn't win or lose their bet. - If the player's bet is more than their bank, then you need to continue to re-prompt for a new bet until a good value is given. - If a player's bank is 0 , they get skipped. - If all players' banks are 0 , then the game is automatically over! - After all players take a turn against the dealer, then the players can collectively cash out or play again. Example game play below (User inputs are highlighted): How many players do you have (1-4)? 3 Player 1 , how much money are you starting with? 20 Player 2, how much money are you starting with? 50 Player 3 , how much money are you starting with? 30 Player 1's turn... Player 1 , how much do you bet you can beat the dealer? 10 Player 1 , you got a(n) 10. Your running total is 10 . Do you want another number ( 0 -no or 1-yes)? 1 Player 1, you got a(n) 8. Your running total is 18. Do you want another number (0-no or 1-yes)? 0 Your total points are 18. Dealer's turn... The dealer gets a(n) 11, running total is 11 . The dealer gets a(n) 11, running total is 22 . The dealer busts! You win! Player 1 has 30.00. Player 2's turn... Player 2, how much do you bet you can beat the dealer? 50 Player 2, you got a(n) 8. Your running total is 8 . Do you want another number (0-no or 1-yes)? 1 Player 2, you got a(n) 9. Your running total is 17 . Do you want another number ( 0 -no or 1-yes)? 0 Your total points are 17. The dealer gets a(n) 11 , running total is 11 . The dealer gets a(n)10, running total is 21 . The dealer stops... The dealer has 21 points. You lose! Player 2 has 0.00. Player 3 's turn... Player 3 , how much do you bet you can beat the dealer? 50 Invalid number, you only have 30 in hand. Player 3 , how much do you bet you can beat the dealer? 25 Player 3, you got a(n) 8. Your running total is 8 . Do you want another number ( 0 -no or 1-yes)? 1 Player 3 , you got a(n) 9. Your running total is 17 . Do you want another number ( 0 -no or 1 -yes)? 1 Player 3, you got a(n) 3. Your running total is 20 . Do you want another number ( 0 -no or 1-yes)? 0 Your total points are 20. The dealer gets a(n)10, running total is 10 . The dealer gets a(n) 10, running total is 20 . The dealer stops... The dealer has 20 points. Tie game! Player 3 has 30.00. Do you want to play again ( 0 -no or 1-yes)? 1 Player 1's turn... Player 1 , how much do you bet you can beat the dealer? 10 Player 1, you got a(n) 10. Your running total is 10 . Do you want another number ( 0 -no or 1-yes)? 1 Player 1, you got a(n) 11. Your running total is 21 . You got 21 in hand. You win! Player 1 has 40.00. Player 2 is skipped... Player 3's turn... Player 3, how much do you bet you can beat the dealer? 20 Player 3, you got a(n) 10. Your running total is 10 . Do you want another number (0-no or 1-yes)? 1 Player 3, you got a(n) 9. Your running total is 19 . Do you want another number ( 0 -no or 1-yes)? 1 Player 3, you got a(n) 5. Your running total is 24 . You bust. You lose! Player 3 has 10.00. Do you want to play again ( 0 -no or 1 -yes)? 0 Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started