コード例 #1
0
        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";
        }
コード例 #2
0
        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)));
        }
コード例 #3
0
        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());
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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());
        }
コード例 #6
0
ファイル: NFLTeam.cs プロジェクト: Quarterback16/GerardGui
        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();
        }
コード例 #7
0
 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();
 }
コード例 #8
0
 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";
 }
コード例 #9
0
 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;
 }