예제 #1
0
        public void TallyTeam(
            ICollection <NflTeam> teamList,
            string season,
            DateTime focusDate,
            string teamCode)
        {
            var team = new NflTeam(teamCode);                //  simple code constructor

            if (TimeKeeper.IsItRegularSeason())
            {
                team.LoadGames(team.TeamCode, season);
                GameScope = GameScopeFromGameList(
                    team.GameList);
            }
            else
            {
                GameScope = $@"Regular season Games {
					Int32.Parse(season)-1
					}"                    ;
                team.LoadPreviousRegularSeasonGames(
                    team.TeamCode,
                    season,
                    focusDate);
            }
            team.TallyStats(Breakdowns);
            teamList.Add(team);
            var breakdownKey  = $"{team.TeamCode}-Q";
            var breakdownFile = $@"{Utility.OutputDirectory()}\\{
							TimeKeeper.CurrentSeason()
							}\\Metrics\\breakdowns\\{breakdownKey}.htm"                            ;

            Breakdowns.Dump(
                breakdownKey,
                breakdownFile);
        }
예제 #2
0
        public void TallyTeam(
            ICollection <NflTeam> teamList,
            string season,
            DateTime focusDate,
            string teamCode)
        {
            var team = new NflTeam(teamCode);                //  simple code constructor

            //if ( teamCode == "IC")
            //	Console.WriteLine("Test Team");
            if (thisSeasonOnly)
            {
                team.LoadGames(team.TeamCode, season);
            }
            else
            {
                team.LoadPreviousRegularSeasonGames(
                    team.TeamCode,
                    season,
                    focusDate);
            }
            team.TallyStats(
                breakdowns: null);
            teamList.Add(team);
        }
예제 #3
0
 public EventReport(string teamCode, string statCode, DataLibrarian tflWS)
 {
     Team = new NflTeam(teamCode);
     Team.LoadGames(teamCode, Utility.LastSeason());
     this.tflWS = tflWS;
     StatCode   = statCode;
 }
예제 #4
0
        public Int32 PredictYDc(NFLPlayer plyr, string season, int week)
        {
            int YDc = 0;

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

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

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

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

                        predictedYDc = ((teamTotYDc / gamesPlayed) +
                                        (teamTotYDcAllowed / gamesOppPlayed)) / 2;
                    }
                    else
                    {
                        predictedYDc = 0.0M;
                    }

                    //  find out how many carries the starter usually has
                    //  YDr is the proportion of the whole
                    YDc = plyr.IsTe() ? Convert.ToInt32(predictedYDc * .2M) : Convert.ToInt32(predictedYDc * .4M);
                }
            }
            return(YDc);
        }
        public void TallyTeam(ICollection <NflTeam> teamList, string season, DateTime focusDate, string teamCode)
        {
            var team = new NflTeam(teamCode);                //  simple code constructor

            if (thisSeasonOnly)
            {
                team.LoadGames(team.TeamCode, season);
            }
            else
            {
                team.LoadPreviousRegularSeasonGames(team.TeamCode, season, focusDate);
            }
            team.TallyStats();
            teamList.Add(team);
        }