-
Notifications
You must be signed in to change notification settings - Fork 0
/
MakeDataFile.cpp
849 lines (705 loc) · 20.2 KB
/
MakeDataFile.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <map>
#include <string>
#include <ctime>
#include <algorithm>
#include <regex>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <limits.h>
#include <dirent.h>
using namespace std;
string data = "";
vector<string> listOfTeamData;
vector<string> listOfStartTable;
vector<string> listOfBenchTable;
vector<string> listOfFastBreakPoints;
vector<string> listOfPointsInThePaint;
vector<string> listOfTeamTurnoversPoints;
vector<string> listOfPointsOffTurnovers;
string stringOfHomeTeam = "";
string stringOfHomeScore = "";
string stringOfAwayTeam = "";
string stringOfAwayScore = "";
string stringOfGameTime = "";
string stringOfEventLocation = "";
string stringOfOfficials = "";
string stringOfAttendance = "";
string dataLine = "";
vector<string> dataLineList;
string teamNameScoreExpression = "espn.go.com/nba/team/.*?\">(.*?)</a> <span>(.*?)</span>";
string gameTimeExpression = "game-time-location\"><p>(.*?)<";
string eventLocationExpression = "game-time-location\"><p>.*?</p><p>(.*?)</p></div>";
string fastBreakExpression = "Fast break points:</strong> (.*?)<br />";
string pointsInThePaintExpression = "Points in the paint:</strong> (.*?)<br />";
string teamTurnoversExpression = "Total Team Turnovers \\(Points off turnovers\\):</strong> (.*?) \\(";
string pointsOffTurnoversExpression = "Total Team Turnovers \\(Points off turnovers\\):</strong> .*? \\((.*?)\\)</div><div";
string officialsExpression = "Officials:</strong> (.*?)<br>";
string attendanceExpression = "Attendance:</strong> (.*?)<br";
string teamDataExpression = "STARTERS([\\s\\S]*?TOTALS)";
string startersExpression = "</thead><tbody><tr align=right valign=middle class=\"odd ([\\s\\S]*?)>BENCH</th>";
string benchExpression = "</thead><tbody><tr align=right valign=middle class=\"even ([\\s\\S]*?)>TOTALS";
string playerStatsExpression = "href=\".*?\">(.*?)</a>, (.*?)</td><td>(.*?)</td><td>(.*?)-(.*?)</td><td>(.*?)-(.*?)</td><td>(.*?)-(.*?)</td><td.*?>(.*?)</td><td.*?>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)</td><td>(.*?)<";
string playerDNPexpression = "href=\".*?\">(.*?)</a>, (.*?)</td><td.*?DNP.*?</td></tr>";
string errorFileUniqueString = ".line-score-container";
string get_file_contents(const char *filename);
bool fileExists(string name);
void listDir(vector<string> &filesInDirectory);
void captureHomeAndAwayTeam();
void oneCapture(string &captureString, string &expression);
void captureNLength(vector<string> &capList, string &expression, string &searchString);
void getPlayerStats(string &expression, string searchString, bool starter, bool home);
void getPlayerStatsDNP(string &expression, string searchString, bool starter, bool home);
void JrSrFormat(string &dataLine);
void emptyAllVectors();
int main()
{
vector<string> filesInAsciiGameDirectory;
int chdirRet;
int amountFound;
int mkdirRet;
//int renameRet;
//get cwd
char* cwd;
char buffer[PATH_MAX];
cwd = getcwd(buffer, PATH_MAX);
string currentDirectory(cwd);
//create directory strings
string masterDirectory = currentDirectory + "/ESPN_HTML_Cache";
string AsciiGameDirectory = masterDirectory + "/Ascii_Cut_Game_Files";
string dataExtractedDirectory = masterDirectory + "/Data_Extracted_Files";
//make directory strings into const char*
const char* cMasterDirectory = masterDirectory.c_str();
const char* cAsciiGameDirectory = AsciiGameDirectory.c_str();
const char* cDataExtractedDirectory = dataExtractedDirectory.c_str();
mkdirRet = mkdir(cDataExtractedDirectory, S_IRWXU | S_IRWXG | S_IRWXO);
if (mkdirRet == -1)
cout << "\"" << cDataExtractedDirectory << "\" already exists!" << endl;
//change to master directory in order to see if file data file is empty
chdirRet = chdir(cMasterDirectory);
if (chdirRet == -1)
{
cout << "Could not change directory! Quitting." << endl;
return 1;
}
//if file does not exist we need the header for the file
bool doesDataFileExist = fileExists("completeDataFile.txt");
if (!doesDataFileExist)
{
dataLineList.push_back("Player,Position,Start,Minutes,FGM,FGA,3PM,3PA,FTM,FTA,OREB,DREB,REB,AST,STL,BLK,TO,PF,Plus/Minus,PT,Home/Away,Team,Opponent,Win/Loss,FastBreakPoints,PointsInThePaint,TotalTeamTurnovers,PointsOffTurnovers,Time,Date,Year,Stadium,City,State/Province,Off1,Off2,Off3,Off4,Attendance");
}
//change the current directory to ascii cut strings directory
chdirRet = chdir(cAsciiGameDirectory);
if (chdirRet == -1)
{
cout << "Could not change directory! Quitting." << endl;
return 1;
}
listDir(filesInAsciiGameDirectory);
sort(filesInAsciiGameDirectory.begin(), filesInAsciiGameDirectory.end());
for(size_t i = 2; i < filesInAsciiGameDirectory.size(); i++)
{
bool insufficientData = false;
size_t found = 0;
//clear data and get new contents
data = "";
data = get_file_contents(filesInAsciiGameDirectory[i].c_str());
//cout << filesInAsciiGameDirectory[i] << endl;
//commence regular expressions
captureHomeAndAwayTeam();
oneCapture(stringOfGameTime, gameTimeExpression);
//fix format for date then append
while(1)
{
found = stringOfGameTime.find(", ");
if (found != std::string::npos)
{
stringOfGameTime.erase(found + 1, 1);
}
else
{
break;
}
}
oneCapture(stringOfEventLocation, eventLocationExpression);
//fix format for event location then append
while(1)
{
found = stringOfEventLocation.find(", ");
if (found != std::string::npos)
{
stringOfEventLocation.erase(found + 1, 1);
}
else
{
break;
}
}
oneCapture(stringOfAttendance, attendanceExpression);
//cout << stringOfAttendance << endl;
if(stringOfAttendance == "N/A")
{
stringOfAttendance = "";
}
//get rid of commas in attendance
while(1)
{
found = stringOfAttendance.find(",");
if (found != std::string::npos)
{
stringOfAttendance.erase(found, 1);
}
else
{
break;
}
}
oneCapture(stringOfOfficials, officialsExpression);
//cout << stringOfOfficials << endl;
//format Jr and Sr in officials
JrSrFormat(stringOfOfficials);
//make offcials list have no whitespace near commas
while(1)
{
found = stringOfOfficials.find(", ");
if (found != std::string::npos)
{
stringOfOfficials.erase(found + 1, 1);
}
else
{
break;
}
}
//determine amount of commas in stringOfOfficials
amountFound = count(stringOfOfficials.begin(), stringOfOfficials.end(), ',');
//append commas to the end until there are 4 total commas
char lastChar = stringOfOfficials.back();
//there is a special case where there is trailing whitespace
if(lastChar == ' ')
{
stringOfOfficials = stringOfOfficials.substr(0, stringOfOfficials.length() - 1);
}
//append commas until the correct amount of columns are made
for(; amountFound < 4; amountFound++)
{
stringOfOfficials = stringOfOfficials + ",";
}
found = data.find("Top Performers");
if (found == std::string::npos)
{
found = data.find("<!-- end line score -->");
if(found != std::string::npos)
{
insufficientData = true;
}
}
if (insufficientData == false)
{
captureNLength(listOfTeamData, teamDataExpression, data);
captureNLength(listOfFastBreakPoints, fastBreakExpression, data);
captureNLength(listOfPointsInThePaint, pointsInThePaintExpression, data);
captureNLength(listOfTeamTurnoversPoints, teamTurnoversExpression, data);
captureNLength(listOfPointsOffTurnovers, pointsOffTurnoversExpression, data);
}
//if teamData returns an empty string we have extra tests
if(listOfTeamData.size() < 2)
{
//cout << "That file contains insufficient data! Skipping" << endl;
insufficientData = true;
}
if(insufficientData == true)
{
//run second test to see if file is truly garbage
found = data.find(errorFileUniqueString);
if(found == string::npos)
{
//in this unique situation we need special treatment
//captureNLength(listOfStartTable, typeZeroStartersExpression, data);
//captureNLength(listOfBenchTable, typeZeroBenchExpression, data);
cout << filesInAsciiGameDirectory[i] << endl;
//getPlayerStatsTypeZero(typeOneTeams, listOfStartTable[0], true, false);
//getPlayerStatsTypeZero(typeOneTeams, listOfBenchTable[0], false, false);
//getPlayerStatsTypeZero(typeOneTeams, listOfStartTable[1], true, true);
//getPlayerStatsTypeZero(typeOneTeams, listOfBenchTable[1], false, true);
}
//if data truly is not there we need to skip this file
}
//if sufficient data is found we run further tests
else
{
captureNLength(listOfStartTable, startersExpression, data);
captureNLength(listOfBenchTable, benchExpression, data);
getPlayerStats(playerStatsExpression, listOfStartTable[0], true, false);
getPlayerStats(playerStatsExpression, listOfBenchTable[0], false, false);
getPlayerStatsDNP(playerDNPexpression, listOfBenchTable[0], false, false);
getPlayerStats(playerStatsExpression, listOfStartTable[1], true, true);
getPlayerStats(playerStatsExpression, listOfBenchTable[1], false, true);
getPlayerStatsDNP(playerDNPexpression, listOfBenchTable[1], false, true);
}
//append found data from loop into data file
fstream fileInput;
fileInput.open (masterDirectory + "/" + "completeDataFile.txt", std::fstream::in | std::fstream::out | std::fstream::app);
for(size_t k = 0; k < dataLineList.size(); k++)
{
fileInput << dataLineList[k] << endl;
}
fileInput.close();
emptyAllVectors();
//create strings for old and new file location
//string oldFileName = AsciiGameDirectory + "/" + filesInAsciiGameDirectory[i];
//string newFileName = dataExtractedDirectory + "/" + filesInAsciiGameDirectory[i];
//const char* cOldFileName = oldFileName.c_str();
//const char* cNewFileName = newFileName.c_str();
//attempt to move file into another directory
//renameRet = rename(cOldFileName, cNewFileName);
//if (renameRet == -1)
//{
// cout << filesInAsciiGameDirectory[i] << "could not be renamed!" << endl;
// cout << "Exiting Program" << endl;
// return 1;
//}
}
return 0;
}
string get_file_contents(const char *filename)
{
ifstream in(filename, ios::in);
if (in)
{
string contents;
in.seekg(0, ios::end);
contents.resize(in.tellg());
in.seekg(0, ios::beg);
in.read(&contents[0], contents.size());
in.close();
return contents;
}
throw(errno);
}
bool fileExists(string name)
{
struct stat buffer;
return (stat (name.c_str(), &buffer) == 0);
}
void listDir(vector<string> &filesInDirectory)
{
filesInDirectory.clear();
DIR *d;
struct dirent *dir;
d = opendir(".");
if (d)
{
while ((dir = readdir(d)) != NULL)
{
filesInDirectory.push_back(dir->d_name);
}
closedir(d);
}
}
void captureHomeAndAwayTeam()
{
//init regular expression
const regex teamsAndScore(teamNameScoreExpression);
smatch matches;
int pos = 0;
int awayOrHome = 0;
string tempDataString = data;
try
{
while(1)
{
tempDataString = data.substr(pos);
//start regular expression iterators
if(regex_search(tempDataString, matches, teamsAndScore))
{
if(awayOrHome % 2 == 0)
{
stringOfAwayTeam = matches[1];
stringOfAwayScore = matches[2];
}
else
{
stringOfHomeTeam = matches[1];
stringOfHomeScore = matches[2];
}
pos = pos + matches.position(2) + matches.length(2);
awayOrHome += 1;
}
else
{
break;
}
}
}
//if an error occurs exit program
catch(regex_error& e)
{
cout << "A regex error has occured" << endl;
exit (1);
}
}
void oneCapture(string &captureString, string &expression)
{
bool found = false;
smatch matches;
try
{
//init regular expression
const regex regularExp(expression);
//find if regular expression exists
found = regex_search(data, matches, regularExp);
//if we find a match push back data
if(found)
{
captureString = matches[1];
}
//if no match push back empty string
else
{
captureString = "";
}
}
//if an error occurs exit program
catch(regex_error& e)
{
cout << "A regex error has occured" << endl;
exit (1);
}
}
void captureNLength(vector<string> &capList, string &expression, string &searchString)
{
const regex NCapRegex(expression);
smatch matches;
int pos = 0;
string tempDataString = searchString;
try
{
while(1)
{
tempDataString = searchString.substr(pos);
//start regular expression iterators
if(regex_search(tempDataString, matches, NCapRegex))
{
capList.push_back(matches[1]);
pos = pos + matches.position(1);
}
else
{
break;
}
}
}
//if an error occurs exit program
catch(regex_error& e)
{
cout << "A regex error has occured" << endl;
exit (1);
}
}
void getPlayerStats(string &expression, string searchString, bool starter, bool home)
{
const regex NCapRegex(expression);
smatch matches;
int pos = 0;
try
{
while(1)
{
dataLine = "";
searchString = searchString.substr(pos);
//start regular expression iterators
if(regex_search(searchString, matches, NCapRegex))
{
dataLine = dataLine + matches[1].str() + ",";
//make position NA into a blank string
if(matches[2] == "NA")
{
dataLine = dataLine + ",";
}
else
{
dataLine = dataLine + matches[2].str() + ",";
}
//determine whether starter or not
if(starter)
{
dataLine = dataLine + "Starter,";
}
else
{
dataLine = dataLine + "Bench,";
}
//append data in formated string
for(int i = 3; i < 20; i++)
{
dataLine = dataLine + matches[i].str() + ",";
}
//determine whether home or not
if(home)
{
//assign stats found if Home
dataLine = dataLine + "Home,";
dataLine = dataLine + stringOfHomeTeam + ",";
dataLine = dataLine + stringOfAwayTeam + ",";
//determine winner and append data
if (stoi(stringOfHomeScore) > stoi(stringOfAwayScore))
{
dataLine = dataLine + "Won,";
}
else
{
dataLine = dataLine + "Loss,";
}
dataLine = dataLine + listOfFastBreakPoints[1] + ",";
dataLine = dataLine + listOfPointsInThePaint[1] + ",";
dataLine = dataLine + listOfTeamTurnoversPoints[1] + ",";
dataLine = dataLine + listOfPointsOffTurnovers[1] + ",";
}
else
{
dataLine = dataLine + "Away,";
dataLine = dataLine + stringOfAwayTeam + ",";
dataLine = dataLine + stringOfHomeTeam + ",";
if (stoi(stringOfAwayScore) > stoi(stringOfHomeScore))
{
dataLine = dataLine + "Won,";
}
else
{
dataLine = dataLine + "Loss,";
}
dataLine = dataLine + listOfFastBreakPoints[0] + ",";
dataLine = dataLine + listOfPointsInThePaint[0] + ",";
dataLine = dataLine + listOfTeamTurnoversPoints[0] + ",";
dataLine = dataLine + listOfPointsOffTurnovers[0] + ",";
}
dataLine = dataLine + stringOfGameTime + ",";
dataLine = dataLine + stringOfEventLocation + ",";
dataLine = dataLine + stringOfOfficials;
dataLine = dataLine + stringOfAttendance;
pos = matches.position(18);
//fix the format of Jr and Sr
JrSrFormat(dataLine);
dataLineList.push_back(dataLine);
}
else
{
break;
}
}
}
//if an error occurs exit program
catch(regex_error& e)
{
cout << "A regex error has occured" << endl;
exit (1);
}
}
void getPlayerStatsDNP(string &expression, string searchString, bool starter, bool home)
{
const regex NCapRegex(expression);
smatch matches;
int pos = 0;
try
{
while(1)
{
dataLine = "";
searchString = searchString.substr(pos);
//start regular expression iterators
if(regex_search(searchString, matches, NCapRegex))
{
//append stats to data string
dataLine = dataLine + matches[1].str() + ",";
//make position NA into a blank string
if(matches[2] == "NA")
{
dataLine = dataLine + ",";
}
else
{
dataLine = dataLine + matches[2].str() + ",";
}
//determine whether starter or not
if(starter)
{
dataLine = dataLine + "Starter,";
}
else
{
dataLine = dataLine + "Bench,";
}
//append data in formated string
for(int i = 0; i < 17; i++)
{
dataLine = dataLine + "0,";
}
//determine whether home or not
if(home)
{
//assign stats found if Home
dataLine = dataLine + "Home,";
dataLine = dataLine + stringOfHomeTeam + ",";
dataLine = dataLine + stringOfAwayTeam + ",";
//determine winner and append data
if (stoi(stringOfHomeScore) > stoi(stringOfAwayScore))
{
dataLine = dataLine + "Won,";
}
else
{
dataLine = dataLine + "Loss,";
}
dataLine = dataLine + listOfFastBreakPoints[1] + ",";
dataLine = dataLine + listOfPointsInThePaint[1] + ",";
dataLine = dataLine + listOfTeamTurnoversPoints[1] + ",";
dataLine = dataLine + listOfPointsOffTurnovers[1] + ",";
}
else
{
dataLine = dataLine + "Away,";
dataLine = dataLine + stringOfAwayTeam + ",";
dataLine = dataLine + stringOfHomeTeam + ",";
if (stoi(stringOfAwayScore) > stoi(stringOfHomeScore))
{
dataLine = dataLine + "Won,";
}
else
{
dataLine = dataLine + "Loss,";
}
dataLine = dataLine + listOfFastBreakPoints[0] + ",";
dataLine = dataLine + listOfPointsInThePaint[0] + ",";
dataLine = dataLine + listOfTeamTurnoversPoints[0] + ",";
dataLine = dataLine + listOfPointsOffTurnovers[0] + ",";
}
dataLine = dataLine + stringOfGameTime + ",";
dataLine = dataLine + stringOfEventLocation + ",";
dataLine = dataLine + stringOfOfficials;
dataLine = dataLine + stringOfAttendance;
pos = matches.position(2);
//fix the format of Jr and Sr
JrSrFormat(dataLine);
dataLineList.push_back(dataLine);
}
else
{
break;
}
}
}
//if an error occurs exit program
catch(regex_error& e)
{
cout << "A regex error has occured" << endl;
exit (1);
}
}
void JrSrFormat(string &dataLine)
{
size_t foundJrTypeZero;
size_t foundJrTypeOne;
size_t foundJrTypeTwo;
size_t foundSrTypeZero;
size_t foundSrTypeOne;
size_t foundSrTypeTwo;
string JrTypeZero = "Jr.";
string JrTypeOne = ",Jr";
string JrTypeTwo = ", Jr";
string SrTypeZero = "Sr.";
string SrTypeOne = ",Sr";
string SrTypeTwo = ", Sr";
while(1)
{
foundJrTypeZero = dataLine.find(JrTypeZero);
if (foundJrTypeZero != std::string::npos)
{
dataLine.erase(foundJrTypeZero + 2, 1);
}
else
{
break;
}
}
while(1)
{
foundJrTypeOne = dataLine.find(JrTypeOne);
if (foundJrTypeOne != std::string::npos)
{
dataLine.replace(foundJrTypeOne, 1, " ");
}
else
{
break;
}
}
while(1)
{
foundJrTypeTwo = dataLine.find(JrTypeTwo);
if (foundJrTypeTwo != std::string::npos)
{
dataLine.erase(foundJrTypeTwo, 1);
}
else
{
break;
}
}
while(1)
{
foundSrTypeZero = dataLine.find(SrTypeZero);
if (foundSrTypeZero != std::string::npos)
{
dataLine.erase(foundSrTypeZero + 2, 1);
}
else
{
break;
}
}
while(1)
{
foundSrTypeOne = dataLine.find(SrTypeOne);
if (foundSrTypeOne != std::string::npos)
{
dataLine.replace(foundSrTypeOne, 1, " ");
}
else
{
break;
}
}
while(1)
{
foundSrTypeTwo = dataLine.find(SrTypeTwo);
if (foundSrTypeTwo != std::string::npos)
{
dataLine.erase(foundSrTypeTwo, 1);
}
else
{
break;
}
}
}
void emptyAllVectors()
{
//clear out all vectors to keep memory low
listOfTeamData.clear();
listOfStartTable.clear();
listOfBenchTable.clear();
listOfFastBreakPoints.clear();
listOfPointsInThePaint.clear();
listOfTeamTurnoversPoints.clear();
listOfPointsOffTurnovers.clear();
dataLineList.clear();
}
//listDir algorithm "http://stackoverflow.com/questions/4204666/how-to-list-files-in-a-directory-in-a-c-program"
//get_file_contents algorithm "http://insanecoding.blogspot.com/2011/11/how-to-read-in-file-in-c.html"
//fast "file exists" algorithm http://stackoverflow.com/questions/12774207/fastest-way-to-check-if-a-file-exist-using-standard-c-c11-c