public void Load()
        {
            _ft = new FrequencyTable($@"{PlayerType} output week {
				wRange.startWeek.WeekKey( "-" )
				} to {
				wRange.endWeek.WeekKey( "-" )
				}"                );

            if (string.IsNullOrEmpty(SinglePlayer))
            {
                //  get players who appeared in this range
                var ds = Utility.TflWs.GetPlayersScoring(
                    ScoreType, wRange.startWeek.Season, wRange.endWeek.Season, ScoreSlot);
                var dt = ds.Tables["score"];
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        var player = new NFLPlayer(dr[string.Format("PLAYERID{0}", ScoreSlot)].ToString());
                        if (player.IsStarter())
                        {
                            playerList.Add(player);
                            Utility.Announce($@"  Adding {
								player.PlayerNameShort,-15
								} to the list of {PlayerType}"                                );
                        }
                    }
                }
            }
            else
            {
                //  single player
                var player = new NFLPlayer(SinglePlayer);
                playerList.Add(player);
                Utility.Announce(string.Format("  Adding {0,-15} to the list of {1}",
                                               player.PlayerNameShort, PlayerType));
            }
            Utility.Announce($"    Examining {playerList.Count:#0} players");

            //  do the counting, so get all the performances for
            foreach (NFLPlayer p in playerList)
            {
                var week = wRange.startWeek;
                while (wRange.endWeek.IsBefore(week))
                {
                    var amount = Scorer.RatePlayer(p, week);
                    _ft.Add(amount);
                    Utility.Announce(string.Format("  {0,-15} got {1,2} in {2}",
                                                   p.PlayerNameShort, amount, week.WeekKey()));
                    week = week.NextWeek(week);
                }
            }
            _ft.Calculate();
        }
        public void Load()
        {
            _ft = new FrequencyTable( string.Format("{2} output week {0} to {1}",
                wRange.startWeek.WeekKey("-"), wRange.endWeek.WeekKey("-"), PlayerType ) );

            if (string.IsNullOrEmpty(SinglePlayer))
            {
                //  get players who appeared in this range
                var ds = Utility.TflWs.GetPlayersScoring(
                    ScoreType, wRange.startWeek.Season, wRange.endWeek.Season, ScoreSlot);
                var dt = ds.Tables["score"];
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        var player = new NFLPlayer(dr[string.Format("PLAYERID{0}", ScoreSlot)].ToString());
                        if (player.IsStarter())
                        {
                            playerList.Add(player);
                            Utility.Announce(string.Format("  Adding {0,-15} to the list of {1}",
                                player.PlayerNameShort, PlayerType));
                        }
                    }
                }
            }
            else
            {
                //  single player
                var player = new NFLPlayer( SinglePlayer );
                playerList.Add( player );
                Utility.Announce(string.Format("  Adding {0,-15} to the list of {1}",
                        player.PlayerNameShort, PlayerType));
            }
            Utility.Announce(string.Format("    Examining {0:#0} players", playerList.Count));

            //  do the counting, so get all the performances for
            foreach (NFLPlayer p in playerList)
            {
                var week = wRange.startWeek;
                while ( wRange.endWeek.IsBefore( week ) )
                {
                    var amount = Scorer.RatePlayer( p, week );
                    _ft.Add( amount );
                    Utility.Announce( string.Format( "  {0,-15} got {1,2} in {2}",
                        p.PlayerNameShort, amount, week.WeekKey() ) );
                    week = week.NextWeek( week );
                }
            }
            _ft.Calculate();
        }
Beispiel #3
0
        public void RunningDifferentials()
        {
            if ( _matrixList == null ) return;
            ArrayList diff = new ArrayList();
            for ( int i = 0; i < _matrixList.Count; i++ )
            {
                UnitMatrix matrixA = (UnitMatrix)_matrixList[i];

                for ( int j = 0; j < _matrixList.Count; j++ )
                {
                    UnitMatrix matrixB = (UnitMatrix)_matrixList[j];
                    diff.Add( ( matrixA.RoPoints - matrixB.RdPoints ) );
                }
            }

            FrequencyTable ftp = new FrequencyTable(
                string.Format( "Running differential {0} week {1} to {2}", _season, _startWeek, _endWeek ), diff );

            ftp.Calculate();
            ftp.RenderAsHtml( "RunningDiff", _season );
        }
