private void UpdatePlayerRatingsCore() { if (Games.Any()) { Players.ForEach(player => player.Rating = Constants.BaseRating); (double WinnerUpdatedRating, double LoserUpdatedRating)updatedRatings; var ratingCalculator = new RatingCalculator(kFactor: 100, baseRating: Constants.BaseRating); foreach (Game game in Games) { updatedRatings = ratingCalculator.GetNewRatings(game.WasAStalemate, game.Winner.Rating, game.Loser.Rating); Players.First(player => player.RankOnLoad == game.Winner.RankOnLoad).Rating = updatedRatings.WinnerUpdatedRating; Players.First(player => player.RankOnLoad == game.Loser.RankOnLoad).Rating = updatedRatings.LoserUpdatedRating; } } else { foreach (Player player in Players) { player.Rating = Constants.BaseRating; } } Players = Players.OrderByDescending(player => player.Rating).ThenBy(player => player.FirstName).ToList(); for (int i = 0; i < Players.Count; i++) { Players[i].CurrentRank = i + 1; } }