コード例 #1
0
        public int PredictSteals(NflTeam team, string season, int week)
        {
            //  Predict the number of Interceptions the team will make
            int ints = 0;
            //  who are the opponents
            NflTeam opponent = team.OpponentFor(season, week);

            if (opponent != null)
            {
                //  not on a bye
                int pdInts = ConvertRating(team.PrRating());
                int poInts = ConvertRating(opponent.PpRating());
                ints += (pdInts - poInts) - 1; //  will range from 3 to -5
            }

            //  What is the Game
            NFLGame game = team.GameFor(season, week);

            if (game != null)
            {
                if (game.IsHome(team.TeamCode))
                {
                    ints += 1;
                }
            }


            if (ints < 0)
            {
                ints = 0;
            }

            return(ints);
        }
コード例 #2
0
        public Int32 PredictSacks(
            NflTeam team,
            string season,
            int week)
        {
            //  Predict the number of Sacks the team will make
            int sacks = 0;
            //  who are the opponents
            NflTeam opponent = team.OpponentFor(
                season,
                week);

            if (opponent != null)
            {
                //  not on a bye
                sacks += 1;
                int prSacks = ConvertRating(team.PrRating());
                int ppSacks = ConvertRating(opponent.PpRating());
                sacks += (prSacks - ppSacks);
            }

            //  What is the Game
            NFLGame game = team.GameFor(season, week);

            if (game != null)
            {
                if (game.IsHome(team.TeamCode))
                {
                    sacks += 1;
                }
                if (game.IsBadWeather())
                {
                    sacks += 1;
                }
            }

            if (sacks < 0)
            {
                sacks = 0;
            }

            return(sacks);
        }