Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I have a CS assignment where I need to make a card game called 21. However, I'm having a lot of difficulty with this since
I have a CS assignment where I need to make a card game called 21. However, I'm having a lot of difficulty with this since I'm still a bit new to coding and my professor just threw this assignment out at the class without even giving us a demonstration of how to start. I've tried to look up sources of how I should do this assignment but I'm not finding much at all. The coding language is C++
Problem Statement We are going to create a game called TwentyOne, which is similar to the Black Jack 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, to twenty-one points without going over. 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, the player automatically loses their bet, and the dealer doesn't need to play against that player. If the dealer busts, 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 skippec. 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: How many players do you have (1-4)? 2 Player 1, how much money are you starting with? 20.00 Player 2, how much money are you starting with? 50.00 Player 1, how much do you bet you can beat the dealer? 10.00 Player 1, you got 10. Do you want to go again (0-no or 1-yes)? 1 Player 1, you got 8. Do you want to go again (0-no or 1-yes)? 0 Your total points are 18 The dealer gets 11 The dealer gets 11 The dealer busts! You win! Player 1 has 30.00 Player 2, how much do you bet you can beat the dealer? 10.00 Player 2, you got 8. Do you want to go again (0-no or 1-yes)? 1 Player 2, you got 9. Do you want to go again (0-no or 1-yes)? 0 Your total points are 17. The dealer gets 8 The dealer gets 9 The dealer has 17 points. It's a tie! Player 2 has 50.00 Do you want to play again (0-no or 1-yes)? 0 (10 pts) Extra Credit (10 pts) Extra Credit 2 Change the game play so that the dealer plays against all players in a turn, rather than playing only again one player at a timeStep 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