Пример #1
0
        public Int32 PredictTDr(NFLPlayer plyr, string season, int week)
        {
            //  Predict the number of FGs this player will kick
             int tDr = 0;
             //  starters only
             if (plyr.IsStarter() && (plyr.PlayerCat == RosterLib.Constants.K_RUNNINGBACK_CAT) && plyr.IsRusher() )
             {
            if (plyr.CurrTeam.Ratings.Equals("CCCCCC")) plyr.CurrTeam.SetRecord(season, skipPostseason:false);

            //  who are the opponents
            NflTeam opponent = plyr.CurrTeam.OpponentFor(season, week);
            if (opponent != null)
            {
               if (opponent.Ratings.Equals("CCCCCC")) opponent.SetRecord(season, skipPostseason: false);  // Incase not initialised
               //  not on a bye
               tDr = 1;
               int diff = ConvertRating(plyr.CurrTeam.RoRating()) - ConvertRating(opponent.RdRating());
               if (diff > 1) tDr += 1;
               if (diff > 3) tDr += 1;
               if (diff < -1) tDr -= 1;
            }

            //  What is the Game
            NFLGame game = plyr.CurrTeam.GameFor(season, week);
            if (game != null)
            {
               if (game.IsHome(plyr.CurrTeam.TeamCode)) tDr += 1;
               if (game.IsBadWeather()) tDr -= 1;
            }

             }
             return tDr;
        }
Пример #2
0
        public Int32 PredictYDr(NFLPlayer plyr, string season, int week)
        {
            int YDr = 0;
             //  starters only
             if (plyr.IsStarter() && (plyr.PlayerCat == RosterLib.Constants.K_RUNNINGBACK_CAT) && plyr.IsRusher())
             {
            int gamesOppPlayed = 0;
            NflTeam opponent = plyr.CurrTeam.OpponentFor(season, week);
            if (opponent != null)  //  not on a bye
            {
               //  Workout Team YDr average
               int teamTotYDr = 0;
               int gamesPlayed = 0;
               plyr.CurrTeam.LoadGames(plyr.CurrTeam.TeamCode, season);
               foreach (NFLGame g in plyr.CurrTeam.GameList)
               {
                  if (g.Played())
                  {
                     g.TallyMetrics("Y");
                     teamTotYDr += g.IsHome(plyr.CurrTeam.TeamCode) ? g.HomeYDr : g.AwayYDr;
                     gamesPlayed++;
                  }
               }

               //  work out the average that the oppenent gives up
               int teamTotYDrAllowed = 0;

               opponent.LoadGames(opponent.TeamCode, season);
               foreach (NFLGame g in opponent.GameList)
               {
                  if (g.Played())
                  {
                     g.TallyMetrics("Y");
                     teamTotYDrAllowed += g.IsHome(plyr.CurrTeam.TeamCode) ? g.AwayYDr : g.HomeYDr;  //  switch it around
                     gamesOppPlayed++;
                  }
               }

               Decimal predictedYDr;
               if ((gamesPlayed > 0) && (gamesOppPlayed > 0))
               {
                  //  Average the averages

                  predictedYDr = ((teamTotYDr / gamesPlayed) +
                                           (teamTotYDrAllowed / gamesOppPlayed)) / 2;
               }
               else
                  predictedYDr = 0.0M;

               //  find out how many carries the starter usually has
               //  YDr is the proportion of the whole
               YDr = Convert.ToInt32(predictedYDr * .8M);
            }
             }
             return YDr;
        }
Пример #3
0
        public Int32 PredictYDr(NFLPlayer plyr, string season, int week)
        {
            int YDr = 0;

            //  starters only
            if (plyr.IsStarter() && (plyr.PlayerCat == RosterLib.Constants.K_RUNNINGBACK_CAT) && plyr.IsRusher())
            {
                int     gamesOppPlayed = 0;
                NflTeam opponent       = plyr.CurrTeam.OpponentFor(season, week);
                if (opponent != null) //  not on a bye
                {
                    //  Workout Team YDr average
                    int teamTotYDr  = 0;
                    int gamesPlayed = 0;
                    plyr.CurrTeam.LoadGames(plyr.CurrTeam.TeamCode, season);
                    foreach (NFLGame g in plyr.CurrTeam.GameList)
                    {
                        if (g.Played())
                        {
                            g.TallyMetrics("Y");
                            teamTotYDr += g.IsHome(plyr.CurrTeam.TeamCode) ? g.HomeYDr : g.AwayYDr;
                            gamesPlayed++;
                        }
                    }

                    //  work out the average that the oppenent gives up
                    int teamTotYDrAllowed = 0;

                    opponent.LoadGames(opponent.TeamCode, season);
                    foreach (NFLGame g in opponent.GameList)
                    {
                        if (g.Played())
                        {
                            g.TallyMetrics("Y");
                            teamTotYDrAllowed += g.IsHome(plyr.CurrTeam.TeamCode) ? g.AwayYDr : g.HomeYDr; //  switch it around
                            gamesOppPlayed++;
                        }
                    }

                    Decimal predictedYDr;
                    if ((gamesPlayed > 0) && (gamesOppPlayed > 0))
                    {
                        //  Average the averages

                        predictedYDr = ((teamTotYDr / gamesPlayed) +
                                        (teamTotYDrAllowed / gamesOppPlayed)) / 2;
                    }
                    else
                    {
                        predictedYDr = 0.0M;
                    }

                    //  find out how many carries the starter usually has
                    //  YDr is the proportion of the whole
                    YDr = Convert.ToInt32(predictedYDr * .8M);
                }
            }
            return(YDr);
        }
Пример #4
0
        public Int32 PredictTDr(NFLPlayer plyr, string season, int week)
        {
            //  Predict the number of FGs this player will kick
            int tDr = 0;

            //  starters only
            if (plyr.IsStarter() && (plyr.PlayerCat == RosterLib.Constants.K_RUNNINGBACK_CAT) && plyr.IsRusher())
            {
                if (plyr.CurrTeam.Ratings.Equals("CCCCCC"))
                {
                    plyr.CurrTeam.SetRecord(season, skipPostseason: false);
                }

                //  who are the opponents
                NflTeam opponent = plyr.CurrTeam.OpponentFor(season, week);
                if (opponent != null)
                {
                    if (opponent.Ratings.Equals("CCCCCC"))
                    {
                        opponent.SetRecord(season, skipPostseason: false);                                // Incase not initialised
                    }
                    //  not on a bye
                    tDr = 1;
                    int diff = ConvertRating(plyr.CurrTeam.RoRating()) - ConvertRating(opponent.RdRating());
                    if (diff > 1)
                    {
                        tDr += 1;
                    }
                    if (diff > 3)
                    {
                        tDr += 1;
                    }
                    if (diff < -1)
                    {
                        tDr -= 1;
                    }
                }

                //  What is the Game
                NFLGame game = plyr.CurrTeam.GameFor(season, week);
                if (game != null)
                {
                    if (game.IsHome(plyr.CurrTeam.TeamCode))
                    {
                        tDr += 1;
                    }
                    if (game.IsBadWeather())
                    {
                        tDr -= 1;
                    }
                }
            }
            return(tDr);
        }