1. Homepage
  2. Programming
  3. CSCI-1200 Data Structures — Spring 2023 Homework 2 — Hockey Classes

CSCI-1200 Data Structures — Spring 2023 Homework 2 — Hockey Classes

Engage in a Conversation
USRensselaer Polytechnic InstituteRPICSCI-1200 Data StructuresHockey Classes

CSCI-1200 Data Structures — Spring 2023

Homework 2 — Hockey Classes CourseNana.COM

In this assignment you will parse and organize the game results from NCAA Division I Eastern College Athletic Conference men’s ice hockey. Many of you are already familiar with the basics of this sport, as it is one of Rensselaer’s most popular athletics events. We also summarize everything you need to know to complete this assignment. Please read the entire handout before starting to code the assignment. CourseNana.COM

Ice Hockey Here’s a crash course on the rules of ice hockey: Each game between two teams consists of three periods of twenty minutes each. Six players from each team are allowed on the ice at any one time. The players work together to score a goal by hitting the puck into the opponents’ net. Usually one of the six players on each team is designated as the goalie to guard the net. When a goal is scored, one member of the team is credited with the score, and up to two other players are credited with assisting in the score. There are many rules and restrictions on the details of play. If these rules are violated the offending player/team is given a penalty of a two, five, or ten minute duration. During the penalty time period, the offending player must sit out (in the penalty box) and that team plays short-handed (with 5 players instead of 6). The other team has an advantage during this time – the so-called power play. If the score is tied at the end of the 3 regular periods, the teams will play an additional overtime period. Play ends with the first goal scored in overtime (sudden death), and that team wins. If neither team scores during overtime, we will consider the result of this game a tie. Note: Normally the game proceeds to a shootout to resolve the tie. For more information see: http://en.wikipedia.org/wiki/Ice_hockey and http://en.wikipedia.org/wiki/ECAC_Hockey. You will parse an input file which contains the details for one or more hockey games. The data was originally obtained from: http://collegehockeystats.net/1213/schedules/ecachm. The data has been pre-processed to make your work a bit simpler. Here is a partial input file for your program: Saturday, March 2, 2013 Cornell at Yale PERIOD 1 6:22 Yale goal Kenny_Agostino ( Andrew_Miller Jesse_Root ) 7:42 Cornell goal Joel_Lowry ( Greg_Miller ) PERIOD 2 PERIOD 3 2:01 Cornell penalty Erik_Axell 2:00 Tripping 2:07 Yale goal Stu_Wilson ( Kenny_Agostino Andrew_Miller ) 8:45 Cornell penalty Rodger_Craig 2:00 Interference 20:00 Cornell penalty Joel_Lowry 5:00 Contact_to_the_Head 20:00 Yale penalty Gus_Young 5:00 Contact_to_the_Head FINAL Cornell 1 Yale 2 CourseNana.COM

Each game begins with the date and the names of the two teams – the away team is listed first, followed by the home team. The details of the three periods (and overtime if necessary) begin with a label for the period followed by information about each goal scored and penalty assessed in that period. For a goal, we are given the time, team, the keyword “goal”, the name of the player who scored the goal, and then in parentheses the names of zero, one, or two teammates who assisted in scoring the goal. The format of time is mm:ss (minutes and seconds) since the start of that period (regular periods are 20 minutes long). CourseNana.COM

For a penalty, we are given the time, team, the keyword “penalty”, the name of the player who violated the rule, the length of time the team will have to play with one fewer players on the ice, and a description of the violation. At the end of the details the final total number of goals for each team is listed. In this game, Yale scored more goals and is the winner. Note that for ease of parsing we have replaced the spaces between players’ first and last names with underscores (“_”). Similarly, all multi-word team names and multi-word penalty violation descriptions use underscores or dashes instead of spaces. We strongly recommend that you do all of your parsing for this homework using the STL stream operator >> and do not use getline. Your code should not need to rely on the exact placement or quantity of spaces or tabs or newlines in the input. Hint on reading the file: We suggest you structure your code to read in one string at a time. Depending on the string, you’ll know what to read next. If you see the word “PERIOD”, you know to read in an integer for the next period number. If you see a time (formatted with a ’:’ in the middle), you’ll know it is either a goal or penalty. When you are reading in the names of the players who assisted in the goal, you’ll be looking for a closed parenthesis ’)’ to know when the list of assisting players is complete. CourseNana.COM

