Пример #1
0
        public void AddScore(IPlayer playerWithScore)
        {
            if (this.playersWithScore.Count < 5)
            {
                this.playersWithScore.Add(playerWithScore);
            }
            else if (this.playersWithScore.Count >= 5)
            {
                if (this.playersWithScore[4].GetScore() < playerWithScore.GetScore())
                {
                    this.playersWithScore.Remove(this.playersWithScore[4]);
                    this.playersWithScore.Add(playerWithScore);
                }
            }

            this.playersWithScore = this.playersWithScore.OrderBy(p => p.GetScore()).ToList();
        }