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; }
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); }
public int GetRatingAfter(EloPlayerIdentifier identifier) => GetResult(identifier).RatingAfter;
public int GetRatingDifference(EloPlayerIdentifier identifier) => GetResult(identifier).RatingDifference;
public EloPlayer(EloPlayerIdentifier identifier, int rating) : this(identifier, new EloRating(rating)) { }
public EloPlayer(EloPlayerIdentifier identifier, EloRating rating) { Identifier = identifier ?? throw new ArgumentNullException(nameof(identifier)); Rating = rating ?? throw new ArgumentNullException(nameof(rating)); }