Predict the Next Play in an NFL Game
Due: 16 Oct 2013
Educational objectives: Experience implementing a self-organizing linked list and solving problems using the above class.
Statement of work: (i) Implement a linked list class that self-organizes as specified below and (ii) implement a simple NFL play prediction program, which is a modification of that in assignment 1, but using your linked list implementation to store the plays.
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
proj3
.
- 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.
- You should implement a doubly-linked list class that self-organizes as described below. You must use this class to store plays. Your implementation may be specific for this requirement, instead of being a generic templated class. You are free to choose the specific features you wish to implement, but they should be reasonable. For example, you will certainly need to implement a method that lets you add plays into the list, and a method that lets you search for a plays in the list. You must also implement an iterator for this list and use it in at least one place in your code.
- 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 three 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. A
- 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 defense, 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 should not store plays or information that are not relevant to our program. Each relevant play should be pushed back in the linked list. 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). If multiple plays have the same relevance value, then the one that appears closer to the front of the list is considered more relevant. If no play is similar, then outputNo similar play
to standard output.This command call also causes self-reorganization of the linked list. The
n
most relevant plays that have been identified are placed at the from of the list, in decreasing order of relevance. However, plays are moved only if they have been output due to thelist
command at least three times prior to the current command. That is, if a play has been identified as one of then
most relevant in this attempt, but has not been output by the list command three or more times in the past, then it is not moved closer to the beginning.
print n
: The firstn
plays in the linked list are output. The format is the same as that forlist
, but without the relevance.
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/proj3 directory on linprog. The .csv files are already available there under the
NFLData
subdirectory ofproj1
. The first person to find an error in our executable will get a bonus point!Notes:
1. Your program should not have any output other than those specified above.
2. You should not use the STL
list
class. You may use the string class, STL algorithms, and functionals. Please get my permission before using any other STL feature.Copyright: Ashok Srinivasan, Florida State University.
Last modified: 1 Oct 2013