private void Predictions(IPrognosticate predictor, ref string s) { #if DEBUG Utility.Announce("Doing predictions"); #endif s += Prediction(_game.HomeNflTeam, predictor) + "<br>\n\n"; s += Prediction(_game.AwayNflTeam, predictor) + "<br>\n\n"; }
public string SeasonProjection(string metricName, IPrognosticate predictor, DateTime projectionDate) { // Start off with the division name var s = HtmlLib.TableRowOpen("BGCOLOR='LIGHTGREY'") + HtmlLib.TableDataAttr(HtmlLib.Font("VERDANA", NameOut(), "-1"), "ALIGN='CENTER' COLSPAN='19'") + HtmlLib.TableRowClose() + "\n"; return(TeamList.Cast <NflTeam>() .Aggregate(s, (current, t) => current + t.SeasonProjection(predictor, metricName, projectionDate))); }
public string SeasonProjection(string metricName, IPrognosticate predictor, DateTime projectionDate) { // for each division, render projections var sb = new StringBuilder(); foreach (NFLDivision d in DivList) { sb.Append(d.SeasonProjection(metricName, predictor, projectionDate)); } return(sb.ToString()); }
private static string Prediction(NflTeam team, IPrognosticate predictor) { var predictionStr = String.Empty; if (team != null) { predictionStr = HtmlLib.TableOpen("BORDER='1' CELLSPACING='0' CELLPADDING='0'") + HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr(team.Name, "COLSPAN='19'") + HtmlLib.TableRowClose() + team.SeasonProjection(predictor, "Spread", DateTime.Now); } return(predictionStr); }
public string SeasonProjection( string metricName, IPrognosticate predictor, DateTime projectionDate) { // for each division, render projections var sb = new StringBuilder(); foreach (NFLDivision d in DivList) { #if QUICKRUN if (!d.Name.Equals("West")) { continue; } #endif sb.Append( d.SeasonProjection( metricName, predictor, projectionDate)); } return(sb.ToString()); }
public string SeasonProjection(IPrognosticate strategy, string metricName, DateTime projectionDate) { if (strategy == null) return String.Empty; strategy.AuditTrail = true; NFLResult result; NFLGame game; int metric; // Lazy intitialisation of the sched if (_sched == null) InitialiseProjections(); var om = new NFLOutputMetric(metricName, null, this); // Go through the schedule and predict the games // Clear win totals var projWins = 0; var projLosses = 0; var projTies = 0; if ((_sched != null) && (_sched.GameList != null)) { // load the projections for (var i = 0; i < _sched.GameList.Count; i++) { if (i > 15) continue; game = (NFLGame)_sched.GameList[i]; result = strategy.PredictGame(game, new DbfPredictionStorer(), projectionDate); #if DEBUG Utility.Announce(result.LogResult()); #endif metric = metricName == "Spread" ? Convert.ToInt32(((game.IsHome(TeamCode)) ? result.Spread : 0.0M-(result.Spread))) : (metricName == "Tdp" ? ((game.IsHome(TeamCode)) ? result.HomeTDp : result.AwayTDp) : ((game.IsHome(TeamCode)) ? result.HomeTDr : result.AwayTDr)); if (metric > 0) projWins++; if (metric == 0) projTies++; if (metric < 0) projLosses++; om.AddWeeklyOutput( Int32.Parse(game.Week), metric, game.Opponent(TeamCode), game.IsHome(TeamCode)); } } if (metricName == "Spread") { // Load up previous results if (_prevSched.GameList != null) { foreach (NFLGame g in _prevSched.GameList) { if (Int32.Parse(g.Week) < 18) { result = g.Result; metric = Convert.ToInt32((g.IsHome(TeamCode)) ? result.Spread : 0.0M-(result.Spread)); ApplyPrevResult(metric); var so = new SeasonOpposition(g.Opponent(TeamCode), g.IsHome(TeamCode), metric); om.AddPrevWeeklyOutput(Int32.Parse(g.Week), so); } } } } if (ProjectionList == null) ProjectionList = new ArrayList(); ProjectionList.Add(om); // store it for later Wins = projWins; Losses = projLosses; Ties = projTies; return om.RenderAsHtml(); }
public string SeasonProjection(string metricName, IPrognosticate predictor, DateTime projectionDate ) { // for each division, render projections var sb = new StringBuilder(); foreach ( NFLDivision d in DivList ) sb.Append( d.SeasonProjection( metricName, predictor, projectionDate ) ); return sb.ToString(); }
private void Predictions( IPrognosticate predictor, ref string s) { #if DEBUG Utility.Announce( "Doing predictions"); #endif s += Prediction( _game.HomeNflTeam, predictor ) + "<br>\n\n"; s += Prediction( _game.AwayNflTeam, predictor ) + "<br>\n\n"; }
private static string Prediction( NflTeam team, IPrognosticate predictor ) { var predictionStr = String.Empty; if ( team != null ) predictionStr = HtmlLib.TableOpen( "BORDER='1' CELLSPACING='0' CELLPADDING='0'" ) + HtmlLib.TableRowOpen() + HtmlLib.TableDataAttr( team.Name, "COLSPAN='19'" ) + HtmlLib.TableRowClose() + team.SeasonProjection( predictor, "Spread", DateTime.Now ); return predictionStr; }