Ejemplo n.º 1
0
        private void WriteCountLine( DataTable dt, string stat )
        {
            var dr = dt.NewRow();
             dr[ "STAT" ] = stat;

             var tot = 0;
             foreach ( var week in NflSeason.RegularWeeks )
             {
            var weekNo = string.Format( "WK{0}", week.Week );
            var actuals = GetActuals( NflSeason.Year, week.Week );
            var nInWeek = 0;
            var predTab = actuals.Tables[ "sched" ];
            foreach ( DataRow row in predTab.Rows )
            {
               var g = new NFLGame( row );
            #if DEBUG
               Utility.Announce( g.ScoreOut() );
            #endif
               if ( g.TotalTds() == 0 || ForceRefresh )
                  g.RefreshTotals();

               g.TallyMetrics( string.Empty );

               switch ( stat )
               {
                  case "TDr":
                     nInWeek += g.HomeTDr + g.AwayTDr;
                     break;
                  case "TDp":
                     nInWeek += g.HomeTDp + g.AwayTDp;
                     break;
                  case "TDd":
                     nInWeek += g.HomeTDd + g.AwayTDd;
                     break;
                  case "TDs":
                     nInWeek += g.HomeTDs + g.AwayTDs;
                     break;
                  case "FG":
                     nInWeek += g.HomeFg + g.AwayFg;
                     break;
                  case "YDp":
                     nInWeek += g.HomeYDp + g.AwayYDp;
                     break;
                  case "YDr":
                     nInWeek += g.HomeYDr + g.AwayYDr;
                     break;

                  default:
                     break;
               }
            }
            if ( nInWeek > 0 )
            {
               tot += nInWeek;
               dr[ weekNo ] = string.Format( "{0}", nInWeek );
            }
            #if DEBUG
            //break;  //  dont iterate v not got time
            #endif
             }
             dr[ "TOT" ] = tot;
             dt.Rows.Add( dr );
        }
Ejemplo n.º 2
0
        public NFLBet IsBettable( NFLGame game )
        {
            NFLBet bet = null;
             string revengeTeam = "";
             string revengeGame = "";
             TimeSpan aYear = new TimeSpan( 365, 0, 0, 0 );

             DataSet ds = tflWS.GetGamesBetween( game.HomeTeam, game.AwayTeam, DateTime.Now.Subtract( aYear ) );
             DataTable dt = ds.Tables["SCHED"];
             dt.DefaultView.Sort = "GAMEDATE ASC";
             foreach (DataRow dr in dt.Rows)
             {
            if ( dr.RowState != DataRowState.Deleted )
            {
               NFLGame aGame = new NFLGame( dr );
               revengeTeam = ( aGame.HomeWin() ) ? aGame.AwayTeam : aGame.HomeTeam;
               revengeGame = aGame.ScoreOut( revengeTeam ) + " " + aGame.GameCodeOut();
            }
             }

             if ( revengeTeam.Length > 0 )
            bet = new NFLBet( revengeTeam, game, Name + " - " + revengeGame, ConfidenceLevel() );

             return bet;
        }
        private void RateGame( NFLGame g )
        {
            if ( g.Played() )
            {
                if ( AuditIt ) Utility.Announce( string.Format( "Rating game {0}", g.ScoreOut() ) );
                //  workout the Average Score
                //AverageScore = Season.AverageScoreAfterWeek( g.WeekNo );
                const int averageScore = 21; //  this is pretty much fixed

                var adjustment = new NibbleGameRating( 0, 0, 0, 0 );
                var ff = FudgeFactor();
                adjustment.HomeOff = ( MaximumScore( g.HomeScore ) - averageScore ) / ff;
                adjustment.HomeDef = ( MaximumScore( g.AwayScore ) - averageScore ) / ff;
                adjustment.AwayOff = ( MaximumScore( g.AwayScore ) - averageScore ) / ff;
                adjustment.AwayDef = ( MaximumScore( g.HomeScore ) - averageScore ) / ff;

                if ( AuditIt )
                {
                    Utility.Announce(string.Format("    Actual    score {0} {1:00} v {2} {3:00}",
                                                   g.HomeTeam, g.HomeScore, g.AwayTeam, g.AwayScore));
                    Utility.Announce(string.Format("    Adjustments  H {0} {1} - {2}",
                                                   g.HomeTeam, adjustment.HomeOff, adjustment.HomeDef));
                    Utility.Announce(string.Format("    Adjustments  A {0} {1} - {2}",
                                                   g.AwayTeam, adjustment.AwayOff, adjustment.AwayDef));
                }
                AdjustRatings( adjustment, g.HomeTeam, g.AwayTeam);
            }
        }
Ejemplo n.º 4
0
        private static int AnnounceResult( NFLGame game, NFLResult result, int suWins, ref int suLosses, ref int atsWins,
		                                   ref int atsTies, ref int atsLosses )
        {
            Utility.Announce( game.ScoreOut() );
            var su = game.EvaluatePrediction( result );
            Utility.Announce( su );
            if (su.IndexOf( "WIN" ) > -1) suWins++;
            else suLosses++;

            var ats = game.EvaluatePredictionAts( result, game.Spread );
            if (ats.IndexOf( "WIN" ) > -1) atsWins++;
            else if (ats.IndexOf( "PUSH" ) > -1)
                atsTies++;
            else
                atsLosses++;
            Utility.Announce( ats );
            return suWins;
        }