/
MLBProjections.cpp
724 lines (635 loc) · 27.2 KB
/
MLBProjections.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
#include "stdafx.h"
#include "MLBProjections.h"
///Items that need to be adjusted.... Catcher games should be greater than half season played games so that The dominate catcher is accounted.
// Catcher File needs to be updated weekly
// MLBPlayerRoster needs to be updated weekly
// Odds needs to be updated daily
// Daily Pts needs to be up to date for hotstreak pts
// DraftKings Player Salary...
/*
Notes:: project for % Baverage vs rhp and lhp ; project a line up for gpp
*/
//*******THIngs to add Based on observed Things ppl say in chat whcih sounds good heehheeheheh
// ADDING....Big HR hitters VS low Strike out pitchers
//
void CalcPlayerProjections(vector<mlbPlayer> x, vector<BallPark> y){
// pitcher ERA vs team if era > 3 +1 if era less than 3 -1 ect..
// Team add points up and see what team is most +/-
// odds if dog -1 if favorite +1 if o/u > 8 +1 else - 1
// series score
// road trip length
// night/day
vector<PlayerInfo> playerLU = LineUpData("DKroster703"); // LINE UP FILE
vector<Catcher> CatcherMLB = CatcherStats();
vector<Pitcher> PitcherMLB = PitcherStats();
vector<Pitcher> isPitching;
vector<mlbPlayer> playerHands = BatterHand();
vector<mlbPlayer> mlbRoster = MLBPlayerRoster();
vector<mlbPlayer> TeamFix = MLBPlayerRosterTT();
vector<gameOdds> OddsIN = LoadGameOdds();
vector<mlbPlayer> PlayersIN = x; //BvpInfo
vector<mlbPlayer> probablePitcher;
vector<Pitcher> CloserPitcher;
vector<BallPark> ParkIN = y;
ofstream myFile;
vector<mlbPlayer> Starters = StartingPlayer();
bool compFlag = false;
bool pitcherInFlag = false;
myFile.open("C:\\progData\\Projection2",std::ofstream::out );
/*//testing vector
cout << "Testing Vector info..." << endl;
for(std::vector<mlbPlayer>::iterator LU = playerHands.begin(); LU != playerHands.end(); LU++){
cout << LU->getName() << " " << LU->getBatLRS() << endl;
}
*/
//Sets all Players to not starting.
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
LU->setStarter(0);
for(std::vector<mlbPlayer>::iterator hands = playerHands.begin(); hands != playerHands.end(); hands++){
if(LU->getName().compare(hands->getName())==0){
LU->setBatLRS(hands->getBatLRS());
}
}
}
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
for(std::vector<mlbPlayer>::iterator str = Starters.begin(); str != Starters.end(); str++){
if(LU->getLastName().compare(str->getLastName())==0 && LU->getTeam().compare(str->getTeam())==0){
LU->setStarter(1);
}
}
}
//gets probable pitchers from bvp and puts them into its own vector called probable pitchers
for(std::vector<mlbPlayer>::iterator ptc = PlayersIN.begin(); ptc != PlayersIN.end(); ptc++){
for(std::vector<mlbPlayer>::iterator ttt = probablePitcher.begin(); ttt != probablePitcher.end(); ttt++){
if(ptc->getStartingPitcher().compare(ttt->getStartingPitcher())==0){
pitcherInFlag = true;
}
}
if(pitcherInFlag == false){
probablePitcher.push_back(*ptc);
}
pitcherInFlag = false;
}
//////testing pitcher and attaching to probable pitchers
cout << "displaying pitcher stats" <<endl;
for(std::vector<Pitcher>::iterator ptc = PitcherMLB.begin(); ptc != PitcherMLB.end(); ptc++){
for(std::vector<mlbPlayer>::iterator ttt = probablePitcher.begin(); ttt != probablePitcher.end(); ttt++){
if(ptc->getName().compare(ttt->getStartingPitcher())==0){
ptc->setPitchingHand(ttt->getPitcherHand());
isPitching.push_back(*ptc);
}
}
if(ptc->getSaves() > 0 || ptc->getGamesPlayed() > ptc->getGamesStarted()){
CloserPitcher.push_back(*ptc);
}
}
myFile << "----------------------------Batters STARTING-------------------------------------------------------------------" << endl;
/////DK points from last 3 games ----> looking for hot streaks
int zz = 1;
///display odds to make sure they are right
for(std::vector<gameOdds>::iterator odds = OddsIN.begin(); odds != OddsIN.end(); odds++){
odds->setAwayTeam(changeTeam(odds->getAwayTeam()));
odds->setHomeTeam(changeTeam(odds->getHomeTeam()));
cout << odds->getAwayTeam() << " @ " << odds->getHomeTeam() << " O/U: "<< odds->getOverUnder() <<" ML: " <<odds->getMoneyLine() << endl;
}
//increment based on date takes 4 games //// Difference should always be 3 <--- ex 425 428 || 428 431
for(int x = 573; x<=576;x++){
vector<mlbPlayer> tempMLB = parseData(x);
for(std::vector<mlbPlayer>::iterator LU = PlayersIN.begin(); LU != PlayersIN.end(); LU++){
for(std::vector<mlbPlayer>::iterator TLU = tempMLB.begin(); TLU != tempMLB.end(); TLU++){
if(LU->getName().compare(TLU->getName())==0){
if(zz==1){
LU->setGame1Pts(TLU->getDkpts());
}
else if(zz == 2){
if(TLU->getBatOrder() > 0){
LU->setBatOrder(TLU->getBatOrder());
}
LU->setGame2Pts(TLU->getDkpts());
}
else if(zz == 3){
if(TLU->getBatOrder() > 0){
LU->setBatOrder(TLU->getBatOrder());
}
LU->setGame3Pts(TLU->getDkpts());
}
else if(zz == 4){
if(TLU->getBatOrder() > 0){
LU->setBatOrder(TLU->getBatOrder());
}
LU->setGame4Pts(TLU->getDkpts());
}
else{
cout << "Error @ zz assign dk points";
}
}
}
}
zz++;
}
cout << "roster->>>geting HS" <<endl;
zz = 1;
for(int x = 573; x<=576;x++){
vector<mlbPlayer> tempMLB = parseData(x);
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
for(std::vector<mlbPlayer>::iterator TLU = tempMLB.begin(); TLU != tempMLB.end(); TLU++){
if(LU->getName().compare(TLU->getName())==0){
if(zz==1){
LU->setGame1Pts(TLU->getDkpts());
}
else if(zz == 2){
LU->setGame2Pts(TLU->getDkpts());
}
else if(zz == 3){
LU->setGame3Pts(TLU->getDkpts());
}
else if(zz == 4){
LU->setGame4Pts(TLU->getDkpts());
}
else if(zz==5){
LU->setFinalPts(TLU->getDkpts());
cout << TLU->getDkpts() <<endl;
}
else{
cout << "Error @ zz assign dk points";
}
}
}
}
zz++;
}
//////////////////////////////////////Creating Player Roster///////////////////////////////////////////////////////////////////
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
for(std::vector<mlbPlayer>::iterator BvP = PlayersIN.begin(); BvP != PlayersIN.end(); BvP++){
if(LU->getName().compare(BvP->getName())==0){
LU->setAtBats(BvP->getAtBats());
LU->setAVG(BvP->getAVG());
if(LU->getBatLRS().compare("")==0)
LU->setBatLRS(BvP->getBatLRS());
LU->setBatOrder(BvP->getBatOrder());
LU->setBB(BvP->getBB());
LU->setBvP(BvP->getBvP());
LU->setCS(BvP->getCS());
LU->setDate(BvP->getDate());
LU->setDkPosn(BvP->getDkPosn());
LU->setDkpts(BvP->getDkpts());
LU->setDoubles(BvP->getDoubles());
LU->setGame1Pts(BvP->getGame1Pts());
LU->setGame2Pts(BvP->getGame2Pts());
LU->setGame3Pts(BvP->getGame3Pts());
LU->setGame4Pts(BvP->getGame4Pts());
LU->setGID(BvP->getGID());
LU->setHits(BvP->getHits());
LU->setHomeAway(BvP->getHomeAway());
LU->setHomeRuns(BvP->getHomeRuns());
LU->setOBP(BvP->getOBP());
LU->setOppt(BvP->getOppt());
LU->setOpptRuns(BvP->getOpptRuns());
LU->setOPS(BvP->getOPS());
LU->setSLG(BvP->getSLG());
LU->setSO(BvP->getSO());
LU->setTeam(BvP->getTeam());
LU->setTeamRuns(BvP->getTeamRuns());
LU->setTriples(BvP->getTriples());
//LU->setPitcherHand(BvP->getPitcherHand());
//LU->setStartingPitcher(BvP->getStartingPitcher());
}
}
}
/////////////////////////////ReAttach Team Data...///////////////////////////////////////////
cout << "ReAttach Team Data...." << endl;
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
for(std::vector<mlbPlayer>::iterator TF = TeamFix.begin(); TF != TeamFix.end(); TF++){
if(LU->getName().compare(TF->getName())==0){
LU->setTeam(TF->getTeam());
}
}
}
////////////////Attach Salary from Line up export file taken from DraftKings /////////////////
cout << "Getting and Attaching Player Salary/Positions..." <<endl;
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
for(std::vector<PlayerInfo>::iterator PI = playerLU.begin(); PI != playerLU.end(); PI++){
if(PI->getName().compare(LU->getName())==0){
LU->setDKsal(PI->getSalary());
LU->setDkPosn(PI->getPos());
}
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////
/////Assigns a H/A to each Player wont Assign anything if they are not playing or in the odds table
cout << "Assigning Home/Away to players...." <<endl;
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
//assign H/A
for(std::vector<gameOdds>::iterator odds = OddsIN.begin(); odds != OddsIN.end(); odds++){
if(LU->getTeam().compare(odds->getAwayTeam())==0){
LU->setHomeAway("A");
LU->setOppt(odds->getHomeTeam());
}
else if(LU->getTeam().compare(odds->getHomeTeam())==0){
LU->setHomeAway("H");
LU->setOppt(odds->getAwayTeam());
}
}
}
/////////////////Pitcher Projection/////////////////////////////////////////////
/* Cycle through all Mlb players and if they are playing said pitcher do some stuff
*/
cout << "Calculating Pitcher Projections" << endl;
for(std::vector<Pitcher>::iterator PL = isPitching.begin(); PL != isPitching.end(); PL++){
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
if(LU->getOppt().compare(PL->getTeam())==0){
LU->setStartingPitcher(PL->getName());
}
//If Batter is starting and playing against pitcher
if(LU->getOppt().compare(PL->getTeam())==0 && LU->isStarter() == 1){
//batter k%
if(LU->getStrikeOutPerecent() > 20){
PL->setKprojection(PL->getKprojection() + 1);
}
//Batter OBP
if(LU->getSeasonOBP() < .32){
PL->set_OBP_Projection(PL->get_OBP_Projection() + 1);
}
if(LU->getSeasonOPS() < .730){
PL->set_OPS_Projection(PL->get_OPS_Projection() + 1);
}
if(LU->getSeasonWOBA() < .320){
PL->set_WOBA_Projection(PL->get_WOBA_Projection() + 1);
}
PL->setProjection(PL->getProjection() + 1);
}
}
}
//////////////////////////////////All Roster Start Projection /////////////////////////////////////////////////////
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
if(LU->getHomeAway().compare("H")!=0 && LU->getHomeAway().compare("A")!=0){
LU->setProjectionScore(LU->getProjectionScore() - 200);
// not playing today....
}
//spread and over under
//Bring in Odds Vector
for(std::vector<gameOdds>::iterator odds = OddsIN.begin(); odds != OddsIN.end(); odds++){
if(odds->getAwayTeam().compare(LU->getTeam())==0 || (odds->getHomeTeam().compare(LU->getTeam())==0)){
// if at home and money line is better than -150 + 2
if(LU->getTeam().compare(odds->getHomeTeam())==0 && odds->getMoneyLine()<-150){
LU->setDebug(LU->getDebug() + "*homeFav+2*");
LU->setProjectionScore(LU->getProjectionScore() + 2);
}
// if away and favorite
else if (LU->getTeam().compare(odds->getAwayTeam())==0 && odds->getMoneyLine()>110){
LU->setDebug(LU->getDebug() + "*AwayFav-1*");
LU->setProjectionScore(LU->getProjectionScore() - 1);
}
//if home dog by
if(LU->getTeam().compare(odds->getHomeTeam())==0 && odds->getMoneyLine() > 135){
LU->setDebug(LU->getDebug() + "*homeDawg+2*");
LU->setProjectionScore(LU->getProjectionScore() + 2);
}
//over/under
if((LU->getTeam().compare(odds->getAwayTeam())==0 || LU->getTeam().compare(LU->getHomeAway())==0) && (odds->getOverUnder() > 8) ){
LU->setDebug(LU->getDebug() + "*O8+2*");
LU->setProjectionScore(LU->getProjectionScore() + 2);
}
else if((LU->getTeam().compare(odds->getAwayTeam())==0 || LU->getTeam().compare(LU->getHomeAway())==0) && (odds->getOverUnder() < 7) ){
LU->setDebug(LU->getDebug() + "*U7-2*");
LU->setProjectionScore(LU->getProjectionScore() - 2);
}
else{
LU->setDebug(LU->getDebug() + "O/U+0");
}
}
}//End Odds
//Pitcher vs Batter
for(std::vector<Pitcher>::iterator ptc = isPitching.begin(); ptc != isPitching.end(); ptc++){
if(LU->getOppt().compare(ptc->getTeam())==0){
LU->setPitcherHand(ptc->getPitchingHand());
// Pitcher Hand Vs Batting Hand//////////////////////////////////////////////////////////////
if(LU->getBatLRS().compare(ptc->getPitchingHand())!=0 && LU->getBatLRS().compare("")!= 0){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*BHvPH+1*");
}
else if(LU->getBatLRS().compare(ptc->getPitchingHand())==0 && LU->getBatLRS().compare("")!=0){
LU->setProjectionScore(LU->getProjectionScore()-1);
LU->setDebug(LU->getDebug() + "*BHvPH-1*");
}
else if(LU->getBatLRS().compare("")!= 0){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*BHvPHisSwitch+1*");
}
////////////////////////////////////////////////////////////////////////////////////////////
/// groundBall Pitcher vs GroundBall Batter//////////////////////////////////////
if(ptc->get_gbPercent() > 50 && LU->get_gbPercent() > 50){
LU->setProjectionScore(LU->getProjectionScore() - 4);
LU->setDebug(LU->getDebug() + "GroundBallBatvsGBpitcher");
}
if(ptc->get_gbPercent() > 50 && LU->get_fbPercent() > 50){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "flyBallbattervsGbPitcher");
}
/////////////////////////////////////////////////////////////////////////////
///////Great Control Batter vs Great strike zone Control batter && Bad Strike zone Pitcher/////
if(ptc->get_KpBB() > 5 && LU->get_BBpK() > .85){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "gcPvs.gcB");
}
if(ptc->get_KpBB() < 3 && LU->get_BBpK() > .85){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "bcPvs.gcB");
}
////////////////////////////////////////////////////////////////////////////////////////////////
// home run to fly ball % of pitcher
if(ptc->getHRlFB() > 10 && LU->getSeasonHRrFlyball() > 14){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "ptchrFB/HR+2");
}
else if(ptc->getHRlFB() > 10 && LU->getSeasonHRrFlyball() > 10){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "ptchrFB/HR+1");
}
///Batter vs Pitcher ERA
if(ptc->getERA() > 4){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "ERA+1");
}
else if(ptc->getERA() < 3){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "ERA-1");
}
// Batter vs PITCHER FIP
if(ptc->getFIP() < 3.5){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "FIP-1");
}
else{
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "FIP+1");
}
// Batter k% vs Pitcher k%
if(LU->getStrikeOutPerecent() > 20 && ptc->getKper9() > 8.5){
LU->setProjectionScore(LU->getProjectionScore() - 2);
LU->setDebug(LU->getDebug() + "BATvsPtchK%-2");
}
// batter BB% vs Pitcher BB/9
if(LU->getWalkPercent() > 12.5 && LU->get_wSB() > .5 && ptc->getBBper9() > 4){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "BATvsPtchK%+2");
}
// Batter HR vs Pitcher K/O
if(ptc->getKper9() < 5 && LU->getSeasonOPS() > .800){
LU->setProjectionScore(LU->getProjectionScore() + 4);
LU->setDebug(LU->getDebug() + "OPSvsPitcherK/9+4!!");
}
}
}
//Batter Performance
//wRAA
if(LU->get_wRAA() > 10 && LU->get_wRAA() < 20){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "*wRAA+1*");
}
else if(LU->get_wRAA() < 0){
LU->setProjectionScore(LU->getProjectionScore() -1);
LU->setDebug(LU->getDebug() + "*wRAA-1*");
}
else if(LU->get_wRAA() > 20){
LU->setProjectionScore(LU->getProjectionScore() +2);
LU->setDebug(LU->getDebug() + "*wRAA+2*");
}
if(LU->getAtBats() > 20 && LU->getOPS() > .900 && LU->getSB() > 1){
LU->setProjectionScore(LU->getProjectionScore() + 3);
LU->setDebug(LU->getDebug() + "*BvP+3*");
}
else if(LU->getAtBats() > 10 && LU->getOPS() > .800 && LU->getSB() > 0){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "*BvP+2*");
}
else if(LU->getAtBats() > 10 && LU->getOPS() > 1 && LU->getAVG() > .330){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "*BvP+2*");
}
else if(LU->getAtBats() > 10 && LU->getAVG() < .250){
LU->setProjectionScore(LU->getProjectionScore() -1);
LU->setDebug(LU->getDebug() + "*BvP-1*");
}
else if(LU->getAtBats() > 20 && LU->getAVG() < .200){
LU->setProjectionScore(LU->getProjectionScore() -2);
LU->setDebug(LU->getDebug() + "*BvP-2*");
}
else if(LU->getAtBats() == 0){
LU->setProjectionScore(LU->getProjectionScore() -1);
LU->setDebug(LU->getDebug() + "*BvP-1*");
}
//Stealing bases....
if((LU->getSeasonGames() > 0) && (LU->getSeasonSB() > 0)){
bool stealpts = false;
if((LU->getSeasonGames()/LU->getSeasonSB())<3){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "*steals+2*");
stealpts = true;
}
else if((LU->getSeasonGames()/LU->getSeasonSB())<4){
LU->setProjectionScore(LU->getProjectionScore() +1);
LU->setDebug(LU->getDebug() + "*steals+1*");
stealpts = true;
}
//using wSB
if(LU->get_wSB() > .9){
LU->setProjectionScore(LU->getProjectionScore() +1);
LU->setDebug(LU->getDebug() + "*wSB+1*");
}
else if(LU->get_wSB() < -.5){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "*wSB-1*");
}
/// Bonus against certain Catchers... if Player steals and catcher has caught 15+ games do... if sb/cs is > 2 catcher is bad else catcher is good
for(std::vector<Catcher>::iterator ctch = CatcherMLB.begin(); ctch != CatcherMLB.end(); ctch++){
if(LU->getOppt().compare(ctch->getTeam())==0 && ctch->getGamesPlayed() > 15 && stealpts == true){
if((ctch->getStolenbases() / ctch->getCaughtStealing() > 2)){
LU->setProjectionScore(LU->getProjectionScore() +1);
LU->setDebug(LU->getDebug() + "*badCatcher+1*");
}
else{
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "*GoodCatcher-1*");
}
}
}
}
// strikeouts and walks %
if(LU->getStrikeOutPerecent() < 14){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "*SOu13%+1*");
}
else if(LU->getStrikeOutPerecent() > 20){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "*SOo25%-1*");
}
else{
LU->setProjectionScore(LU->getProjectionScore() + 0);
LU->setDebug(LU->getDebug() + "*SO%onPar+0*");
}
// Walks
if(LU->getWalkPercent() > 12){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "*Walko12%+1*");
}
else if(LU->getWalkPercent() < 7){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "*Walku7%-1*");
}
else{
LU->setProjectionScore(LU->getProjectionScore() + 0);
LU->setDebug(LU->getDebug() + "*walk%Par+0*");
}
//BvP OPS
if(LU->getOPS() > 1){
LU->setProjectionScore(LU->getProjectionScore() +1);
LU->setDebug(LU->getDebug() + "*OPS+1*");
}
//WOBA
if(LU->getSeasonWOBA() > .410){
LU->setProjectionScore(LU->getProjectionScore() +3);
LU->setDebug(LU->getDebug() + "*Woba+3*");
}
else if(LU->getSeasonWOBA() > .375){
LU->setProjectionScore(LU->getProjectionScore() +2);
LU->setDebug(LU->getDebug() + "*Woba+2*");
}
else if(LU->getSeasonWOBA() > .330){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "*Woba+1*");
}
else{
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "*Woba-1*");
}
//HomeRuns
if(LU->getSeasonGames() > 0 && LU->getSeasonHR() > 0){
if(LU->getSeasonGames() / LU->getSeasonHR() < 5){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "HomeRuns+1*");
}
}
if(LU->getSeasonHRrFlyball() > 14){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "hr/fb+1*");
}
else if(LU->getSeasonHRrFlyball() < 9){
LU->setProjectionScore(LU->getProjectionScore() - 1);
LU->setDebug(LU->getDebug() + "hr/fb-1*");
}
else{
LU->setDebug(LU->getDebug() + "hr/fb+0*");
}
//HotStreak Performance
if(LU->getGame1Pts() > 10 && LU->getGame2Pts() > 10 && LU->getGame3Pts() > 10 && LU->getGame4Pts() > 10){
LU->setProjectionScore(LU->getProjectionScore() + 3);
LU->setDebug(LU->getDebug() + "*HS+3*");
}
else if(LU->getGame1Pts() <= 4 && LU->getGame2Pts() <= 4 && LU->getGame3Pts() <= 4 && LU->getGame4Pts() <= 4){
LU->setProjectionScore(LU->getProjectionScore() - 5);
LU->setDebug(LU->getDebug() + "*HS-5*");
}
else if(LU->getGame3Pts() > 5 && LU->getGame4Pts() > 5){
LU->setProjectionScore(LU->getProjectionScore() + 1);
LU->setDebug(LU->getDebug() + "*HS+1*");
}
else if(LU->getGame2Pts() > 7 && LU->getGame3Pts() > 7 && LU->getGame4Pts() > 7){
LU->setProjectionScore(LU->getProjectionScore() + 2);
LU->setDebug(LU->getDebug() + "*HS+2*");
}
else if(LU->getGame1Pts() < -100 && LU->getGame2Pts() < -100 && LU->getGame3Pts() < -100 && LU->getGame4Pts() < -100){
LU->setProjectionScore(LU->getProjectionScore() -2000);
LU->setDebug(LU->getDebug() + "*HS+-2000NotPlaying*");
}
//pt for posible extra bat if home is up
if(LU->getHomeAway().compare("A")==0){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*ExtraBatAway+1*");
}
//hasnt been playing...
if(LU->getBatOrder()==0){
//LU->setProjectionScore(LU->getProjectionScore()-100);
LU->setDebug(LU->getDebug() + "*BO=0");
}
//Park info
for(std::vector<BallPark>::iterator BP = ParkIN.begin(); BP != ParkIN.end(); BP++){
if(LU->getHomeAway().compare("H")==0 && LU->getTeam().compare(BP->getTeam())==0){
if(LU->getBatLRS().compare("R")==0){
if( BP->getBase3R() > 105 || BP->getHRR() >105){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*hittersPark+1*");
}
else if(BP->getBase3R() < 97 || BP->getHRR() >97){
LU->setProjectionScore(LU->getProjectionScore()-1);
LU->setDebug(LU->getDebug() + "*BadPark-1*");
}
}
else if(LU->getBatLRS().compare("L")==0){
if( BP->getBase3L() > 105 || BP->getHRL() >105){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*hittersPark+1*");
}
else if(BP->getBase3L() < 97 || BP->getHRL() >97){
LU->setDebug(LU->getDebug() + "*badPark-1*");
LU->setProjectionScore(LU->getProjectionScore()-1);
}
}
}
else if(LU->getHomeAway().compare("A")==0 && LU->getOppt().compare(BP->getTeam())==0){
if(LU->getBatLRS().compare("R")==0){
if( BP->getBase3R() > 105 || BP->getHRR() >105){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*hittersPark+1*");
}
else if(BP->getBase3R() < 97 || BP->getHRR() >97){
LU->setProjectionScore(LU->getProjectionScore()-1);
LU->setDebug(LU->getDebug() + "*BadPark-1*");
}
}
else if(LU->getBatLRS().compare("L")==0){
if( BP->getBase3L() > 105 || BP->getHRL() >105){
LU->setProjectionScore(LU->getProjectionScore()+1);
LU->setDebug(LU->getDebug() + "*hittersPark+1*");
}
else if(BP->getBase3L() < 97 || BP->getHRL() >97){
LU->setDebug(LU->getDebug() + "*BadPark-1*");
LU->setProjectionScore(LU->getProjectionScore()-1);
}
}
else{
LU->setDebug(LU->getDebug() + "*switchHitter+1*");
LU->setProjectionScore(LU->getProjectionScore()+1);
}
}
}
}
// Sorts Player Vector by Highest Projection score To Lowest
//std::sort(mlbRoster.begin(), mlbRoster.end(),mlbPlayer::SortPosition());
std::sort(mlbRoster.begin(),mlbRoster.end(),mlbPlayer::compareMyDataFunctor());
/// Batting OUTPUT
for(std::vector<mlbPlayer>::iterator LU = mlbRoster.begin(); LU != mlbRoster.end(); LU++){
//if(LU->getTeam().compare("MIL")==0 ||LU->getTeam().compare("TOR")==0||LU->getTeam().compare("CWS")==0 )
if(LU->getDkPosn().compare("SP")!=0 && LU->getDkPosn().compare("RP")!=0){
cout <<LU->isStarter() <<" " << LU->getLastName() << " " << LU->getTeam() << " " << LU->getOppt() << " " << LU->getBatLRS() << " Pitcher: " << LU->getStartingPitcher() << " " << LU->getPitcherHand() << " "<<LU->get_fbPercent() << " " <<LU->get_gbPercent() << endl; //<< LU->getTeam() << " " <<LU->getProjectionScore() << " " << LU->getDebug() << " " << LU->getDKsal() << " " <<LU->getDkPosn() << " HR:" << LU->getSeasonHR() << " OPS: " << LU->getOPS()<<endl;
if(LU->getDKsal() != 0){ // IF salary is 0 they are not elgible to be picked in the lineup
myFile << LU->getDKsal() << " " << LU->getDkPosn() << " "<< LU->getProjectionScore() << " "<< LU->getName() << " " << LU->getTeam() << LU->getDebug() << " fb%:"<<LU->get_fbPercent() << " gb%:" <<LU->get_gbPercent()<< " BB/K:" << LU->get_BBpK() << " hand:" <<LU->getBatLRS() << endl;
myFile <<" Pitcher:" << LU->getStartingPitcher()<< " hand:" << LU->getPitcherHand()<<endl;
myFile << "------------------------------------------------------------------------------------" << endl;
}
}
}
// is pitching today
myFile << "----------------------------Probable Starting Pitchers-------------------------------------------------------------------" << endl;
cout << "**************we be pitching(((((((((((("<< endl;
for(std::vector<Pitcher>::iterator ptc = isPitching.begin(); ptc != isPitching.end(); ptc++){
cout << ptc->getName() << " " << ptc->getERA() << " " << ptc->getTeam() << " " << ptc->getKper9() << endl;
myFile << ptc->getName() << " " <<ptc->getTeam() << " K/9|| " << ptc->getKper9() << " ERA " << ptc->getERA() << " FIP " << ptc->getFIP() << " BABIP " << ptc->getBABIP() << " Kprojection:" << ptc->getKprojection() << " WOBA: " << ptc->get_WOBA_Projection() << " OPS: "<<ptc->get_OPS_Projection() << " OBP: " << ptc->get_OBP_Projection() << " Projection: " << ptc->getProjection()<< " gb%:" << ptc->get_gbPercent() << " fb%:" << ptc->get_fbPercent() << " K/BB: "<< ptc->get_KpBB() << endl;
}
myFile << "----------------------------Relieve Pitchers STARTING-------------------------------------------------------------------" << endl;
cout << "closers........." << endl;
for(std::vector<Pitcher>::iterator ptc = CloserPitcher.begin(); ptc != CloserPitcher.end(); ptc++){
myFile << ptc->getName() << " " << ptc->getTeam() << " Saves: " << ptc->getSaves() << " GamesPlayed: " << ptc->getGamesPlayed() << " GameStarted: " << ptc->getGamesStarted() << " ERA " << ptc->getERA() << " k/9: " << ptc->getKper9() << " Projection: " << ptc->getProjection()<<endl;
}
myFile.close();
}