示例#1
0
        //Алгоритм определяет за кого проголосовало больше всего игроков
        public List <Player> ToSurvive(List <Player> Players)
        {
            List <Player> tosurvive = new List <Player>();
            int           current   = 0;
            int           max       = 0;

            foreach (var player in Players)
            {
                current = player.Vote;
                if (current > max)
                {
                    max = current;
                    tosurvive.Clear();
                    tosurvive.Add(player);
                }
                else if (current == max)
                {
                    tosurvive.Add(player);
                }
            }

            GameIn?.Invoke($"Максимальное количество голосов: {max}.");
            return(tosurvive);
        }