Пример #1
0
        public NFLBet IsBettable( NFLGame game )
        {
            NFLBet bet = null;
            this.game = game;
            if ( Int32.Parse( game.Week ) > 2 )
            {
                if ( ! game.IsDivisionalGame() )
                {
                    RosterLib.Utility.Announce( "      Non-Divisional Game");
                    if ( BetAgainst( game.HomeNflTeam.TeamCode ) )
                        bet = new NFLBet( game.HomeNflTeam.TeamCode, game, Name + " - " + game.Spread, ConfidenceLevel() );
                    if ( BetAgainst( game.AwayNflTeam.TeamCode ) )
                        bet = new NFLBet( game.AwayNflTeam.TeamCode, game, Name + " - " + game.Spread, ConfidenceLevel() );
                }
                else
                {
                    RosterLib.Utility.Announce( "      Divisional Game");
                }
            }

             return bet;
        }
Пример #2
0
 /// <summary>
 /// Segment I (Weeks 1-4)
 /// Pointer Eleven: (p 70)
 ///   Sandwich Game
 ///   I look to wager against a team ina  divisional series "sandwich game".
 ///   A sandwich game is a non-divisional game that takes placewhen a team has just played 
 ///   at least two straight divisional games and has at least 2 more straight divisional
 ///   games coming up after the non divisional contest.
 /// </summary>
 public static bool TeamSandwiched( NflTeam t, NFLGame nextGame )
 {
     bool sandwichGame = false;
      if ( ! nextGame.IsDivisionalGame() )
      {
     NFLGame lastGame = t.PreviousGame( nextGame.GameDate );
     if ( lastGame.IsDivisionalGame() )
     {
        NFLGame lastLastGame = t.PreviousGame( lastGame.GameDate );
        if ( lastLastGame.IsDivisionalGame() )
        {
           //  now what about the next game?
           NFLGame nextNextGame = t.NextGame( nextGame.GameDate );
           if (nextNextGame != null)
           {
              if (nextNextGame.IsDivisionalGame())
              {
                 // finally another one
                 NFLGame nextNextNextgame = t.NextGame(nextNextGame.GameDate);
                 if (nextNextNextgame.IsDivisionalGame())
                    sandwichGame = true;
              }
           }
        }
     }
      }
      return sandwichGame;
 }
Пример #3
0
 /// <summary>
 /// Segment II (Weeks 5-8)
 /// Pointer: Six (p 73)
 ///   Out-of-Division Favourites.
 ///     As in games one through four, if a team has played 2 or more consecutive divisional games
 ///     and is now playing a nondivisional game, I look to wager against the team if they are 
 ///     favoured by 7 or more.
 /// </summary>
 /// <param name="team"></param>
 /// <param name="upcomingGame"></param>
 /// <returns></returns>
 public static bool OutOfDivisionFavourites( NflTeam team, NFLGame upcomingGame )
 {
     var isOutOfDivisionFavourite = false;
      if ( ! upcomingGame.IsDivisionalGame() )
      {
     if ( upcomingGame.IsFavourite( team ) )
     {
        if ( Math.Abs( upcomingGame.Spread ) >= 7 )
        {
           var lastGame = team.PreviousGame( upcomingGame.GameDate );
           if ( lastGame.IsDivisionalGame() )
           {
              var previousToLastGame = team.PreviousGame( lastGame.GameDate );
           	if (previousToLastGame.IsDivisionalGame())
           		isOutOfDivisionFavourite = true;
           }
        }
     }
      }
      return isOutOfDivisionFavourite;
 }
Пример #4
0
 /// <summary>
 /// Segment II ( Weeks 5-8)
 /// Pointer Eight: (p73)
 ///   Monday Night Followup.
 ///     As in the first four games, I look to bet
 ///     against a team that has won and covered a Monday night game against a 
 ///     divisional opponent, and who is now playing a non divisional team.
 /// </summary>
 /// <param name="team"></param>
 /// <param name="upcomingGame"></param>
 /// <returns></returns>
 public static bool MondayNightFollowUp( NflTeam team, NFLGame upcomingGame )
 {
     var isMnfFollowup = false;
      if ( ! upcomingGame.IsDivisionalGame() )
      {
     var previousGame = team.PreviousGame( upcomingGame.GameDate );
     if ( previousGame.IsMondayNight() )
     {
        if ( previousGame.IsDivisionalGame() )
           if ( previousGame.WonVsSpread( team ) )
              isMnfFollowup = true;
     }
      }
      return isMnfFollowup;
 }
