Exemple #1
0
        private string RenderKicker()
        {
            var om = new NFLOutputMetric("Fg", _kicker, this);
             if (GameList != null)
             {
            //  load the projections
            for (int i = 0; i < GameList.Count; i++)
            {
               NFLGame game = (NFLGame)GameList[i];
               int nFg = TeamCode == game.HomeTeam ? game.ProjectedHomeFg : game.ProjectedAwayFg;
               om.AddWeeklyOutput(Int32.Parse(game.Week), nFg, game.Opponent(TeamCode), game.IsHome(TeamCode));
            }
            //  load the last season
            if (_fgResultList != null)
            {
               for (int j = 0; j < _fgResultList.Count; j++)
               {
                  FieldGoalResult fgr = (FieldGoalResult)_fgResultList[j];
                  if (fgr.IsLastYear())
                     om.AddPrevWeeklyOutput(Int32.Parse(fgr.Week()), fgr.So);
               }
            }
             }

             if (ProjectionList == null) ProjectionList = new ArrayList();

             ProjectionList.Add(om);

             return om.RenderAsHtml();
        }
Exemple #2
0
        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();
        }