CSC 221: Computer Programming I
Fall 2005
HW4: Repetition and Simulation
For this assignment, you will modify the code for simulating volleyball games and
perform numerous experiments.
- Download the files VolleyballSim.java, VolleyballStats.java,and Die.java and build a working project. Be sure to comment
out the println statements in VolleyballSim, as we demonstrated in class,
to avoid excessive output.
If you specify equal
rankings, are the scores of games relatively close? Should they be? Explain your answer
and provide the scores for several games to support it.
- Assuming team 1 has a ranking of 50 and team 2 has a ranking of 55 (10% better),
perform three different sets of simulations for each of the following winning point totals.
Report the winning percentages of team 1 in the table below:
| SIMULATION 1 | SIMULATION 2 | SIMULATION 3
|
---|
10,000 games to 15 | | |
|
10,000 games to 20 | | |
|
10,000 games to 25 | | |
|
10,000 games to 30 | | |
|
- For each of the given winning point totals, are the three winning percentages
that you obtained fairly consistent? Would you expect them to be? If not, modify the
VolleyballStats class so that 100,000 games are played and repeat the
simulations. Explain your answers.
- Are the winning percentages affected by the changing the points needed to win?
That is, if the number of points required to win is increased,
does this affect (positively or negatively) the chances of team 1 winning? If your
data suggests an effect, run several more simulations with different winning point totals to confirm
the
pattern. Would this effect (if any) be more pronounced if the teams were less evenly
matched, say
50 vs. 80? Explain your answers.
- Next, we want to compare the two different scoring schemes, rally and sideout scoring. A
simple approach is to define another method, named playGameSideout, which
simulates a game using the sideout scoring system. This new method will be almost identical to
the existing playGameRally method that uses rally scoring, except that
it awards a point only if the server wins the rally. To balance out the fact that sideout scoring gives
a slight advantage to the team who serves first, have the initial serve randomly assigned to one
of the teams.
Once you have your playGameSideout method working in VolleyballSim, modify the
playGames method in VolleyballStats so that it performs repeated experiments
using both scoring schemes and displays both winning percentages.
The output of the method should look like:
Assuming (50-55) rankings over 10000 games to 25:
team 1 winning percentage: 36.56% (rally) vs. 33.46% (sideout)
- Assuming team 1 has a ranking of 50 and team 2 has a ranking of 60 (20% better),
perform three different sets of simulations for each of the following winning point totals.
Report
the winning percentages of team 1 using both rally and sideout scoring in the table below:
| SIMULATION 1 (rally : sideout) | SIMULATION 2 (rally : sideout) | SIMULATION
3 (rally : sideout)
|
---|
10,000 games to 15 | | |
|
10,000 games to 20 | | |
|
10,000 games to 25 | | |
|
10,000 games to 30 | | |
|
- As we saw in class, rally scoring accentuates differences in talent. That is, if team 1 is
10% better than team 2, the likelihood of them winning a game is actually much more than 10%
better than for team 2. Which of the two scoring schemes accentuates differences more? Provide
additional statistics as needed to justify your claim.
- Suppose you were a member of the committee deciding on a switch from sideout to rally scoring.
Recall that women's college volleyball previously used sideout scoring, with games played to 15.
Perform experiments to determine the equivalent winning point total for rally scoring that would preserve
competitive balance. That is, the winning percentage of team 1 using rally scoring should be
roughly the same as the winning percentage using sideout scoring to 15. This relationship should
hold for a wide range of team strengths. Provide statistics to justify your answer.
- Finally, consider the hypothesis that the rule change was made to shorten the
lengths of games. Modify the VolleyballSim class so that it keeps track of
the number of rallies as a game is played. There should be a private field to store the
number of rallies, which is updated by the playGameRally and playGameSideout
methods. An
additional method named getLastGameLength should be provided for accessing this
field. Next, modify the playGames method in VolleyballStats so that it
displays average game lengths for both scoring systems in addition to winning percentages.
The output of the method should look like:
Assuming (50-55) rankings over 10000 games to 25:
team 1 winning percentage: 36.56% (rally) vs. 33.46% (sideout)
average game length: 44.5438 (rally) vs. 84.5814 (sideout)
- Does changing from sideout scoring (with games to 15) to rally scoring (with games to
25) tend to shorten games? What if games were played to 30 under rally scoring?
Provide statistics to justify your answer.