Beispiel #4
0
        private void FrequencyTables()
        {
            if (_gameList.Count > 0)
            {
                GameStats game;

                #region frequency table for Passing Yards

                _ftYDp = new FrequencyTable("Passing Yards" + _season);

                foreach ( object t in _gameList )
                {
                    game = (GameStats) t;
                    _ftYDp.Add(game.AwayPassingYds);
                    _ftYDp.Add(game.HomePassingYds);
                }

                _ftYDp.Calculate();
                _ftYDp.RenderAsHtml("Freq_YDp", _season );

                #endregion

                #region frequency table for Rushing Yards

                _ftYDr = new FrequencyTable("Rushing Yards " + _season);

                foreach ( var t in _gameList )
                {
                    game = (GameStats) t;
                    if (!game.isPlayoff())
                    {
                        _ftYDr.Add( game.AwayRushingYds );
                        _ftYDr.Add( game.HomeRushingYds );
                    }
                }

                _ftYDr.Calculate();
                _ftYDr.RenderAsHtml("Freq_YDr", _season );

                #endregion

                #region frequency table for Sacks Allowed

                _ftSaKallowed = new FrequencyTable("Sacks Allowed " + _season);

                foreach ( var t in _gameList )
                {
                    game = (GameStats) t;
                    if (!game.isPlayoff())
                    {
                        _ftSaKallowed.Add( game.AwaySacksAllowed );
                        _ftSaKallowed.Add( game.HomeSacksAllowed );
                    }
                }

                _ftSaKallowed.Calculate();
                _ftSaKallowed.RenderAsHtml("Freq_SAK_allwd", _season );

                #endregion

                #region frequency table for Tdp

                _ftTDp = new FrequencyTable(string.Format("TD passes {0} week {1} to {2}", _season, _startWeek, _endWeek ) );

                foreach ( var t in _gameList )
                {
                    game = (GameStats) t;
                    if ( game.isPlayoff() ) continue;

                    _ftTDp.Add( game.AwayTDpasses );
                    _ftTDp.Add( game.HomeTDpasses );
                }

                _ftTDp.Calculate();
                _ftTDp.RenderAsHtml("Freq_TDp", _season );

                #endregion

                #region frequency table for TD runs

                _ftTDr = new FrequencyTable(string.Format("TD runs {0} week {1} to {2}", _season, _startWeek, _endWeek ));

                foreach (var t in _gameList)
                {
                    game = (GameStats)t;
                    if (!game.isPlayoff())
                    {
                        _ftTDr.Add( game.AwayTDruns );
                        _ftTDr.Add( game.HomeTDruns );
                    }
                }

                _ftTDr.Calculate();
                _ftTDr.RenderAsHtml("Freq_TDr", _season );

                #endregion
            }
            else
                Utility.Announce( "No games to analyse" );
        }
Beispiel #5
0
        public void PassingDifferentials()
        {
            if ( _matrixList == null ) return;

            ArrayList diff = new ArrayList();
            for ( int i = 0; i < _matrixList.Count; i++ )
            {
                UnitMatrix matrixA = (UnitMatrix)_matrixList[i];

                for ( int j = 0; j < _matrixList.Count; j++ )
                {
                    UnitMatrix matrixB = (UnitMatrix)_matrixList[j];
                    diff.Add( ( matrixA.PoPoints - matrixB.PdPoints ) );
                }
            }

            FrequencyTable ftp = new FrequencyTable( "Passing differential " + _season +
                                                                  " week " + _startWeek + " to " + _endWeek, diff );
            ftp.Calculate();
            ftp.RenderAsHtml( "PassingDiff", _season );
        }