public SuggestedLineup(string leagueId, string ownerCode, string teamCode, string season, int week) { #if DEBUG Utility.Announce(string.Format("Suggesting a lineup for {0} in league {1} team {2} - {3}:{4}", ownerCode, leagueId, teamCode, season, week)); #endif LeagueId = leagueId; League = new FantasyLeague(leagueId); TeamCode = teamCode; OwnerCode = ownerCode; Season = season; Week = week; NflWeek = new NFLWeek(Season, Week.ToString()); if (LeagueId.Equals(Constants.K_LEAGUE_Yahoo) || LeagueId.Equals(Constants.K_LEAGUE_PerfectChallenge)) { Scorer = new EspnScorer(NflWeek); } else { Scorer = new GS4Scorer(NflWeek); } _usedPlayers = new List <NFLPlayer>(); RankMaster = new Hashtable(); IncludeFreeAgents = false; }
public void HotList( string catCode, string position, bool freeAgentsOnly, bool startersOnly) { var gs = new GS4Scorer(Utility.CurrentNFLWeek()); PlayerLister = new PlayerLister { CatCode = catCode, Position = position, FantasyLeague = League, Season = Utility.CurrentSeason(), FreeAgentsOnly = freeAgentsOnly, StartersOnly = startersOnly, Week = Utility.PreviousWeek(), WeekMaster = WeekMaster, WeeksToGoBack = 4 }; PlayerLister.SetScorer(gs); PlayerLister.Load(); PlayerLister.SubHeader = $"{PlayerLister.Position} HotList for {PlayerLister.FantasyLeague}"; PlayerLister.FileOut = $"HotLists//HotList-{PlayerLister.FantasyLeague}-{PlayerLister.Position}"; PlayerLister.Render(PlayerLister.FileOut); }
public void TestGS4Scorer() { var player = new NFLPlayer("MANNPE01"); var week = new NFLWeek("2014", 1); var sut = new GS4Scorer(week); var score = sut.RatePlayer(player, week); Assert.IsTrue(score.Equals(12.0M)); }
public SuggestedLineup(string leagueId, string ownerCode, string teamCode, string season, int week) { #if DEBUG2 Utility.Announce(string.Format("Suggesting a lineup for {0} in league {1} team {2} - {3}:{4}", ownerCode, leagueId, teamCode, season, week)); #endif LeagueId = leagueId; League = new FantasyLeague(leagueId); TeamCode = teamCode; OwnerCode = ownerCode; Season = season; Week = week; NflWeek = new NFLWeek(Season, Week.ToString()); if ( LeagueId.Equals( Constants.K_LEAGUE_Yahoo ) || LeagueId.Equals( Constants.K_LEAGUE_Rants_n_Raves ) ) Scorer = new EspnScorer(NflWeek); else Scorer = new GS4Scorer(NflWeek); _usedPlayers = new List<NFLPlayer>(); RankMaster = new Hashtable(); IncludeFreeAgents = false; }
public string RenderStarters( string cat, string sPos, [System.Runtime.InteropServices.Optional] string fantasyLeague) { Lister.SortOrder = Int32.Parse(TimeKeeper.Week) > 0 ? "POINTS DESC" : "CURSCORES DESC"; PlayoffsOnly = PlayoffsOnly; var theWeek = new NFLWeek( Int32.Parse(TimeKeeper.Season), Int32.Parse(TimeKeeper.Week), loadGames: false); var gs = new GS4Scorer(theWeek); Lister.SetScorer(gs); Lister.StartersOnly = true; Lister.Clear(); Lister.Collect(cat, sPos, fantasyLeague); Lister.Folder = "Starters"; var fileOut = Lister.Render($"{fantasyLeague}-Starters-{sPos}"); if (WriteProjectionReports) { Logger.Trace("Writing PP Reports"); WritePlayerProjectionReports(); } else { Logger.Trace("Skipping PP Reports"); } Lister.Clear(); return(fileOut); }
public string RenderStarters(string cat, string sPos, [System.Runtime.InteropServices.Optional] string fantasyLeague) { Lister.SortOrder = Int32.Parse(Utility.CurrentWeek()) > 0 ? "POINTS DESC" : "CURSCORES DESC"; PlayoffsOnly = PlayoffsOnly; var theWeek = new NFLWeek(Int32.Parse(Utility.CurrentSeason()), Int32.Parse(Utility.CurrentWeek()), false); var gs = new GS4Scorer(theWeek); Lister.RenderToCsv = true; Lister.SetScorer(gs); Lister.StartersOnly = true; Lister.Collect(cat, sPos, fantasyLeague); var fileOut = Lister.Render(string.Format("{1}-Starters-{0}", sPos, fantasyLeague)); if (WriteProjections) { WritePlayerProjections(); } Lister.Clear(); return(fileOut); }
public SuggestedLineup(string leagueId, string ownerCode, string teamCode, IKeepTheTime timekeeper) : base(timekeeper) { #if DEBUG Announce($@"Suggesting a lineup for { ownerCode } in league { leagueId } team { teamCode } - { timekeeper.Season}:{timekeeper.Week}" ); #endif LeagueId = leagueId; League = new FantasyLeague(leagueId); TeamCode = teamCode; OwnerCode = ownerCode; Season = timekeeper.CurrentSeason(); Week = Int32.Parse(timekeeper.Week); NflWeek = new NFLWeek(Season, Week.ToString()); if (LeagueId.Equals(Constants.K_LEAGUE_Yahoo) || LeagueId.Equals(Constants.K_LEAGUE_Rants_n_Raves)) { Scorer = new EspnScorer(NflWeek); } else { Scorer = new GS4Scorer(NflWeek); } #if DEBUG Scorer.AnnounceIt = true; #endif _usedPlayers = new List <NFLPlayer>(); RankMaster = new Hashtable(); IncludeFreeAgents = false; }
public void HotList(string catCode, string position, bool freeAgentsOnly, bool startersOnly) { var gs = new GS4Scorer(Utility.CurrentNFLWeek()); PlayerLister = new PlayerLister { CatCode = catCode, Position = position, FantasyLeague = League, Season = Utility.CurrentSeason(), FreeAgentsOnly = freeAgentsOnly, StartersOnly = startersOnly, Week = Utility.PreviousWeek(), WeekMaster = WeekMaster, WeeksToGoBack = 4 }; PlayerLister.SetScorer(gs); PlayerLister.Load(); PlayerLister.SubHeader = string.Format("{1} HotList for {0}", PlayerLister.FantasyLeague, PlayerLister.Position); PlayerLister.FileOut = string.Format("HotLists//HotList-{0}-{1}", PlayerLister.FantasyLeague, PlayerLister.Position); PlayerLister.Render(PlayerLister.FileOut); }
public void TallyGridStatsFor(NflTeam nflTeam, bool announceIt) { var theWeek = new NFLWeek(Season, WeekNo); var scorer = new GS4Scorer(theWeek) { AnnounceIt = announceIt, ScoresOnly = true }; var playerList = LoadLineupPlayers(nflTeam.TeamCode == HomeTeam ? HomeTeam : AwayTeam); foreach (var nflPlayer in playerList) { if (!nflPlayer.IsFantasyPlayer()) continue; var qty = scorer.RatePlayer(nflPlayer, theWeek); if (qty > 0.0M) { GridStatsList.Add(new GridStatsOutput( Season, Week, nflPlayer.PlayerCode, qty, Opponent(nflTeam.TeamCode))); } } }
public string RenderStarters(string cat, string sPos, [System.Runtime.InteropServices.Optional] string fantasyLeague) { Lister.SortOrder = Int32.Parse( TimeKeeper.Week ) > 0 ? "POINTS DESC" : "CURSCORES DESC"; PlayoffsOnly = PlayoffsOnly; var theWeek = new NFLWeek( Int32.Parse(TimeKeeper.Season), Int32.Parse(TimeKeeper.Week), loadGames:false); var gs = new GS4Scorer(theWeek); Lister.RenderToCsv = DoCsv; Lister.SetScorer(gs); Lister.StartersOnly = true; Lister.Clear(); Lister.Collect(cat, sPos, fantasyLeague); Lister.Folder = "Starters"; var fileOut = Lister.Render(string.Format("{1}-Starters-{0}", sPos, fantasyLeague)); if ( WriteProjectionReports ) { Logger.Info( "Writing PP Reports" ); WritePlayerProjectionReports(); } else Logger.Info( "Skipping PP Reports" ); Lister.Clear(); return fileOut; }