コード例 #1
0
        private PlayerRankingRow[] GetRankingResults(IPlayerRankingCalculator calculator)
        {
            var results = calculator.DetermineRanking(_service.Records()).ToArray();

            return(results.OrderByDescending(z => z.Score)
                   .Select(z => new PlayerRankingRow()
            {
                Name = z.Player.Name,
                Score = z.Score
            }).ToArray());
        }
コード例 #2
0
        public double[] GetScoringByPlayer(Player player)
        {
            var history = new List <double>();

            for (int i = 0; i < _records.Games.Count; i++)
            {
                var subsetOfGames = new Records()
                {
                    Games = _records.Games.Take(i).ToList()
                };
                if (subsetOfGames.Games.Any(z => z.IsPlayer(player)))
                {
                    var currentRanking = _algorithm.DetermineRanking(subsetOfGames).FirstOrDefault(z => z.Player == player);
                    if (currentRanking != null && (history.Any() == false || Math.Abs(history.Last() - currentRanking.Score) > 0.01))
                    {
                        history.Add(currentRanking.Score);
                    }
                }
            }
            return(history.ToArray());
        }