Predict the Next Play in an NFL Game
Due: 11 Sep 2013
Educational objectives: Review C++ material that you have learned, such as implementing classes, using templates, performing I/O, and command line arguments. Use of STL classes (which you will learn in Lecture 4) and algorithms. Use of makefiles. Use of a debugger. Use of optimization flags with
g++
.Statement of work: Develop a software that uses STL classes and algorithms, such as (linked)
list
orvector
, to implement a simple NFL play prediction program, as described below. You must use at least one templated STL container and use its iterator.Deliverables: Turn in a
makefile
and all header (*.h) and cpp (*.cpp) files that are needed to build your software. Turn in your development log too, which should be a plain ASCII text file calledLOG.txt
in your project directory. Also turn in an ASCII file, testing.txt, describing how you tested your code. This file should describe any remaining run time errors in your program. You will lose points for errors that we discover which were not identified by you in the above file. You will submit all of these as described in www.cs.fsu.edu/~asriniva/courses/DS13/HWinstructions.html.Requirements:
- Create a subdirectory called
proj1
.- You will need to have a
makefile
in this directory. In addition, all the header and cpp files needed to build your software must be present here, as well as theLOG.txt
andtesting.txt
files.- You should implement appropriate classes for the software. Your code should be well designed and object oriented.
- Your software's main task is as follows. A user will give it a list of
.csv
files. Each file contains a list of plays in each NFL game for one year. The user will then execute a sequence of queries to predict the next play that is likely. You may imagine, for instance, that the coach for the defence will use this to predict what the offense will do next in order to prepare for it. The queries may be of two types. Asummary
query will predict the probability of different types of plays. Alist
query will list plays that the offense executed in similar game situations.- The software is run by the user on the command line, as follows:
Analyze Year-List
, whereYear-List
is a non-empty list of valid years separated by whitespace. The following years are valid: 2007, 2008, 2009, 2010, 2011, and 2012. This instructs the software to analyze data for the specified years. Data for the yearn
is present in the filen.csv
. Each line of this file contains information on a particular play, except the first line which gives field/column headings. Each field in a line is separated by commas. The relevant fields for us are the following: 2. quarter, 3. minutes remaining in the game, 5. team name for offense, 6. team name for defence, 7. down, 8. yards to go for the next down, 9. starting location for that down, 10. description of the play. Some of the fields may be empty.The description is a string, which we will use to determine the type of play. We give below play types of interest to us and how they are identified, based on words in the description.
- Deep pass right: presence of the words 'deep', 'pass', and 'right' in the description.
- Deep pass left: presence of the words 'deep', 'pass', and 'left' in the description.
- Deep pass middle: presence of the words 'deep', 'pass', and 'middle' in the description.
- Short pass right: presence of the words 'short', 'pass', and 'right' in the description.
- Short pass left: presence of the words 'short', 'pass', and 'left' in the description.
- Short pass middle: presence of the words 'short', 'pass', and 'middle' in the description.
- Run to the right: presence of the word 'right' in the description, but not 'pass'.
- Run to the left: presence of the word 'left' in the description, but not 'pass'.
- Run to the middle: presence of the word 'middle' in the description, but not 'pass'.
- Field goal attempt: presence of the words 'field' and 'goal' in the description.
- Punt: presence of the word 'punts' in the description.
- The software first reads each file specified through the command line and stores relevant information in one or more STL containers of your choice. You need not store plays or information that are not relevant to our program. The software then waits for a series of user input from stdin, and responds to each user input as described below.
Possible user actions and required software response:
summary OFF DOWN TOGO YDLINE
: The fields in capitals specify the offense team, down, yards to go, location in field. The software should identify all plays executed in a similar situation and give the percentage of times each type of play was executed. For a play to be considered similar, it should be by the same team in offense and the same down. In addition, the yards to go should be within one yard of the above and the field position should be within 10% of the above. If no similar play exists, then outputNo similar play exists
to standard output (not to standard error).list n MIN OFF DEF DOWN TOGO YDLINE
: The additional fields here denote the minutes remaining and defense team respectively. The software outputs then
most relevant similar plays. If fewer thann
plays are similar, then all the similar plays are output. Plays are considered similar as defined above. Relevance is a floating point number defined as:-(|Min-min|*5/3 + |TOGO-togo| + |YDLINE-ydline|)
. In addition, if the defense teams are identical, add 100 to the relevance. The fields marked in lower case denote corresponding fields in the play database. Each line of the output will give the type of play followed bymin off def down togo ydline
of the play, followed by its relevance. The plays are output in decreasing order of relevance (that is, most relevant play first). Ties are broken randomly. If no play is similar, then outputNo similar play
to standard output.x
: Quit the program.- Output
Invalid command
to standard output for any other command.Sample file and executable: A sample executable and some example files will later be available in the ~cop4530/fall13/solutions/proj1 directory on linprog. The .csv files are already available there under the
NFLData
subdirectory. The first person to find an error in our executable will get a bonus point!Bonus points:
You will get 3 bonus points if your code is faster than our sample executable on some large tests which we will announce after the submission deadline. (Your code should also be correct.)
Copyright: Ashok Srinivasan, Florida State University.
Last modified: 6 Sep 2013