public void NibbleTipster_RatesLastYearsGames()
        {
            var cut = new NibbleTipster(
                new TippingContext());

            _output.WriteLine(cut.RateResults("NRL"));
        }
 private void DumpRatings(
     NibbleTipster cut,
     string leagueCode)
 {
     _output.WriteLine(
         cut.DumpRatings(
             leagueCode));
 }
        public void NibbleTipster_TipsAflRound()
        {
            var cut = new NibbleTipster(
                new TippingContext());
            var result = cut.ShowTips("AFL", 1);

            _output.WriteLine(result);
            Assert.False(
                string.IsNullOrEmpty(result));
        }
 private void DumpMetrics(
     NibbleTipster cut,
     string leagueCode)
 {
     _output.WriteLine(
         $"Average Score      : {cut.AverageScore}");
     _output.WriteLine(
         $"Average Margin     : {cut.Context.AverageMargin(leagueCode)}");
     _output.WriteLine(
         $"Homefield Advantage: {cut.HomeFieldAdvantage}");
     _output.WriteLine(
         $"Max Score          : {cut.MaxScore}");
     _output.WriteLine(
         $"Min Score          : {cut.MinScore}");
 }
        public void NibbleTipster_TipsGame()
        {
            var testResult = new ResultEvent
            {
                LeagueCode = "NRL",
                HomeTeam   = "MELB",
                AwayTeam   = "BRIS",
            };
            var testGame = new Game(testResult);
            var cut      = new NibbleTipster(
                new TippingContext());

            _output.WriteLine(cut.RateResults("NRL"));
            _output.WriteLine(cut.Tip(testGame).ToString());
        }
        public void NibbleTipster_TipsNrlRound()
        {
            var cut = new NibbleTipster(
                new TippingContext());

            var result = cut.ShowTips(
                league: "NRL",
                round: 1);

            _output.WriteLine(
                result);
            Assert.False(
                string.IsNullOrEmpty(result));
            DumpRatings(cut, "NRL");
            DumpMetrics(cut, "NRL");
        }
        public void NibbleTipster_RatesGame()
        {
            var testResult = new ResultEvent
            {
                LeagueCode = "NRL",
                HomeTeam   = "MELB",
                AwayTeam   = "BRIS",
                HomeScore  = 22,
                AwayScore  = 12
            };
            var testGame = new Game(testResult);
            var cut      = new NibbleTipster(
                new TippingContext());
            var result = cut.RateGame(testGame, 20);

            _output.WriteLine(result.ToString());
            Assert.True(
                result.AwayRating.Offence.Equals(-2),
                $"Away Off adj was {result.AwayRating.Offence}");
            Assert.True(
                result.HomeRating.Defence.Equals(-2),
                $"Home Def adj was {result.AwayRating.Defence}");
        }
Exemplo n.º 8
0
        /// <summary>
        ///    -l AFL -r 2
        ///    -l AFL -o pl  //  previous ladder
        ///    -l AFL -o ps  //  stats
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            var context = new TippingContext();

            //TODO: some validation could go here
            Console.WriteLine(
                $"There are {context.LeagueCount()} leagues");
            Console.WriteLine(
                $"League NRL has {context.ScheduledRoundCount("NRL")} rounds scheduled");
            Console.WriteLine(
                $"League AFL has {context.ScheduledRoundCount("AFL")} rounds scheduled");
            //context.DumpResults("NRL");
            var options = new Options();
            var result  = Parser.Default.ParseArguments <Options>(args)
                          .WithParsed(o => options.League = o.League)
                          .WithParsed(o => options.Output = o.Output)
                          .WithParsed(o => options.Round  = o.Round);

            if (!string.IsNullOrEmpty(options.Output) &&
                options.Output.Equals("ps"))
            {
                PastLeagueStats(
                    options.League,
                    context);
                return;
            }
            var round = 1;
//          var tipster = new TableTipster(context);
            var tipster = new NibbleTipster(context);

            if (string.IsNullOrEmpty(
                    options.League))
            {
                Console.WriteLine("=== NRL ==================================================");
                tipster.ShowTips(
                    "NRL",
                    context.NextRound("NRL"));
                Console.WriteLine();
                Console.WriteLine(
                    tipster.DumpRatings(
                        "NRL"));
                tipster.ClearRatings();
                Console.WriteLine("=== AFL ==================================================");
                tipster.ShowTips(
                    "AFL",
                    context.NextRound("AFL"));
                Console.WriteLine();
                Console.WriteLine(
                    tipster.DumpRatings(
                        "AFL"));
            }
            else
            {
                if (options.Round == 0)
                {
                    round = context.NextRound(
                        options.League);
                }
                else
                {
                    round = options.Round;
                }
                Console.WriteLine(
                    $"Command is TIP {options.League} Round {round}");
                tipster.ShowTips(
                    options.League,
                    round);
                Console.WriteLine();
                Console.WriteLine(
                    tipster.DumpRatings(
                        options.League));
            }
        }