Exemple #1
0
        public override async ValueTask Process(MatchesContext matchesContext)
        {
            IAsyncEnumerable <(Match Match, int SR)> matches = matchesContext.GetMatchesByOutcomeAsync(Role, Outcome);
            IAsyncEnumerable <int> srs = Change
                ? matches.Where(result => result.SR != 0).Select(result => Math.Abs(result.SR))
                : matches.Select(result => result.Match.SR);

            double average = await srs.DefaultIfEmpty().AverageAsync();

            Console.WriteLine(average == 0d
                ? $"No or not enough historic SR data for outcome '{Outcome}'."
                : $"Average historic SR for outcome '{Outcome}': {average:0}");
        }
Exemple #2
0
        public override async ValueTask Process(MatchesContext matchesContext)
        {
            List <Match> total = await matchesContext.GetMatchesByRoleAsync(Role).ToListAsync();

            IAsyncEnumerable <(Match Match, int Change)> wins = matchesContext.GetMatchesByOutcomeAsync(total.ToAsyncEnumerable(), Outcome.Win);

            double sumWins = await wins.CountAsync();

            double sumTotal = total.Count;

            double winRate           = sumWins / sumTotal;
            double percentageWinRate = winRate * 100d;

            Console.WriteLine($"Winrate for {Role} is: {percentageWinRate:0.00}%");
        }