コード例 #1
0
        public NFLResult PredictGame(NFLGame game, IStorePredictions persistor, DateTime predictionDate)
        {
            var result = new NFLResult {AwayTeam = game.AwayTeam, HomeTeam = game.HomeTeam};

             var homeTeam = game.HomeNflTeam;
             var awayTeam = game.AwayNflTeam;

             var nHomeOff = Utility.OffRating(homeTeam, predictionDate);
             var nAwayOff = Utility.OffRating(awayTeam, predictionDate);
             var nHomeDef = Utility.DefRating(homeTeam, predictionDate);
             var nAwayDef = Utility.DefRating(awayTeam, predictionDate);
             result.HomeScore = (nHomeOff + nAwayDef) - 20;
             result.AwayScore = (nAwayOff + nHomeDef) - 20;

             persistor.StorePrediction("Miller", game, result);

             if (AuditTrail)
            Utility.Announce(string.Format("{0}-{1}:{2}", game.GameCodeOut(), game.GameCode, result.LogResult()));

             return result;
        }
コード例 #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;
        }
コード例 #3
0
        private static void AuditPrediction(NFLGame game, int awayDef, int awayOff, int homeOff, NFLResult res, int homeDef)
        {
            const string debugTeamCode = "GB";
            var debugTeamRank = "(0-0)";
            var strVenue = "unknown";
            var oppTeamCode = "YY";
            var oppRank = "(0-0)";
            const string rankFormat = "({0}.{1}={2})";
            var bAudit = false;
            if (game.HomeTeam.Equals(debugTeamCode))
            {
                bAudit = true;
                strVenue = "Home";
                oppTeamCode = game.AwayTeam;
                oppRank = string.Format(rankFormat, awayOff, awayDef, Rating(awayOff, awayDef));
                debugTeamRank = string.Format(rankFormat, homeOff, homeDef, Rating(homeOff, homeDef));
            }
            if (game.AwayTeam.Equals(debugTeamCode))
            {
                bAudit = true;
                strVenue = "Away";
                oppTeamCode = game.HomeTeam;
                oppRank = string.Format(rankFormat, homeOff, homeDef, Rating(homeOff, homeDef));
                debugTeamRank = string.Format(rankFormat, awayOff, awayDef, Rating(awayOff, awayDef));
            }
            if (!bAudit) return;
            Utility.Announce(string.Format(" {5} Debug Team {0} {1}, is {2} vs {3} {4}",
                                           debugTeamCode, debugTeamRank, strVenue, oppTeamCode, oppRank, game.GameCodeOut()));

            Utility.Announce(res.LogResult());
        }
コード例 #4
0
        private static void AuditIt( NFLGame game, NFLResult res, int homeRating, int awayRating )
        {
            const string debugTeamCode = "SF";
            var debugTeamRank = "(0-0)";
            #if DEBUG
            var strVenue = "unknown";
            #endif
            var oppTeamCode = "YY";
            var oppRank = "(0-0)";
            const string rankFormat = "({0})";
            var bAudit = false;
            if (game.HomeTeam.Equals(debugTeamCode))
            {
                bAudit = true;
            #if DEBUG
                strVenue = "Home";
            #endif
                oppTeamCode = game.AwayTeam;
                oppRank = string.Format(rankFormat, awayRating );
                debugTeamRank = string.Format(rankFormat, homeRating );
            }
            if (game.AwayTeam.Equals(debugTeamCode))
            {
                bAudit = true;
            #if DEBUG
                strVenue = "Away";
            #endif
                oppTeamCode = game.HomeTeam;
                oppRank = string.Format(rankFormat, homeRating );
                debugTeamRank = string.Format( rankFormat, awayRating );
            }
            if (!bAudit) return;

            #if DEBUG
            Utility.Announce(string.Format(" {5} Debug Team {0} {1}, is {2} vs {3} {4}",
                                           debugTeamCode, debugTeamRank, strVenue, oppTeamCode, oppRank, game.GameCodeOut()));

            Utility.Announce(res.LogResult());  //  verbosity
            #endif
        }
コード例 #5
0
ファイル: WizSeason.cs プロジェクト: Quarterback16/GerardGui
        private static void ProcessGame(UnitMatrix u, NFLGame g)
        {
            var weekOffset = Int32.Parse(g.Week) - 1;
            Utility.Announce(string.Format("Game {0}", g.GameCodeOut()));
            if ((weekOffset < 0) || (weekOffset > 20))
                Utility.Announce(string.Format("Game {0} has week {1}", g.GameCodeOut(), g.Week));
            else
            {
                if (!g.MetricsCalculated) g.TallyMetrics(String.Empty);

                decimal metric = (g.IsHome(u.Team.TeamCode) ? g.HomeTDp : g.AwayTDp);
                GetEp("PO", u.PoExp, g, u, weekOffset, metric);

                metric = (g.IsHome(u.Team.TeamCode) ? g.HomeTDr : g.AwayTDr);
                GetEp("RO", u.RoExp, g, u, weekOffset, metric);

                metric = (g.IsHome(u.Team.TeamCode) ? g.HomeSaKa : g.AwaySaKa);
                GetEp("PP", u.PpExp, g, u, weekOffset, metric);

                metric = (g.IsHome(u.Team.TeamCode) ? g.AwaySaKa : g.HomeSaKa);
                GetEp("PR", u.PrExp, g, u, weekOffset, metric);

                metric = (g.IsHome(u.Team.TeamCode) ? g.AwayTDr : g.HomeTDr);
                GetEp("RD", u.RdExp, g, u, weekOffset, metric);

                metric = (g.IsHome(u.Team.TeamCode) ? g.AwaySaKa : g.HomeSaKa);
                GetEp("PD", u.PdExp, g, u, weekOffset, metric);
            }
        }