Software Design (CSC-223 97F)

[News] [Basics] [Syllabus] [Outlines] [Assignments] [Studies] [Examples] [Readings] [Projects] [API]

# Assignment Three: Racquetball Simulation

• Assigned: Friday, September 12, 1997
• Due: 4pm, Thursday, September 18, 1997

Summary: Many suggest that modular and object-based design supports reuse and therefore makes it more efficient (easier, faster, ...) to develop reasonable variants of programs. In this assignment, you will extend your simulation from the previous assignment.

Note: Make sure to read the whole assignment before beginning it. In particular, you will need to document the time you spend on the initial parts, so you should make sure to record them.

Collaboration: You may work in groups of up to size four on this assignment. In larger groups, you will need to decide which previous assignment to base your work on. All members of a group are responsible for understanding all work turned in.

## Extensions

### Accuracy

We might make our simulation somewhat more accurate by associating three probabilities with each player:

• the quality of the player's serve (best expressed as a probability that the player's serve is returnable)
• the probability of returning a returnable serve, and
• the probability of returning any other ball hit to the player (often, serves are harder to return).

Create a second simulation that uses these probabilities. Again, it should compute the results of 1000 games between the two players, in which the first player always serves first.

### Rules

If your code is appropriately modular, you should be able to quickly change the rules of your game (yes, I did warn you that I might make this change).

Create four more simulations as follows

It is your responsibility to find rules for ping pong and volleyball. You should document the source of the rules and summarize the rules you are using (and no, neither has exactly the same rules as Racquetball). You should not assume that the rules in my ping pong simulation are accurate.

### Analysis

After making these modifications, it is appropriate to step back and think about your original design and how it simplified or complicated your task. Give a short (few sentence) answer to each of the following (preferably as an HTML document, but plain text is fine, too.)

• How many person hours did each modification take? (No, this doesn't need to be anything more than a chart.)
• How many lines-of-code per hour did your produce over the course of the two assignments? How many in the first? How many in the second? (Count only your `.java` files.)
• What changes were necessary to implement the more advanced simulation?
• How could you have better designed the original version to simplify the changes?
• What changes were necessary to implement the new rules?
• How could you have better designed the original version to simplify the changes?
• How is your design superior to my design?