public override void RenderAsHtml() { LeagueInFocus = LeagueToFocusOn(); if (TimeKeeper.CurrentWeek(DateTime.Now) > 16) { LeagueInFocus = Constants.K_LEAGUE_Gridstats_NFL1; } var totalPlayers = 0; var season = new NflSeason( Season, teamsOnly: true); foreach (var team in season.TeamList) { TeamCode = team.TeamCode; Execute(); totalPlayers += PlayerCount; #if DEBUG2 break; #endif } DumpErrors(); TraceIt($" {TeamCode} Player Count : {totalPlayers}"); }
public override void RenderAsHtml( bool structOnly = false) { StructOnly = structOnly; NflSeason = new NflSeason( TimeKeeper.CurrentSeason(), loadGames: true, loadDivisions: false); foreach (var game in NflSeason.GameList) { if (game.Played()) { continue; } if (StructOnly) { Console.WriteLine( $"WriteProjection for {game.GameName()}"); } else { TraceIt($"Writing projections for {game}"); game.WriteProjection(); } // if ( game.WeekNo > 1 ) break // short curcuit } }
public ScoreTally(string season, string scope, bool usingPredictions) { Season = new NflSeason(season, loadGames: false, loadDivisions: false); Season.LoadRegularWeeks(); ScopeInFocus = scope; UsingPredictions = usingPredictions; ForceRefresh = false; }
void PutSeason(NflSeason s) { if (!TheHt.ContainsKey(s.Year)) { TheHt.Add(s.Year, s); IsDirty = true; } }
void WriteSeasonNode(XmlTextWriter writer, NflSeason s) { writer.WriteStartElement("season"); WriteElement(writer, "year", s.Year); WriteElement(writer, "weeks", s.Weeks.ToString()); WriteTeamList(writer, s); writer.WriteEndElement(); }
public GordanRanks(string season) { // set up data s = Masters.Sm.GetSeason(season); DefineData(); LoadData(); Render(); }
public void Calculate(string season) { var theSeason = new NflSeason(season); theSeason.LoadRegularWeeksToDate(); foreach (var week in theSeason.RegularWeeks) { Calculate(theSeason.Year, week.Week); } }
private static void WriteConferenceList(XmlWriter writer, NflSeason s) { writer.WriteStartElement("conferences"); // Division List foreach (var c in s.ConferenceList) { WriteConferenceNode(writer, c); } writer.WriteEndElement(); }
public void Calculate(string season) { var theSeason = new NflSeason(season); theSeason.LoadRegularWeeksToDate(); foreach (var week in theSeason.RegularWeeks) { Announce($"YahooMaster:Calculate Season {season} Week {week.WeekNo}"); Calculate(theSeason.Year, week.Week); } }
public void DumpSeasons() { IDictionaryEnumerator myEnumerator = TheHt.GetEnumerator(); while (myEnumerator.MoveNext()) { NflSeason s = (NflSeason)myEnumerator.Value; RosterLib.Utility.Announce(string.Format("Season {0}:- ", myEnumerator.Key)); s.DumpTeams(); } }
public void Render(string season) { SeasonMaster = SetSeasonMaster(season); foreach (string teamKey in SeasonMaster.TeamKeyList) { TeamUnits(season, teamKey); #if DEBUG2 break; #endif } }
void WriteTeamList(XmlTextWriter writer, NflSeason s) { writer.WriteStartElement("team-list"); foreach (string teamKey in s.TeamKeyList) { writer.WriteStartElement("team"); writer.WriteAttributeString("key", teamKey); WriteRatings(writer, teamKey); writer.WriteEndElement(); } writer.WriteEndElement(); }
public void Calculate(string season) { var theSeason = new NflSeason(season); theSeason.LoadRegularWeeksToDate(); foreach (var week in theSeason.RegularWeeks) { Announce(string.Format("YahooMaster:Calculate Season {0} Week {1}", season, week.WeekNo)); Calculate(theSeason.Year, week.Week); } }
private static void WriteSeasonNode(XmlWriter writer, NflSeason s) { writer.WriteStartElement("season"); WriteElement(writer, "year", s.Year); WriteElement(writer, "weeks", s.Weeks.ToString()); WriteConferenceList(writer, s); WriteTeamList(writer, s); writer.WriteEndElement(); }
public void Calculate(string season) { var theSeason = new NflSeason(season); theSeason.LoadRegularWeeksToDate(); foreach (var week in theSeason.RegularWeeks) { var theWeek = string.Format("{0:0#}", week.WeekNo); Utility.Announce(string.Format("Doing week {0} of {1}", week.WeekNo, season)); Calculate(theSeason.Year, theWeek); } }
public void SaveTipsFor(string season) { var theSeason = new NflSeason(season); foreach (var game in theSeason.GameList) { if (game.Spread > 0) { game.CalculateSpreadResult(); Storer.StorePrediction("bookie", game, game.BookieTip); } } }
public void Calculate(string season, string week) { if (week.Equals("01")) { SetupSeason(season); Dump2Xml(); return; } var hp = new HillinPredictor(); var theSeason = new NflSeason(season); foreach (var team in theSeason.TeamList) { // get teams game for the week Utility.Announce(string.Format(" Doing {0}", team.TeamCode)); var upcomingWeek = new NFLWeek(season, week); var previousWeek = upcomingWeek.PreviousWeek(upcomingWeek, loadgames: false, regularSeasonGamesOnly: true); var prevWeek = string.Format("{0:0#}", previousWeek.WeekNo); var oldPowerRating = team.GetPowerRating(prevWeek); if (oldPowerRating == 0) { return; } var newRating = new HillenPowerRating { Season = season, TeamCode = team.TeamCode, Week = week, Quantity = oldPowerRating }; var game = Utility.GetGameFor(season, prevWeek, team.TeamCode); if (game.GameDate != new DateTime(1, 1, 1)) { var predictedResult = hp.PredictGame(game, null, game.GameDate); var predictedMarginForTeam = predictedResult.MarginForTeam(team.TeamCode); //Utility.Announce( string.Format( "Predicted Margin for {0} is {1}", TeamCode, predictedMarginForTeam ) ); var actualMarginForTeam = game.Result.MarginForTeam(team.TeamCode); //Utility.Announce( string.Format( " Result of {2} means Actual Margin for {0} is {1}", var newPowerRating = AdjustedPower(oldPowerRating, predictedMarginForTeam, actualMarginForTeam); newRating.Quantity = newPowerRating; } PutRating(newRating); } Dump2Xml(); }
private static void WriteTeamList(XmlWriter writer, NflSeason s) { writer.WriteStartElement("team-list"); foreach (var t in s.TeamList) { writer.WriteStartElement("team"); WriteElement(writer, "id", t.TeamCode); WriteElement(writer, "name", t.Name); WriteElement(writer, "division", t.Division()); writer.WriteEndElement(); } writer.WriteEndElement(); }
public override void RenderAsHtml() { NflSeason = new NflSeason( TimeKeeper.CurrentSeason(), loadGames: true, loadDivisions: false); foreach (var game in NflSeason.GameList) { game.WriteProjection(); #if DEBUG if (game.WeekNo > 1) { break; } #endif } }
public NflSeason GetSeason(string season, bool teamsOnly) { NflSeason s; if (TheHt.ContainsKey(season)) { s = (NflSeason)TheHt[season]; CacheHits++; } else { // new it up s = new NflSeason(season, teamsOnly); PutSeason(s); CacheMisses++; } return(s); }
public void TipSeason(string season) { // load a season var nflSeason = new NflSeason(season); var predictionStorer = new DbfPredictionStorer(); var mp = new MillerPredictor { AuditTrail = true }; // for each game foreach (NFLGame game in nflSeason.GameList) { if (!game.IsPlayoff()) { // predict game var result = mp.PredictGame(game, predictionStorer, game.GameDate); } } }
/// <summary> /// Converts the memory hash table to XML /// </summary> public void Dump2Xml() { if ((TheHt.Count > 0) && IsDirty) { XmlTextWriter writer = new XmlTextWriter(string.Format("{0}{1}", Utility.OutputDirectory(), Filename), null); writer.WriteStartDocument(); writer.WriteComment("Comments: " + Name); writer.WriteStartElement("season-list"); IDictionaryEnumerator myEnumerator = TheHt.GetEnumerator(); while (myEnumerator.MoveNext()) { NflSeason s = (NflSeason)myEnumerator.Value; WriteSeasonNode(writer, s); } writer.WriteEndElement(); writer.WriteEndDocument(); writer.Close(); RosterLib.Utility.Announce(string.Format("{0}{1} created.", Utility.OutputDirectory(), Filename)); } }
public void Render() { NflSeason = new NflSeason(Year, loadGames: false, loadDivisions: false); NflSeason.LoadRegularWeeks(); var str = new SimpleTableReport(string.Format("Score Grid {0}-{1}", NflSeason.Year, ScopeInFocus)) { ReportHeader = ScopeInFocus }; StyleHelper.AddStyle(str); str.ColumnHeadings = true; str.DoRowNumbers = false; str.ShowElapsedTime = false; str.IsFooter = false; str.AddColumn(new ReportColumn("Stat", "STAT", "{0}")); str.AddColumn(new ReportColumn("Total", "TOT", "{0}")); str.AddColumn(new ReportColumn("Wk01", "WK01", "{0}")); str.AddColumn(new ReportColumn("Wk02", "WK02", "{0}")); str.AddColumn(new ReportColumn("Wk03", "WK03", "{0}")); str.AddColumn(new ReportColumn("Wk04", "WK04", "{0}")); str.AddColumn(new ReportColumn("Wk05", "WK05", "{0}")); str.AddColumn(new ReportColumn("Wk06", "WK06", "{0}")); str.AddColumn(new ReportColumn("Wk07", "WK07", "{0}")); str.AddColumn(new ReportColumn("Wk08", "WK08", "{0}")); str.AddColumn(new ReportColumn("Wk09", "WK09", "{0}")); str.AddColumn(new ReportColumn("Wk10", "WK10", "{0}")); str.AddColumn(new ReportColumn("Wk11", "WK11", "{0}")); str.AddColumn(new ReportColumn("Wk12", "WK12", "{0}")); str.AddColumn(new ReportColumn("Wk13", "WK13", "{0}")); str.AddColumn(new ReportColumn("Wk14", "WK14", "{0}")); str.AddColumn(new ReportColumn("Wk15", "WK15", "{0}")); str.AddColumn(new ReportColumn("Wk16", "WK16", "{0}")); str.AddColumn(new ReportColumn("Wk17", "WK17", "{0}")); str.LoadBody(BuildTable()); //str.SubHeader = SubHeading(); str.RenderAsHtml(FileName(), true); }
public StatGrid(string season, string statType) { Season = new NflSeason(season); StatInFocus = statType; StatMaster = new StatMaster("Stats", "stats.xml"); }
public StatGrid(NflSeason season, string statType, StatMaster statMaster) { Season = season; StatInFocus = statType; StatMaster = statMaster; }
public override void RenderAsHtml() { var aceRepository = new AceRepository(); var teamLines = new List <String>(); var week = Utility.PreviousWeekAsString(); Logger.Trace($"Analysing roles from week {week}"); List <NflTeam> teamList; if (string.IsNullOrEmpty(SingleTeam)) { var s = new NflSeason(Season, true); teamList = s.TeamList; } else { teamList = new List <NflTeam> { new NflTeam(SingleTeam) } }; foreach (var t in teamList) { teamLines.Clear(); teamLines.Add("------------------------------------------------------------"); teamLines.Add(t.NameOut()); teamLines.Add("------------------------------------------------------------"); RunningUnit(aceRepository, teamLines, week, t); t.LoadPassUnit(); teamLines.Add("Quarterbacks" + Environment.NewLine); teamLines.AddRange(t.PassUnit.AnalyseQuarterbacks(Season, week)); teamLines.Add(Environment.NewLine); teamLines.Add("Wideouts" + Environment.NewLine); teamLines.AddRange(t.PassUnit.AnalyseWideouts(Season, week)); teamLines.Add(Environment.NewLine); if (t.PassUnit.IsAceReceiver && t.PassUnit.AceReceiver.TotStats.Touches > 5) { AddAceLine(t.PassUnit.AceReceiver, aceRepository); } teamLines.Add("Tight Ends" + Environment.NewLine); teamLines.AddRange(t.PassUnit.AnalyseTightends(Season, week)); teamLines.Add(Environment.NewLine); if (t.PassUnit.IsAceTightEnd && t.PassUnit.AceTightEnd.TotStats.Touches > 5) { AddAceLine(t.PassUnit.AceTightEnd, aceRepository); } Lines.AddRange(teamLines); DumpTeam(teamLines, week, t); #if DEBUG2 break; #endif } DumpLines(week); Finish(); DumpAces(week); }
public HillenTips(string season, string week) { Season = new NflSeason(season); Week = new NFLWeek(season, week); HillenPredictor = new HillinPredictor(); }
void AddSeason(NflSeason s) { TheHt.Add(s.Year, s); }
public NibbleRanker() { _mSeason = new NflSeason(Utility.CurrentSeason()); LoadRates(); }
public NibbleRanker(string season) { _mSeason = Masters.Sm.GetSeason(season); }