Fall 2004 |
Clay Shields |
Project 2 - Volleyball Statistics
Assigned: October 6, 2004 |
Volleyball Statistics CalculatorThe Georgetown Beach Volleyball Club has been keeping match statistics as required by their league. They would like your help in automating the processing of the individual statistics so they can see how their players are doing. The way they want this done using a modified form of the official indoor statistics [PDF link] as explained below. Here is a gratuitous picture of the GU Beach Volleyball Club on their secret on-campus practice field.
Each player is referred to by their number which, since there are only two players, is either 1 or 2. For each player they keep track of the following actions and their outcomes.
The statistics keepers (seen sitting in the lower right corner of the picture above) keep track of each touch of the ball by each player. They then enter this information into the computer in the following form:
One line with player 1's nameThere can be many lines in the file. You will be reading them one at a time from the file using a loop. A small statistics file might look like this: Katherine SalaisThis shows only four points played. Since they play until one team reaches 25 points, the files that track a full game will be much longer. Sometimes, there are errors in the statistics files when the record keepers get sunscreen in their eyes. Notice that there is an error in the action code on the second to last line of the sample file above - there is no Q action. Fortunately, the player numbers are always correct because the sheets they use are pre-numbered, but there might be errors in the action or outcome codes. If you detect an error, output a message on where the error is in the file, and continue processing. There are several statistics they would like for each player in each game. kill percentage = (kills - errors)/attempts Sample Runs and Data SetsBelow is a sample run of a program that implements this, run on the small data set provided.
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Error in action code: Q on line 12
Katherine Salais Fernando Stoneham
Kill Percentage: 1.000 0.500
Assist Percentage: 0.500 0.000
Pass Percentage: 0.000 1.000
Serve Percentage: 0.667 0.000
Dig Percentage: 0.000 1.000
Block Percentage: 0.000 0.000
Solo block Percentage: 0.000 0.000
There are also some larger data sets for you to use. I have linked to
them below so you can download tem if you like. I also included the
command for you to use to copy them to your directory
on gusun for use there. There are sample results for each
file as well.
Game 1
To copy this to your directory on gusun, use the following command:
cp ~clay/game1.txt ~/ Sample output from Game 1:
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Marylou Hodder Ted Harlin
Kill Percentage: 0.211 0.571
Assist Percentage: 0.875 0.308
Pass Percentage: 0.750 0.923
Serve Percentage: 0.500 0.957
Dig Percentage: 0.000 0.200
Block Percentage: 0.600 0.400
Solo block Percentage: 0.000 0.000
Game 2
To copy this to your directory on gusun, use the following command:
cp ~clay/game2.txt ~/ Sample output from Game 2:
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Erik Hannaman Julio Wey
Kill Percentage: 0.381 0.364
Assist Percentage: 0.000 0.385
Pass Percentage: 0.762 0.706
Serve Percentage: 0.938 0.923
Dig Percentage: 0.143 0.500
Block Percentage: 0.400 0.833
Solo block Percentage: 0.000 0.500
Game 3
To copy this to your directory on gusun, use the following command:
cp ~clay/game3.txt ~/ Sample output from Game 3:
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Erik Smolka Lonnie Brinkerhoff
Kill Percentage: 0.222 0.111
Assist Percentage: 0.000 0.400
Pass Percentage: 0.833 0.571
Serve Percentage: 0.500 0.889
Dig Percentage: 0.333 0.000
Block Percentage: 0.600 0.667
Solo block Percentage: 0.000 0.167
Game 4
To copy this to your directory on gusun, use the following command:
cp ~clay/game4.txt ~/ Sample output from Game 4:
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Margery Rigdon Chandra Shutter
Kill Percentage: 0.316 0.381
Assist Percentage: 0.471 0.133
Pass Percentage: 0.882 0.773
Serve Percentage: 0.905 0.833
Dig Percentage: 0.600 0.750
Block Percentage: 1.000 0.333
Solo block Percentage: 1.000 0.000
Game 5
To copy this to your directory on gusun, use the following command:
cp ~clay/game5.txt ~/ Sample output from Game 5:
GU Beach Volleyball Statistics Determination
Go Hoyas!
Please enter the filename of the statistics file to process:
Error in action code: N on line 13
Error in outcome code: X on line 22
Error in action code: X on line 51
Sharron Johson Kelly Pyatt
Kill Percentage: 0.500 0.375
Assist Percentage: 0.417 0.600
Pass Percentage: 0.765 0.643
Serve Percentage: 0.933 0.909
Dig Percentage: 0.000 0.600
Block Percentage: 0.250 0.429
Solo block Percentage: 0.000 0.000
What to submit
Part 1 - Design DocumentFor the first part you are to submit a design document showing the algorithm you plan to implement. You may submit the algorithm as a flowchart, and if you do you may represent a switch statement by using a decision box with a single line coming out of it, off of which branch other lines, each other line labeled with which case the switch would use. You may also write it out neatly using a language which is similar to that from Homework 1 and has the following terms:
statement ... statement end
Part 2 - Program Source CodeInclude the following header in your source code.
//
You will submit your To submit your program, make sure there is a copy of the source code on your account on gusun. You may name your program what you like - let's assume that it is called beachvb.cc. To submit your program electronically, use the submit program like we did in Homework 2 and project 1, but with the command: submit -a p2 -f beachvb.cc I will not be enabling the electronic submission until after the design documents are in, so don't try to submit too early. |