File I/O and Command Line Arguments Your program will run with three command-line arguments. The first argument will be the name of the input file containing information for one or more ice hockey games. The second argument will be the name of the output file where you will write the computed statistics. The third argument will indicate which data table should be printed. Valid options for the third argument are: --team_stats, --player_stats, or --custom_stats. For example, here is a valid command line to your program: hockey_statistics.exe 2012_small.txt 2012_small_output.txt --team_stats CourseNana.COM

Statistics Collected and Output When --team_stats is specified, your program should create a table with the teams sorted by win percentage, with most wins at the top. We define win percentage as the (# of wins + 0.5 * # of ties ) / total # of games played. If two teams are tied in win percentage, the team with more total goals is listed first. The teams are sorted alphabetically if they are tied in win percentage and total goals. Each row of the table includes the team’s wins, losses, ties, win percentage, goals, and penalties. For example, here is the first part of the output for the 2012_small.txt dataset: Team Name Rensselaer Yale Cornell Clarkson CourseNana.COM

W 5 3 2 2 CourseNana.COM

L 1 3 4 4 CourseNana.COM

T 0 0 0 0 CourseNana.COM

Win% 0.83 0.50 0.33 0.33 CourseNana.COM

Goals 25 10 15 11 CourseNana.COM

Penalties 26 31 33 37 CourseNana.COM

The columns should be lined up and neatly justified. Your output spacing may be slightly different as long as it is well-formatted and easy to read. When the --player_stats option is specified, your program should instead create a table where the players are sorted first by their total number of goals plus assists (higher total first), and secondarily by their number of penalties (lower total first), and if tied in both aspects, then alphabetically by the name. Your table should look like the excerpt below from the complete table of all players from the 2012_small.txt dataset: Player Name Ryan_Haggerty Nick_Bailen Greg_Miller Jacob_Laliberte CourseNana.COM

Team Rensselaer Rensselaer Cornell Rensselaer CourseNana.COM

Goals 3 4 2 2 CourseNana.COM

Assists 6 3 4 4 CourseNana.COM

Penalties 3 1 0 0 CourseNana.COM

2 CourseNana.COM

Matt_Neal Mike_Zalewski Milos_Bubela Dustin_Mowrey Andrew_Miller CourseNana.COM

Rensselaer Rensselaer Rensselaer Cornell Yale CourseNana.COM

2 4 2 0 1 CourseNana.COM

4 2 4 6 4 CourseNana.COM

0 0 2 4 0 CourseNana.COM

When the --custom_stats option is specified your program should print an additional, interesting and creative statistic that can be calculated from this data. Try to leverage some of the input data that was not utilized in preparing the first two tables. For example, can we show that the trailing team becomes more desperate and aggressive by examining the relative number of penalties in the final period? What are the more common penalties? Are certain teams more guilty of certain violations? How significant is the power play advantage? How many goals are scored during time intervals when the opposing team is playing with only five players (or only four players on the ice if two players from the same team are in the penalty box at the same time)? How significant is the “home field advantage”? Do some teams play relatively better at the beginning or end of the season? Write a concise description (< 200 words) of your new statistic. What question you are trying to answer with your statistic? What data did you need to organize? What was interesting or challenging about the implementation of this statistic? Put this description in your plaintext README.txt file along with any other notes for the grader. Be sure to tell the grader which dataset best demonstrates your new statistic and include that output.txt file with your submission. Feel free to create your own dataset and include it and the corresponding output with your submission. There are many possible data structure class designs that are similarly effective and elegant and appropriate for solving this problem. Your plans for your 3rd statistic will likely influence your overall design. Note that you do not need to store all of the information and relationships from the input file. Store the information that is necessary to elegantly organize the data that you need for the three parts of the output. Extra credit will be awarded to particularly interesting statistics that require clever programming. CourseNana.COM

Useful Code To control the formatting of your tables, you’ll want to read up on the various I/O manipulators: std::setw(int), std::setprecision(int), std::fixed, std::left, etc. To use those formatting controls you’ll need to #include . And don’t forget about the sort function that can be used to order the contents of a vector, and that you can create custom comparison functions for sorting. CourseNana.COM

Program Requirements & Submission Details Your program should involve the definition of at least two classes that have their own .h and .cpp files, named appropriately. Initially you should focus on the smaller datasets. Once the basics are working you can extend your solution to handle the bigger test cases. Do all of your work in a folder named hw2 inside of your Data Structures homeworks directory. Use good coding style when you design and implement your program. Be sure to make up new test cases and don’t forget to comment your code! Review the “Good Programming Practices” section on the course webpage to be sure that the TAs will be able give you credit for your hard work. A large portion of the TA grade for this assignment will be awarded for good class design and organization. Make sure to use const and pass-by-reference as appropriate. All class member variables should be private and the public accessor and modifier functions should be thoughtfully designed. CourseNana.COM

3 CourseNana.COM

Please use the provided template README.txt file for any notes you want the grader to read. You must do this assignment on your own, as described in the “Academic Integrity for Homework” handout. If you did discuss the problem or error messages, etc. with anyone, please list their names in your README.txt file. When you’ve finished writing, testing, debugging, and commenting your code, prepare and submit your assignment as instructed on the course webpage. Please ask a TA if you need help preparing your assignment for submission or if you have difficulty writing portable code. 5 points on Test 3 + Test 4, plus passing the hidden simple test case by Wednesday night will earn you a 1 day extension for HW2. Extensions will be posted Thursday morning and show up under “My Late Days/Extensions” on Submitty. Even with the extension and your own late days, you cannot submit later than the end of Saturday. The hidden simple test case uses different (but similar) input to Test 3 to prevent hard coding (not solving the assignment). Hard coding misrepresents your work, is apparent when TAs do their grading, and will result in a 0 on an assignment. If you don’t hard code your output, the hidden simple test case score should be the same as your Test 3 score. CourseNana.COM

4 CourseNana.COM

Get in Touch with Our Experts

WeChat (微信) WeChat (微信)
Whatsapp WhatsApp
US代写,Rensselaer Polytechnic Institute代写,RPI代写,CSCI-1200代写, Data Structures代写,Hockey Classes代写,US代编,Rensselaer Polytechnic Institute代编,RPI代编,CSCI-1200代编, Data Structures代编,Hockey Classes代编,US代考,Rensselaer Polytechnic Institute代考,RPI代考,CSCI-1200代考, Data Structures代考,Hockey Classes代考,UShelp,Rensselaer Polytechnic Institutehelp,RPIhelp,CSCI-1200help, Data Structureshelp,Hockey Classeshelp,US作业代写,Rensselaer Polytechnic Institute作业代写,RPI作业代写,CSCI-1200作业代写, Data Structures作业代写,Hockey Classes作业代写,US编程代写,Rensselaer Polytechnic Institute编程代写,RPI编程代写,CSCI-1200编程代写, Data Structures编程代写,Hockey Classes编程代写,USprogramming help,Rensselaer Polytechnic Instituteprogramming help,RPIprogramming help,CSCI-1200programming help, Data Structuresprogramming help,Hockey Classesprogramming help,USassignment help,Rensselaer Polytechnic Instituteassignment help,RPIassignment help,CSCI-1200assignment help, Data Structuresassignment help,Hockey Classesassignment help,USsolution,Rensselaer Polytechnic Institutesolution,RPIsolution,CSCI-1200solution, Data Structuressolution,Hockey Classessolution,