Name: _________________________________________


CSC 121: Computers and Scientific Thinking
Spring 2021

Lab 5: Volleyball Simulations

 

One of the ways that computers have transformed science and mathematics is through software simulations. A model of a complex process, such as the spread of a disease or climate change, can be developed and then studied to gain insights into that process that cannot easily be duplicated. For example, an epidemiologist studying the spread of a disease can change parameters in the model (e.g., rate of infection, degree of social distancing) and study how policy changes might impact the spread. In addition, software models can simulate extended periods of time very quickly, such as the impact of climate change over decades or centuries.

Chapter X8 includes several examples of Web pages that model real-world systems. This lab will focus on the volleyball simulation page, volleyball.html. This page simulates a single volleyball game between two opponents, where the strengths of the teams and the game length is entered in text boxes. Each team's strength is rated on a scale of 1 to 100, with a higher score denoting a better team. The relative strengths of the teams are taken into account when determining the winner of each point in the simulation. For example, if team1 has a strength rating that is 10% higher than team2 (say 55 vs. 50), then team1 will have a 10% higher chance of winning a given point.


EXERCISE 1:    Use the volleyball.html page to simulate 10 games to 25 between evenly matched teams (e.g., both with a strength rating of 60). List the final scores of the games. Since the teams are evenly matched, you would expect the games to be close and that each team would win roughly half the games. Do your results match these expectations?



EXERCISE 2:    Consider a situation where one team is slightly better than the other, say 10% stronger. Simulate 10 games to 25 in which the team strengths are 66 and 60. List the final scores of the games. Are the individual games more one-sided? Does the better team win more games?



EXERCISE 3:    Now, consider a game in which one team is significantly better, say twice as strong. Simulate 10 games to 25 between teams with strengths of 60 and 30. List the final scores of the games. Are the games heavily skewed in favor of the dominant team? What is the win total for each team?



The results you generated in EXERCISES 1-3 may suggest certain patterns, but they are far from conclusive. As we saw in earlier labs, drawing conclusions from processes involving randomness requires a large number of repetitions in order to balance out statistical anomalies. In this case, we might need to simulate thousands or even tens of thousands of games to be sure of the results. Obviously, simulating thousands of games individually and manually tabulating the results would be tedious and time-consuming. We would prefer to automate the process, specifying the number of games we want simulated, simulating those games in sequence, and seeing the final results when completed.

If this situation seems vaguely familiar, consider the parallels to the random walk lab (Lab 4). There, we used the Turtle.html page to simulate a single random walk, displaying the path that the turtle took. When we wanted to simulate repeated walks, the Walk.html page was introduced, which simulated repeated random walks, showing only the ending location for each walk (so as not to slow down the simulation). The page volleystats.html has similarly been provided, which performs repeated volleyball simulations (the number of games is specified by the user in a new text box) and displays the final win percentages for the two teams.


EXERCISE 4:    Use the volleystats.html page to generate more conclusive statistics on games between evenly matched teams. Set the strengths of both teams to 60 with a game length of 25. Simulate 1,000 games and list the winning percentages of the two teams. Is it close to 50/50?

Conduct 9 more experiments with the same settings (team strengths of 60, game length of 25, 1,000 games). List the results. Are they all close to 50/50? How consistent are the results? In particular, how far apart are the smallest and largest winning percentages obtained for team1?



EXERCISE 5:    If team1 has a strength rating that is 10% higher than team2, then it follows that team1 has a 10% higher chance of winning any given point. You might be tempted to think that a 10% advantage on a point would translate to a 10% advantage on winning a game. However, the truth is that even a small advantage compounds over the course of the game. Conduct 10 experiments with team strengths of 66 and 60, assuming a 25 point game and 1,000 games per experiment. List the results. How far from 50/50 are the win totals? How consistent are the results (i.e., how much variability is there for team1's winning percentage)?



EXERCISE 6:    Increase the number of games to 10,000 and perform another 10 experiments (using the same game settings as in EXERCISE 5). List the results. Are the results more consistent than the results from 1,000 games?



EXERCISE 7:    Fill in the following table by performing simulations with the volleystats.html page. For each pair of team strengths, perform three different experiments and report the winning percentage for team1. Assume that for all of these, the game length is 25 and the number of games is 10,000.
team1 strengthteam2 strengthExperiment 1
team1 win %
Experiment 2
team1 win %
Experiment 3
team1 win %
4440   
4840   
5240   
6040   
8040   

Describe the overall pattern shown by your results. As the difference between the team strengths increases, how does the likelihood of the better team winning the game change? What does this suggest to you about the "fairness" of volleyball's scoring rules? That is, if one team is objectively better than the other, are they likely to win under these scoring rules? Explain.



EXERCISE 8:    Suppose the team strengths change, but the same relative relationship holds. For example, a team with strength 60 is 20% better than a team with strength 50. Likewise, a team with strength 36 is 20% better than a team with strength 30. We would expect that the likelihood of winning depends only on relative strengths, not absolute strengths. Perform experiments and fill in the following table to help confirm this. As before, assume the game length is 25 and the number of games is 10,000.
team1 strengthteam2 strengthExperiment 1
team1 win %
Experiment 2
team1 win %
Experiment 3
team1 win %
3330   
3630   
3930   
4530   
6030   

Are the results you obtain similar to the results from EXERCISE 7 (which used a baseline strength of 40). Justify your answer by comparing the results from the two tables.



EXERCISE 9:    In college volleyball, the initial games in a match are played to 25. If the teams are tied at two games each, however, the deciding fifth game is played to 15. An interesting question is whether this shortening favors either of the teams. Repeat the simulations you performed in EXERCISE 7, only now with a game length of 15. Assume the number of games for each experiment is still 10,000.
team1 strengthteam2 strengthExperiment 1
team1 win %
Experiment 2
team1 win %
Experiment 3
team1 win %
4440   
4840   
5240   
6040   
8040   

Compare your results with those obtained in EXERCISE 7. Does the shorter game tend to favor the better team or the underdog? Is the effect consistent regardless of how closely matched the teams are, or is it heightened by differences in strength? Identify any pattern that you see in the results, and provide a rationale for why that pattern holds.