Пример #5
0
        private GameMetrics CalculateGameMetrics( bool isHome, NFLGame game, DateTime focusDate )
        {
            string teamRatings;
            string oppRatings;

            var gm = new GameMetrics();

            if ( isHome )
            {
                oppRatings = RatingsService.GetUnitRatingsFor( game.AwayNflTeam, focusDate );
                teamRatings = RatingsService.GetUnitRatingsFor( game.HomeNflTeam, focusDate );
                game.AwayNflTeam.Ratings = oppRatings;
                game.HomeNflTeam.Ratings = teamRatings;
            }
            else
            {
                teamRatings = RatingsService.GetUnitRatingsFor( game.AwayNflTeam, focusDate );
                oppRatings = RatingsService.GetUnitRatingsFor( game.HomeNflTeam, focusDate );
                game.HomeNflTeam.Ratings = oppRatings;
                game.AwayNflTeam.Ratings = teamRatings;
            }

            var score = 0;
            if ( string.IsNullOrEmpty( teamRatings ) || string.IsNullOrEmpty( oppRatings ))
                Utility.Announce( "Ratings not found - skipping score calculation" );
            else
            {
                var fg = isHome ? 2 : 1;
                if (game.IsDomeGame())
                    fg++;
                else
                {
                    if (game.IsBadWeather())
                        fg--;
                }

                //  Part 1 - Calculate Tdp
                var po = teamRatings.Substring( 0, 1 );
                var pd = oppRatings.Substring( 5, 1 );
                var tdp = TouchdownPasses( po, pd );
                var ydp = YardsPassing( po, pd );
                gm.TDp = tdp;
                gm.YDp = ydp;

                //  Part 2 - Adjust for protection
                var pp = teamRatings.Substring( 2, 1 );
                var pr = oppRatings.Substring( 3, 1 );
                var ppr = ProtectionAdjustment( pp, pr );

                tdp += ppr;
                if ( tdp < 0 ) tdp = 0;

                //  Part 3 - Calculate Tdr
                var ro = teamRatings.Substring( 1, 1 );
                var rd = oppRatings.Substring( 4, 1 );
                var tdr = TouchdownRuns( ro, rd );
                var ydr = YardsRushing( ro, rd );
                gm.TDp = tdp;
                gm.TDr = tdr;
                gm.YDr = ydr;

                var tdd = DefensiveScores(game.IsDivisionalGame(), isHome);

                var tds = SpecialTeamScores(game.IsMondayNight(), isHome);

                gm.TDd = tdd;
                gm.TDs = tds;
                gm.FG = fg;

                //TODO:  Short week adjustment
                //TODO:  Opponent had Route last game adjustment
                //TODO:  Revenge adjustment

                // Total up all the parts of a score
                score = ( tdp + tdr + tdd + tds )*7 + (fg * 3);

                DumpCalculations( isHome, game, tdr, pr, pp, ro, tds, tdd, rd, oppRatings,
                    teamRatings, ppr, tdp, score, pd, po, fg);

                if ( isHome )
                {
                    _homeTDp = tdp;
                    _homeTDr = tdr;
                    _homeFg = fg;
                    _homeTDd = tdd;
                    _homeTDs = tds;
                    _homeYDr = ydr;
                    _homeYDp = ydp;
                }
                else
                {
                    _awayTDp = tdp;
                    _awayTDr = tdr;
                    _awayFg = fg;
                    _awayTDd = tdd;
                    _awayTDs = tds;
                    _awayYDr = ydr;
                    _awayYDp = ydp;
                }
            }
            gm.Score = score;
            return gm;
        }
Пример #6
0
 private bool IsGameDivisional( string teamCodeIn, string seasonIn, string weekIn )
 {
     var dr = tflWS.GetGame( seasonIn, weekIn, teamCodeIn );
      var g = new NFLGame( dr );
      return g.IsDivisionalGame();
 }