コード例 #1
0
 public void TestDoPerformanceJordanReedWeek06()
 {
     var p = new NFLPlayer("REEDJO02");
     var week06 = new NFLWeek("2015", 6);
     var _scorer = new YahooScorer(week06);
     var nScore = _scorer.RatePlayer( p, week06 );
     Assert.IsTrue( nScore == 0 );
 }
コード例 #2
0
 public void TestDoPerformanceDeAngeloWeek09()
 {
     var p = new NFLPlayer("WILLDE02");
     var week = new NFLWeek("2015", 9);
     var _scorer = new YahooScorer(week);
     var nScore = _scorer.RatePlayer(p, week);
     Assert.IsTrue(nScore > 0);
 }
コード例 #3
0
 public void TestYahooScorerOnBeckham()
 {
     var w = new NFLWeek(2015, 9);
      var scorer = new YahooScorer(w);
      var plyr = new NFLPlayer("BECKOD01");
      var score = scorer.RatePlayer(plyr, w);
      Assert.IsTrue(score > 0.0M);
      var gameKey = w.GameCodeFor(plyr.TeamCode);
      var msg = plyr.MetricsOut(gameKey);
      Console.WriteLine(msg);
 }
コード例 #4
0
 public void TestYahooScorerOnAPlayer()
 {
     var w = new NFLWeek( 2014, 8 );
      var scorer = new YahooScorer( w );
      var plyr = new NFLPlayer( "LACYED01" );
      var score = scorer.RatePlayer( plyr, w );
      Assert.IsTrue( score == 17.0M );
      var gameKey = w.GameCodeFor( plyr.TeamCode );
      var msg = plyr.MetricsOut(gameKey);
      Console.WriteLine( msg );
 }
コード例 #5
0
        private DataTable BuildTable()
        {
            var dt   = new DataTable();
            var cols = dt.Columns;

            cols.Add("WEEK", typeof(String));
            cols.Add("TEAM", typeof(String));
            cols.Add("URES", typeof(String));
            cols.Add("EP", typeof(Decimal));
            cols.Add("MATCH", typeof(String));
            cols.Add("STATS", typeof(String));
            cols.Add("FPTS", typeof(Decimal));

            if (Player.PerformanceList == null)
            {
                Player.LoadPerformances(true, false, Utility.CurrentSeason());                   //  all games=true, coz we want to see the career
            }
            if (Player.PerformanceList == null)
            {
                return(dt);
            }

            foreach (NflPerformance g in Player.PerformanceList)
            {
                if (g.Game == null)
                {
                    continue;
                }
                var week   = new NFLWeek(g.Season, g.Week);
                var scorer = new YahooScorer(week);
                var dr     = dt.NewRow();
                g.Game.TallyMetrics(metric: String.Empty);
                dr["WEEK"]  = g.Game.GameCodeOut();
                dr["TEAM"]  = string.Format("{0}-{1}", g.TeamCode, Player.Unit());
                dr["URES"]  = g.Game.UnitResult(Player.Unit(), g.TeamCode);
                dr["EP"]    = g.Game.ExperiencePoints(Player, g.TeamCode);
                dr["MATCH"] = g.Game.ScoreOut3();
                dr["STATS"] = g.PerfStats.Stat1(Player.PlayerCat, addAvg: false);
                dr["FPTS"]  = Player.PointsForWeek(week, scorer, savePoints: false);
                dt.Rows.Add(dr);
            }
            //  save the table for Ron?
            return(dt);
        }
コード例 #6
0
        private static void TallyPts(List <NFLPlayer> playerList, ref decimal totPts,
                                     ref decimal qbPts, ref decimal rbPts, ref decimal wrPts,
                                     ref decimal tePts, ref decimal pkPts, NFLWeek week)
        {
            var scorer = new YahooScorer(week);

            foreach (var p in playerList)
            {
                var fpts = scorer.RatePlayer(p, week);
                totPts += fpts;

                switch (p.PlayerCat)
                {
                case Constants.K_QUARTERBACK_CAT:
                    qbPts += fpts;
                    break;

                case Constants.K_RUNNINGBACK_CAT:
                    rbPts += fpts;
                    break;

                case Constants.K_RECEIVER_CAT:
                    if (p.IsTe())
                    {
                        tePts += fpts;
                    }
                    else
                    {
                        wrPts += fpts;
                    }
                    break;

                case Constants.K_KICKER_CAT:
                    pkPts += fpts;
                    break;

                default:
                    break;
                }
            }
        }
