CSC 221: Computer Programming I
Fall 2004

HW4: Repetition and Simulation


For this assignment, you will modify the VolleyBallSimulator class and perform numerous experiments using the simulation.

  1. Download the files VolleyBallSimulator.java and Die.java and build a working project. 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.



















  2. As it is currently written, the winningPercentage method simulates multiple games by repeatedly calling playGame. Unfortunately, this means that all of the individual points in a game are displayed (by playGame), cluttering up the screen and greatly slowing down the simulation. Make the following modifications to the class so that the winningPercentage method can turn off output and so speed up the simulation.



  3. 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 game lengths. Report the winning percentages of team 1 in the table below:

    SIMULATION 1SIMULATION 2SIMULATION 3
    1,000 games to 25   
    10,000 games to 25   
    100,000 games to 25   
    1,000 games to 30   
    10,000 games to 30   
    100,000 games to 30   



  4. Does the consistency of the results improve when the number of games simulated increases? That is, are the three percentages obtained from 10,000 games closer together than the three percentages obtained from 1,000 games? Likewise, are the percentages obtained from 100,000 games closer together than those obtained from 10,000 games? Should they be? Explain.









  5. Are the winning percentages affected by the game length? That is, if the game is longer, does this positively or negatively affect the chances of team 1 winning? If your data suggests this, run several more simulations with different game lengths to confirm the pattern. Would this affect (if any) be more pronounced if the teams were less evenly matched, say 50 vs. 80?










  6. Next, we want to compare the two different scoring schemes, rally and sideout scoring. A simple approach would be to define another method, named playGameSideoutScoring, which simulates a game using the sideout scoring system. This new method would be almost identical to the existing playGame method that uses rally scoring, except that it would keep track of who is serving and award a point only if the server wins the rally. In software development, however, duplicating large blocks of code can lead to bad consequences. If any part of the simulation were to change, then it would have to consistently change in both methods. A better solution is to have a single method that works for either scoring scheme.













  7. 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 game lengths. 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)
    1,000 games to 25   
    10,000 games to 25   
    100,000 games to 25   
    1,000 games to 30   
    10,000 games to 30   
    100,000 games to 30   



  8. 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 statistics to justify your claim.






















  9. 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 game length for rally scoring that would preserve competitive balance. That is, the winning percentage of team 1 using rally scoring should be roughly the same sa 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.