Fall 2004

Clay Shields


front | classes | research | personal | contact

Project 2 - Volleyball Statistics

Assigned: October 6, 2004
Design due: October 13, 2004
Program Source code due: October 19, 2004

Volleyball Statistics Calculator


The 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.

Picture linked from http://student.sun.ac.za/volleyball/photos/images/social/beach11oct/DSC00151.JPG

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.

ActionCodeOutcomeCode
Kill
Attempt
KKillK
ErrorE
ZeroZ
AssistAKillK
ErrorE
ZeroZ
PassPKillK
ErrorE
ZeroZ
ServeSAceA
ErrorE
ZeroZ
DigDDigD
ErrorE
BlockBSoloS
AssistA
ErrorE

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 name
One line with player 2's name
One line for each touch of the ball, each with the format:
<player #> <action code> <outcome code>
There 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 Salais
Fernando Stoneham
1 S A
1 S Z
2 D D
1 A K
2 K K
1 S E
2 P Z
1 A Z
2 K Z
2 Q K
1 K K
This 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
assist percentage = (kills - errors)/attempts
pass percentage = zeros/attempts
serve percentage = (attempts - errors)/attempts
dig percentage = (digs - errors)/attempts
block percentage = (attempts - errors)/attempts
solo block percentage = (solo - errors)/attempts

Sample Runs and Data Sets


Below 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

Data set for 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

Data set for 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

Data set for 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

Data set for 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

Data set for 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 Document

For 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:
  1. input
  2. output
  3. calculate
  4. if condition, then statement
  5. if condition, then statement; otherwise, statement
  6. switch case* statement [case* statement]*
  7. while condition statement
  8. start
  9. stop
If you need to group multiple statements together, say in an if statement, use
    begin
       statement
       ...
       statement
    end
A copy of your algorithm is due in class. Be sure to keep a copy for yourself!

Part 2 - Program Source Code

Include the following header in your source code.

//
// Project 1
// Name: <your name>
// E-mail: <your e-mail address>
// COSC 071
//
// In accordance with the class policies and
// Georgetown's Honor Code, I certify
// that I have neither given nor received
// any assistance on this project with the
// exceptions of the lecture notes and those
// items noted below.
//
// Description: <Describe your program>
//

You will submit your source code using the submit program. Do not submit the compiled version! I don't speak binary very well.

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.