コード例 #7
0
        public string RenderPlayerCsv()
        {
            Lister.SortOrder = "CURSCORES DESC";

            var nWeek = int.Parse(Utility.CurrentWeek());

            if (nWeek == 0)
            {
                nWeek = 1;
            }

            var theWeek = new NFLWeek(int.Parse(Utility.CurrentSeason()), nWeek, loadGames: false);

            var weekMaster = new WeekMaster();

            Lister.RenderToCsv  = true;
            Lister.StartersOnly = true;
            if (!DoProjections)
            {
                var scorer = new YahooScorer(theWeek);
                Lister.SetScorer(scorer);
            }

            foreach (var sc in Configs)
            {
                Lister.Collect(sc.Category, sc.Position, string.Empty);
            }

            Lister.Folder       = "Starters";
            Lister.LongStats    = true;
            Lister.RenderToHtml = false;

            var fileOut = DoProjections ?
                          Lister.RenderProjection("PlayerCsv", weekMaster)
                           : Lister.Render("PlayerCsv");

            Lister.Clear();

            return(fileOut);
        }
コード例 #8
0
ファイル: PlayerCsv.cs プロジェクト: Quarterback16/Tycoon.API
        public WeekMaster CollectPlayers()
        {
            Lister.SortOrder = "POINTS DESC";

            var nWeek = int.Parse(Utility.CurrentWeek());

            if (nWeek == 0)
            {
                nWeek = 1;
            }

            var theWeek = new NFLWeek(
                int.Parse(Utility.CurrentSeason()),
                nWeek,
                loadGames: false);

            var weekMaster = new WeekMaster();

            Lister.RenderToCsv  = true;
            Lister.StartersOnly = true;
            if (!DoProjections)
            {
                var scorer = new YahooScorer(theWeek);
                Lister.SetScorer(scorer);
            }

            foreach (var sc in Configs)
            {
                Lister.Collect(
                    sc.Category,
                    sc.Position,
                    fantasyLeague: string.Empty);
            }

            return(weekMaster);
        }
コード例 #9
0
ファイル: PlayerCsv.cs プロジェクト: Quarterback16/GerardGui
        public string RenderPlayerCsv()
        {
            Lister.SortOrder = "CURSCORES DESC";

             var nWeek = int.Parse(Utility.CurrentWeek());
             if (nWeek == 0) nWeek = 1;

             var theWeek = new NFLWeek( int.Parse(Utility.CurrentSeason()), nWeek, loadGames:false);

             var weekMaster = new WeekMaster();

             Lister.RenderToCsv = true;
             Lister.StartersOnly = true;
             if ( !DoProjections )
             {
            var scorer = new YahooScorer( theWeek );
            Lister.SetScorer( scorer );
             }

             foreach ( var sc in Configs)
             {
            Lister.Collect(sc.Category, sc.Position, string.Empty);
             }

             Lister.Folder = "Starters";
             Lister.LongStats = true;
             Lister.RenderToHtml = false;

             var fileOut = DoProjections ?
            Lister.RenderProjection("PlayerCsv", weekMaster)
            : Lister.Render("PlayerCsv");

             Lister.Clear();

             return fileOut;
        }
コード例 #10
0
ファイル: NFLGame.cs プロジェクト: Quarterback16/GerardGui
        public void TallyYahooFor(NflTeam nflTeam, bool announceIt)
        {
            var theWeek = new NFLWeek(Season, WeekNo);

             var scorer = new YahooScorer(theWeek);
             var playerList = LoadLineupPlayers(nflTeam.TeamCode == HomeTeam ? HomeTeam : AwayTeam);
             foreach (var nflPlayer in playerList)
             {
            if (!nflPlayer.IsFantasyPlayer()) continue;
            var qty = scorer.RatePlayer(nflPlayer, theWeek);
            if (qty > 0.0M)
            {
               Announce( string.Format( "{0} for {1} in {2}",
                  qty, nflPlayer.PlayerName, Season + ":" + Week ) );

               var yo = new YahooOutput(
                                 Season,
                                 Week,
                                 nflPlayer.PlayerCode,
                                 qty,
                                 Opponent( nflTeam.TeamCode ));

               Announce( string.Format( "adding {0}",yo.StatOut() ) );

               YahooList.Add(yo);
            }
             }
        }
