Using the sideout scoring system for volleyball, a team does not necessarily score a point on every rally. If the serving team wins the rally, a point is awarded. If the receiving team wins the rally, however, they win the serve but no point is awarded (this is known as a sideout). Play continues until one of the teams reaches 15 points with a margin of victory of at least 2 (play can go beyond the score of 15 until one team's score exceeds the other by 2 points). For this assignment, you will write a C++ program to perform simulations of a volleyball game, and explore the effect that the sideout scoring scheme has when mismatched opponents play each other.
Your program should simulate a game between the two teams, displaying the results of each rally and the score for the game. You may assume that Team 1 always serves to start the game. At the end, the winning team should be identified. For example,
What is Team 1's likelihood of winning a rally (0-100)? 55 Team 1 wins the rally. SCORE: 1-0 Team 2 wins the rally. Team 1 wins the rally. Team 1 wins the rally. SCORE: 2-0 Team 1 wins the rally. SCORE: 3-0 Team 2 wins the rally. Team 2 wins the rally. SCORE: 3-1 . . . Team 1 wins the rally. SCORE: 14-10 Team 1 wins the rally. SCORE: 15-10 Team 1 wins!
Once you have completed the program from Part 1, write a new program named sim.cpp that performs repeated simulations of volleyball games. This program should prompt the user for the likelihood of Team 1 winning a rally (as before) and also the number of games to play. It should then simulate that many games and report the winning percentage of Team 1 over all the games.
Your program should include a function named PlayGame that simulates a single game, using code similar to volley.cpp. Unlike the code from volley.cpp however, the function should not display anything, but instead should return the winning team number (1 or 2) after the game has been completed. Using this function, the main program should repeatedly call the PlayGame function and keep track of the number of wins and losses for Team 1. The final number of wins, along with the winning percentage, should be displayed. For example,
What is Team 1's likelihood of winning a rally (0-100)? 53 How many games do you want to simulate? 1000 Team 1 won 695 out of 1000 times (69.5%).
Using your sim.cpp program, simulate 10,000 games and report the winning percentage of Team 1 given each of the following likelihoods of Team 1 winning a rally:
What do your results suggest about the sideout scoring system for volleyball? Does it downplay or exaggerate differences in talent? Explain.
The alternate to the sideout scoring system is rally scoring, where a point is awarded to the winner of every rally and the first team to 25 (with a victory margin of 2) wins the game. Under which scoring system would you think that upsets would be less likely? That is, which scoring system tends to exaggerate talent differences more? Your answer does not need to be correct, but your accompanying rationale must be reasonable.