Esempio n. 1
0
        public static void Main(string[] args)
        {
            String[]       NAMES = { "Пешка", "Конь", "Слон", "Ладья", "Ферзь" };
            Chess_figure[] MAS   = new Chess_figure[10];

            for (int i = 0; i < 10; i++)
            {
                MAS[i] = new Chess_figure();
                switch (i % 5)
                {
                case 0: { MAS[i].Init(1, NAMES[i % 5]); }; break;

                case 1: { MAS[i].Init(3, NAMES[i % 5]); }; break;

                case 2: { MAS[i].Init(3, NAMES[i % 5]); }; break;

                case 3: { MAS[i].Init(5, NAMES[i % 5]); }; break;

                case 4: { MAS[i].Init(9, NAMES[i % 5]); }; break;
                }
            }

            Chess_Player Andrey = new Chess_Player();
            Chess_Player Magnus = new Chess_Player();

            Magnus.playerInit("Magnus", 10, MAS, 1);
            Andrey.playerRead();

            Andrey.playerDisplay();
            Console.Clear();
            Console.ReadKey();
            Magnus.playerDisplay();
            Andrey.playerCompare(Magnus);
        }
Esempio n. 2
0
        public void playerRead()
        {
            Console.WriteLine("Введите имя игрока");
            PlayerName = Console.ReadLine();


            Console.WriteLine("Введите разряд");
            rank = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Введите колличество фигур");
            numbers = Convert.ToInt32(Console.ReadLine());

            for (int i = 0; i < numbers; i++)
            {
                figures[i] = new Chess_figure();
                Console.WriteLine("\tВыберите фигуру\nОсталось выбрать: {0}\n", numbers - i);
                figures[i].Read();
            }
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            String[]       NAMES = { "Пешка", "Конь", "Слон", "Ладья", "Ферзь" };
            Chess_figure[] MAS   = new Chess_figure[10];

            for (int i = 0; i < 10; i++)
            {
                MAS[i] = new Chess_figure();
                switch (i % 5)
                {
                case 0: { MAS[i].Init(1, NAMES[i % 5]); }; break;

                case 1: { MAS[i].Init(3, NAMES[i % 5]); }; break;

                case 2: { MAS[i].Init(3, NAMES[i % 5]); }; break;

                case 3: { MAS[i].Init(5, NAMES[i % 5]); }; break;

                case 4: { MAS[i].Init(9, NAMES[i % 5]); }; break;
                }
            }



            int N = 10;

            for (int i = 0; i < N; i++)
            {
                MAS[i].Display();
            }



            for (int i = 0; i < N; i++)
            {
                String a = MAS[i].Name;

                for (int j = i + 1; j < N + 1; j++)
                {
                    String b = MAS[j].Name;
                    if (String.Compare(a, b) == 0)
                    {
                        for (int z = j; z < N - 1; z++)
                        {
                            MAS[z] = MAS[z + 1];
                        }
                        N -= 1;
                    }
                }
            }

            Console.WriteLine("\n\nМассив после обработки\n\n");
            for (int i = 0; i < N; i++)
            {
                MAS[i].Display();
            }



            Chess_figure fig1 = new Chess_figure();

            fig1.Init(3, "Slon");
            Chess_figure fig2 = new Chess_figure();

            fig2.Init(3, "Queen");


            String str;

            //Параметр не инициолизирован
            fig1.getNameout(out str);
            Console.WriteLine(str);

            //Параметр инициолизирован
            fig2.getNameref(ref str);
            Console.WriteLine(str);



            Chess_Player Magnus = new Chess_Player();

            Magnus.playerInit("Magnus", 10, MAS, 1);
        }