Hello Monks. I am here seeking your wisdom once again. I am trying to develop a program to read a log file generated by a football sim. I would like the program to compile a stastical breakdown for each player. Things like per quarter and per half stats as well as down and distance stats etc. I am having trouble determining the best way to attack this though. Below is an excerpt from one of the log files.
Beginning of First Quarter.
ORL 13 Sauls kicked off 71 yards from the ORL30.
ASH 22 Noa returned the ball 14 yards to the ASH13. Tackled by ORL
+82 Ferguson.
Possession to Asheville.
1-10-ASH13 (14:30) ASH 48 Hopper ran around right end for 1 yard.
Tackled by ORL 94 Whiting, assisted by ORL 54 Schacht.
2-09-ASH14 (13:59) ASH 23 Theriot ran inside the left guard for 1
+ yard.
Tackled by ORL 96 Dugger.
3-08-ASH15 (13:25) ASH 18 Hall pass completed to 23 Theriot for 1
+0 yards.
Tackled by ORL 96 Dugger.
--
1-10-ASH25 (12:50) ASH 38 Dollinger ran around right end for 6 ya
+rds.
Tackled by ORL 95 Gonzalez, assisted by ORL 54 Schacht.
Key block delivered by ASH 77 Cassell.
2-04-ASH31 (12:05) ASH 18 Hall pass was overthrown, intended for
+81 Perry.
Penalty: ORL - Offsides.
--
I need to parse the lines to determine what type of play it was, who was involved, what the down and distance was etc. That isn't too difficult however the lines are not always consistent. As you can see some of the lines have additional information than just the play result and who made the tackle, such as who had a key run block. There are also penalties to deal with and the -- indicates a first down.
Does anyone have any suggestions on the best way to parse some thing like this? Also what type of data structures should I store the information in. When I had tried to tackle this before I tried slurping all the 1st quarter lines into an array and then the second quarter lines into another array etc as well as creating an array for home games and away games etc, but that didn't seem efficent. Is there a good way using hash of hashes or arrays in hashes to store this information for each player?
I apologize if this isn't very clear, but I am just lost as to what the best way to tackle this is. I can try and clarify any thing that I haven't explained well. Any help you can offer would be greatly appreciated.
Thanks!
-Prime
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.