Ejemplo n.º 1
0
        static ListPlayer CreatePlayers(int nb_pl)
        {
            Console.WriteLine("Enter the name of player 0");
            string     name = Console.ReadLine();
            Player     p    = new Player(name);
            ListPlayer LiPl = new ListPlayer(p);

            Console.WriteLine(p);
            for (int i = 1; i < nb_pl; i++)
            {
                Console.WriteLine("Enter the name of player " + i);
                name = Console.ReadLine();
                p    = new Player(name);
                LiPl.AddTail(p);
                Console.WriteLine(p);
            }
            Console.WriteLine("Enter the position of the player who will be banker : ");
            int pos = Convert.ToInt32(Console.ReadLine());

            while (pos < 0 || pos >= nb_pl)
            {
                Console.WriteLine("Please enter a correct value ");
                Console.WriteLine("The position should be between 0 and " + (nb_pl - 1));
                pos = Convert.ToInt32(Console.ReadLine());
            }

            Banker ban = Banker.GetInstance(LiPl.getPlayer(pos));

            LiPl.getPlayer(nb_pl - 1).next = LiPl.getPlayer(0);
            return(LiPl);
        }