public void RenderTeamToDefendAgainst( NFLWeek week ) { // Team to beat report showing a jucy opponent for a particular defence var offset = -4; if ( week.WeekNo < 2 ) { // do the whole of last season #if DEBUG Utility.Announce( "Looking back at the whole of last season" ); #endif offset = -Constants.K_WEEKS_IN_REGULAR_SEASON; } else { #if DEBUG Utility.Announce( "Going back 4 games" ); #endif } var ttb = new TeamLister { Heading = string.Format( "{0}\\defense\\Team To beat-{1:0#}", week.Season, week.WeekNo ), SubHeading = string.Format("last {0} weeks", offset) }; ICalculate ttbCalculator = new DefensiveScoringCalculator( new NFLWeek( week.SeasonNo, week.WeekNo ), offset); FileOut = ttb.RenderTeamToBeat(ttbCalculator); }
private static string WeeklyEspnPerformance( string catCode, int week, string leagueId, [System.Runtime.InteropServices.Optional] string sPos) { var pl = new PlayerLister { WeeksToGoBack = 1 }; var master = new YahooMaster("Yahoo", "YahooOutput.xml"); var currentWeek = new NFLWeek(Int32.Parse(Utility.CurrentSeason()), weekIn: week, loadGames: false); var gs = new EspnScorer(currentWeek) { Master = master }; pl.SetScorer(gs); pl.SetFormat("weekly"); pl.AllWeeks = false; // just the regular saeason pl.Season = currentWeek.Season; pl.RenderToCsv = false; pl.Week = week; pl.Collect(catCode, sPos: sPos, fantasyLeague: leagueId); var targetFile = string.Format("{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0}.htm", currentWeek.WeekNo, sPos, leagueId, pl.Season, Utility.OutputDirectory()); pl.Render(targetFile); return(pl.FileOut); }
public void RenderTeamToDefendAgainst(NFLWeek week) { // Team to beat report showing a jucy opponent for a particular defence var offset = -4; if (week.WeekNo < 2) { // do the whole of last season #if DEBUG Utility.Announce("Looking back at the whole of last season"); #endif offset = -Constants.K_WEEKS_IN_REGULAR_SEASON; } else { #if DEBUG Utility.Announce("Going back 4 games"); #endif } var ttb = new TeamLister { Heading = string.Format("{0}\\defense\\Team To beat-{1:0#}", week.Season, week.WeekNo), SubHeading = string.Format("last {0} weeks", offset) }; ICalculate ttbCalculator = new DefensiveScoringCalculator(new NFLWeek(week.SeasonNo, week.WeekNo), offset); FileOut = ttb.RenderTeamToBeat(ttbCalculator); }
public MetricsUpdateReport( IKeepTheTime timekeeper) { Name = "Metrics Update Report"; Season = timekeeper.CurrentSeason(); Week = new NFLWeek( Season, timekeeper.PreviousWeek()); Scorer = new YahooScorer(Week); Dao = new DbfPlayerGameMetricsDao(); }
public MetricsUpdateReport(IKeepTheTime timekeeper) : base(timekeeper) { Name = "Metrics Update Report"; Season = timekeeper.CurrentSeason(); Week = new NFLWeek(Season, timekeeper.PreviousWeek()); Scorer = new YahooScorer(Week); Dao = new DbfPlayerGameMetricsDao(); }
public void TestPatriotsDefenseCalcs() { var week = new NFLWeek(2010, 17); ICalculate myCalculator = new DefensiveScoringCalculator(week, -1); var team = new NflTeam("NE"); team.CalculateDefensiveScoring(myCalculator, doOpponent: false); Assert.AreEqual(17, myCalculator.Team.FantasyPoints); Assert.AreEqual(1, myCalculator.Team.TotInterceptions); Assert.AreEqual(5, myCalculator.Team.TotSacks); }
public void TestEspnScorer() { var week = new NFLWeek(seasonIn: 2013, weekIn: 3, loadGames: false); var gs = new EspnScorer(week) { Master = new YahooMaster("Yahoo", "YahooOutput.xml") }; var player = new NFLPlayer("VICKMI01"); var pts = gs.RatePlayer(player, week); Assert.AreEqual(11, pts, "Vick got 11 pts in week 3 of 2013"); }
private static void DoRantsReport(PlayerLister pl, NFLWeek theWeek, EspnScorer gs, string leagueId, string rptPos, string cat) { pl.SetScorer(gs); pl.StartersOnly = true; // more thorough to do false pl.SetFormat("weekly"); // as opposed to "annual" totals pl.AllWeeks = false; // just the regular season pl.Season = theWeek.Season; pl.Collect(catCode: cat, sPos: rptPos, fantasyLeague: leagueId); var targetFile = string.Format("{2}{0}//Performance//{3}-Yahoo {1} Performance {0}.htm", pl.Season, rptPos, Utility.OutputDirectory(), leagueId); pl.Render(targetFile); Assert.IsTrue(File.Exists(pl.FileOut), string.Format("Cannot find {0}", pl.FileOut)); }
public void TestEspnPerformanceReportRunningBacksWeek5() { var pr = new PerformanceReport(season: "2012", week: 5); var week = new NFLWeek(seasonIn: 2012, weekIn: 5, loadGames: false); var gs = new EspnScorer(week) { ScoresOnly = true }; pr.Scorer = gs; pr.Render(catCode: "2", sPos: "RB", leagueId: Constants.K_LEAGUE_Yahoo, startersOnly: true); Assert.IsTrue(File.Exists(pr.FileOut), string.Format("Cannot find {0}", pr.FileOut)); }
public void TestGsPerformanceReportRunningBacksWeek12() { var pr = new PerformanceReport(season: "2012", week: 12); var week = new NFLWeek(seasonIn: 2012, weekIn: 12, loadGames: false); var gs = new GS4Scorer(week) { ScoresOnly = true, Master = new GridStatsMaster("GridStats", "GridStats.xml") }; pr.Scorer = gs; pr.Render(catCode: "2", sPos: "RB", leagueId: Constants.K_LEAGUE_Gridstats_NFL1, startersOnly: true); Assert.IsTrue(File.Exists(pr.FileOut), string.Format("Cannot find {0}", pr.FileOut)); }
public void TestWeeklyProjection() { var w = new NFLWeek("2013", Utility.CurrentWeek()); // looking forward var sut = new PlayerProjectionGenerator(); var nGames = 0; for (int i = 0; i < w.GameList().Count; i++) { var game = (NFLGame)w.GameList()[i]; sut.Execute(game); nGames++; } Assert.AreEqual(16, nGames); }
public void TestRantsPerformanceUptoCurrent() { var pl = new PlayerLister(); var theWeek = new NFLWeek(seasonIn: 2013, weekIn: System.Int32.Parse(Utility.CurrentWeek()), loadGames: false); var gs = new EspnScorer(theWeek); var leagueId = Constants.K_LEAGUE_Rants_n_Raves; DoRantsReport(pl, theWeek, gs, leagueId, "QB", Constants.K_QUARTERBACK_CAT); DoRantsReport(pl, theWeek, gs, leagueId, "RB", Constants.K_RUNNINGBACK_CAT); DoRantsReport(pl, theWeek, gs, leagueId, "WR", Constants.K_RECEIVER_CAT); DoRantsReport(pl, theWeek, gs, leagueId, "TE", Constants.K_RECEIVER_CAT); DoRantsReport(pl, theWeek, gs, leagueId, "PK", Constants.K_KICKER_CAT); }
public void RenderDefensiveScoringReport( NFLWeek week ) { var offset = -6; if ( week.WeekNo < 2 ) // do the whole of last season offset = - Constants.K_WEEKS_IN_REGULAR_SEASON; var tl = new TeamLister { Heading = string.Format("{0}\\defense\\Defensive Scoring-{1:0#}", week.Season, week.WeekNo ), SubHeading = string.Format( "last {0} weeks", offset ) }; ICalculate myCalculator = new DefensiveScoringCalculator( week, offset ); FileOut = tl.RenderTeams(myCalculator); }
public override decimal GetStat( NFLWeek week ) { decimal stat = 0.0M; // important stat is sacks made // determine which game NFLGame game = week.GameFor( Team.TeamCode ); if ( game != null ) { // get sacks stat = Utility.TflWs.GetTotStats( Team.TeamCode, RosterLib.Constants.K_QUARTERBACK_SACKS, week.Season, week.ZeroWeek(), game.GameCode ); } else stat = -1.0M; return stat; }
public override decimal GetStat( NFLWeek week ) { int stat = 0; // important stat is Tdp // determine which game NFLGame game = week.GameFor( Team.TeamCode ); if ( game != null ) { // get Tdp stat = Utility.TflWs.GetTotTeamScoresFor( RosterLib.Constants.K_SCORE_TD_PASS, Team.TeamCode, week.Season, week.ZeroWeek(), game.GameCode ); } else stat = -1; return stat; }
public override decimal GetStat(NFLWeek week) { decimal stat = 0.0M; // important stat is sacks made // determine which game NFLGame game = week.GameFor(Team.TeamCode); if (game != null) { // get sacks stat = Utility.TflWs.GetTotStats(Team.TeamCode, RosterLib.Constants.K_QUARTERBACK_SACKS, week.Season, week.ZeroWeek(), game.GameCode); } else { stat = -1.0M; } return(stat); }
public NFLPlayer TopDog(NflTeam team, string theWeek, DataSet gameDs) { var game = new NFLGame(gameDs.Tables[0].Rows[0]); var week = new NFLWeek(Season, theWeek); var scorer = new YahooXmlScorer(week); List <NFLPlayer> playerList = new List <NFLPlayer>(); if (game.IsAway(team.TeamCode)) { playerList = game.LoadAllFantasyAwayPlayers(null, PositionCategory); } else { playerList = game.LoadAllFantasyHomePlayers(null, PositionCategory); } NFLPlayer topDog = new NFLPlayer() { Points = 0 }; foreach (var p in playerList) { if (PositionAbbr == "TE") { if (!p.IsTe()) { continue; } } if (PositionAbbr == "QB") { if (!p.IsQb()) { continue; } } p.Points = scorer.RatePlayer(p, week); if (p.Points > topDog.Points) { topDog = p; } } return(topDog); }
public void RenderDefensiveScoringReport(NFLWeek week) { var offset = -4; if (week.WeekNo < 2) { // do the whole of last season offset = -Constants.K_WEEKS_IN_REGULAR_SEASON; } var tl = new TeamLister { Heading = string.Format("{0}\\defense\\Defensive Scoring-{1:0#}", week.Season, week.WeekNo), SubHeading = string.Format("last {0} weeks", offset) }; ICalculate myCalculator = new DefensiveScoringCalculator(week, offset); FileOut = tl.RenderTeams(myCalculator); }
public override decimal GetStat( NFLWeek week ) { int stat = 0; // important stat is FG // determine which game NFLGame game = week.GameFor( Team.TeamCode ); if ( game != null ) { // get FG allowed NflTeam opp = game.OpponentTeam( Team.TeamCode ); stat = Utility.TflWs.GetTotTeamScoresFor( RosterLib.Constants.K_SCORE_FIELD_GOAL, opp.TeamCode, week.Season, week.ZeroWeek(), game.GameCode ); } else stat = -1; return stat; }
private NFLPlayerPicksRecord CreatePlayerPicksRecord(AspNetUser player, NFLWeek week, IEnumerable <NFLPickRecord> records, int numberOfGames) { var nflPlayerRecord = new NFLPlayerPicksRecord(); nflPlayerRecord.Player.LastName = player.LastName; nflPlayerRecord.Player.FirstName = player.FirstName; nflPlayerRecord.Player.NickName = player.NickName; nflPlayerRecord.NFLWeekId = week.NFLWeekId; nflPlayerRecord.WinsCount = 0; nflPlayerRecord.LosesCount = numberOfGames; foreach (var record in records.Where(r => r.NFLWeekId == week.NFLWeekId && r.UserId == player.Id)) { nflPlayerRecord.WinsCount = record.Wins; nflPlayerRecord.LosesCount = numberOfGames - record.Wins; } return(nflPlayerRecord); }
public void TestYahooPerformanceUptoCurrent() { var pl = new PlayerLister(); var theWeek = new NFLWeek(seasonIn: 2013, weekIn: System.Int32.Parse(Utility.CurrentWeek()), loadGames: false); var gs = new EspnScorer(theWeek); var leagueId = Constants.K_LEAGUE_Yahoo; var rptPos = "RB"; pl.SetScorer(gs); pl.StartersOnly = true; // more thorough to do false pl.SetFormat("weekly"); // as opposed to "annual" totals pl.AllWeeks = false; // just the regular season pl.Season = theWeek.Season; pl.Collect(catCode: Constants.K_RUNNINGBACK_CAT, sPos: rptPos, fantasyLeague: leagueId); var targetFile = string.Format("{2}{0}//Performance//Yahoo {1} Performance {0}-{3}.htm", pl.Season, rptPos, Utility.OutputDirectory(), leagueId); pl.Render(targetFile); Assert.IsTrue(File.Exists(pl.FileOut), string.Format("Cannot find {0}", pl.FileOut)); }
public override decimal GetStat(NFLWeek week) { int stat = 0; // important stat is Tdp // determine which game NFLGame game = week.GameFor(Team.TeamCode); if (game != null) { // get Tdp stat = Utility.TflWs.GetTotTeamScoresFor(RosterLib.Constants.K_SCORE_TD_PASS, Team.TeamCode, week.Season, week.ZeroWeek(), game.GameCode); } else { stat = -1; } return(stat); }
public IEnumerable <Winner> GetWinners() { var week = new NFLWeek(Season, Week); var winners = new List <Winner>(); foreach (NFLGame g in week.GameList()) { g.CalculateSpreadResult(); var teamCode = g.BookieTip.WinningTeam(); var winner = new Winner { Team = g.Team(teamCode), Margin = Math.Abs(g.Spread), Home = g.IsHome(teamCode), Game = g }; winners.Add(winner); } return(winners); }
public override decimal GetStat(NFLWeek week) { int stat = 0; // important stat is FG // determine which game NFLGame game = week.GameFor(Team.TeamCode); if (game != null) { // get FG allowed NflTeam opp = game.OpponentTeam(Team.TeamCode); stat = Utility.TflWs.GetTotTeamScoresFor(RosterLib.Constants.K_SCORE_FIELD_GOAL, opp.TeamCode, week.Season, week.ZeroWeek(), game.GameCode); } else { stat = -1; } return(stat); }
public IList <Loser> GetLosers() { var week = new NFLWeek(Season, Week); var losers = new List <Loser>(); foreach (NFLGame g in week.GameList()) { g.CalculateSpreadResult(); var teamCode = g.BookieTip.LosingTeam(); var loser = new Loser { PointsFor = g.BookieTip.LosingScore(), Team = g.Team(teamCode), Margin = Math.Abs(g.Spread), Home = g.IsHome(teamCode), Game = g }; losers.Add(loser); } return(losers); }
public NFLUKTeamScorer() { Name = "NflUk.com Scorer"; Week = new NFLWeek(Utility.CurrentWeek(), Utility.CurrentSeason()); }
private IEnumerable<Winner> GetWinners() { var week = new NFLWeek( Season, Week ); var winners = new List<Winner>(); foreach ( NFLGame g in week.GameList() ) { g.CalculateSpreadResult(); var teamCode = g.BookieTip.WinningTeam(); var winner = new Winner { Team = g.Team( teamCode ), Margin = Math.Abs( g.Spread ), Home = g.IsHome( teamCode ), Game = g }; winners.Add( winner ); } return winners; }
public TeamMetricsUpdateReport(IKeepTheTime timekeeper) : base(timekeeper) { Name = "Team Metrics Update Report"; Season = timekeeper.CurrentSeason(); Week = new NFLWeek(Season, timekeeper.PreviousWeek()); }
public void RenderDefensiveReports(NFLWeek week) { RenderDefensiveScoringReport(week); RenderTeamToDefendAgainst(week); }
public TeamMetricsUpdateReport( IKeepTheTime timekeeper ) { Name = "Team Metrics Update Report"; Season = timekeeper.CurrentSeason(); Week = new NFLWeek( Season, timekeeper.PreviousWeek() ); }
public void RenderDefensiveReports( NFLWeek week ) { RenderDefensiveScoringReport( week ); RenderTeamToDefendAgainst( week ); }