Пример #1
0
 public EloIndividualResult(EloPlayerIdentifier playerIdentifier, EloTeamIdentifier teamIdentifier, EloRating ratingBefore, EloRating ratingAfter)
 {
     PlayerIdentifier = playerIdentifier ?? throw new ArgumentNullException(nameof(playerIdentifier));
     TeamIdentifier   = teamIdentifier ?? throw new ArgumentNullException(nameof(teamIdentifier));
     RatingBefore     = ratingBefore;
     RatingAfter      = ratingAfter;
 }
Пример #2
0
        public EloIndividualResult GetResult(EloPlayerIdentifier playerIdentifier)
        {
            var result = _results.FirstOrDefault(x => x.PlayerIdentifier == playerIdentifier);

            if (result == null)
            {
                throw new InvalidOperationException($"No player found in results with identifier {playerIdentifier}");
            }

            return(result);
        }
Пример #3
0
 public int GetRatingAfter(EloPlayerIdentifier identifier)
 => GetResult(identifier).RatingAfter;
Пример #4
0
 public int GetRatingDifference(EloPlayerIdentifier identifier)
 => GetResult(identifier).RatingDifference;
Пример #5
0
 public EloPlayer(EloPlayerIdentifier identifier, int rating)
     : this(identifier, new EloRating(rating))
 {
 }
Пример #6
0
 public EloPlayer(EloPlayerIdentifier identifier, EloRating rating)
 {
     Identifier = identifier ?? throw new ArgumentNullException(nameof(identifier));
     Rating     = rating ?? throw new ArgumentNullException(nameof(rating));
 }