コード例 #11
0
        private DataTable BuildTable()
        {
            var dt = new DataTable();
            var cols = dt.Columns;
            cols.Add( "WEEK",      typeof( String ) );
            cols.Add( "TEAM",      typeof( String ) );
            cols.Add( "URES",      typeof( String ) );
            cols.Add( "EP",        typeof( Decimal ) );
            cols.Add( "MATCH",     typeof( String ) );
            cols.Add( "STATS",     typeof( String ) );
             cols.Add( "FPTS",      typeof( Decimal ) );

             if (Player.PerformanceList == null)
                Player.LoadPerformances( true, false, Utility.CurrentSeason()); //  all games=true, coz we want to see the career

               if (Player.PerformanceList == null) return dt;

               foreach ( NflPerformance g in Player.PerformanceList )
               {
              if (g.Game == null) continue;
              var week = new NFLWeek( g.Season, g.Week );
              var scorer = new YahooScorer( week );
              var dr = dt.NewRow();
              g.Game.TallyMetrics(String.Empty);
              dr[ "WEEK" ]  = g.Game.GameCodeOut();
              dr[ "TEAM" ]  = string.Format( "{0}-{1}", g.TeamCode, Player.Unit() );
              dr[ "URES" ] = g.Game.UnitResult( Player.Unit(), g.TeamCode );
              dr[ "EP" ] = g.Game.ExperiencePoints( Player, g.TeamCode );
              dr[ "MATCH" ] = g.Game.ScoreOut3();
              dr[ "STATS" ] = g.PerfStats.Stat1( Player.PlayerCat, false );
              dr[ "FPTS" ] = Player.PointsForWeek( week, scorer );
              dt.Rows.Add( dr );
               }
               //  save the table for Ron?
            return dt;
        }
コード例 #12
0
        private static string WeeklyEspnPerformance(
         string catCode, int week, string leagueId, [System.Runtime.InteropServices.Optional] string sPos )
        {
            var pl = new PlayerLister { WeeksToGoBack = 1 };
             var master = new YahooMaster( "Yahoo", "YahooOutput.xml" );
             var currentWeek =
            new NFLWeek( Int32.Parse( Utility.CurrentSeason() ), weekIn: week, loadGames: false );
             var gs = new YahooScorer( currentWeek ) { Master = master };

             pl.SetScorer( gs );
             pl.SetFormat( "weekly" );
             pl.AllWeeks = false; //  just the regular saeason
             pl.Season = currentWeek.Season;
             pl.RenderToCsv = false;
             pl.Week = week;
             pl.Collect( catCode, sPos: sPos, fantasyLeague: leagueId );

             var targetFile = string.Format( "{4}{3}//Performance//{2}-Yahoo {1} Performance upto Week {0}.htm",
            currentWeek.WeekNo, sPos, leagueId, pl.Season, Utility.OutputDirectory() );
             pl.Render( targetFile );
             return pl.FileOut;
        }
コード例 #13
0
 public void TestDoPerformanceWilleSneadWeek08()
 {
     var p = new NFLPlayer( "SNEAWI01" );
     var week = new NFLWeek( "2015", 8 );
     var _scorer = new YahooScorer( week );
     var nScore = _scorer.RatePlayer( p, week );
     Assert.IsTrue( nScore > 0 );
 }
コード例 #14
0
 public void TestYahooScorer()
 {
     var player = new NFLPlayer("MANNPE01");
      var week = new NFLWeek("2014", 1);
      var sut = new YahooScorer(week);
      var score = sut.RatePlayer(player, week);
      Assert.IsTrue(score.Equals(20.0M));
 }
コード例 #15
0
 public void TestYahooScorerLuck()
 {
     var player = new NFLPlayer( "LUCKAN01" );
      var week = new NFLWeek( "2014", 14 );
      var sut = new YahooScorer( week );
      var score = sut.RatePlayer( player, week );
      Assert.IsTrue( score.Equals( 24.0M ) );
 }