Beispiel #1
0
        //Saisie des Alliés
        static List <Allie> InputAllie(string color)
        {
            /*Variables*/
            int          nbAllies; //Nombre d'Alliés
            int          ip;
            bool         correct = false;
            string       input;
            Allie        allie;
            List <Allie> allies = new List <Allie>();

            /*Début*/
            do
            {
                Console.Clear();
                Console.WriteLine("Nombre d'Alliés {0}?", color);
                input = Console.ReadLine();

                if (int.TryParse(input, out nbAllies))
                {
                    correct = true;
                }
            } while (!correct);

            for (int i = 0; i < nbAllies; i++)
            {
                ip    = InputInfluence(i);
                allie = new Allie(color, ip);
                allies.Add(allie);
            }

            return(allies);
            /*Fin*/
        }
Beispiel #2
0
        /*Récupération des max de chaque communauté*/
        public Allie MaxAllie(List <Allie> listAllies)
        {
            Allie allieMax;

            if (listAllies.Count > 0)
            {
                allieMax = new Allie(listAllies[0].color, listAllies[0].ip);
                for (int i = 0; i < listAllies.Count; i++)
                {
                    if (listAllies[i].ip > allieMax.ip)
                    {
                        allieMax = new Allie(listAllies[i].color, listAllies[i].ip);
                    }
                }
            }
            else
            {
                allieMax = new Allie();
            }

            return(allieMax);
        }