Example #1
0
        public void NewField() //Показывает сетку
        {
            CheckLuckyCombination checkWin     = new CheckLuckyCombination();
            NumberVision          numberVision = new NumberVision();

            horizontalLine(2, 0);
            horizontalLine(4, 0);
            verticalLine(1, 2);
            verticalLine(1, 4);
            numberVision.SymInField(1, 1);
            numberVision.SymInField(1, 3);
            numberVision.SymInField(1, 5);
        }
Example #2
0
        public void SymInField(int x, int y) //ввод цифр в сетку
        {
            NumberVision numberVision = new NumberVision();

            for (int i = x; i < x + 6; i += 2)
            {
                k++;
                Console.SetCursorPosition(i, y);
                Console.WriteLine(numPosition[k]);
            }
            if (k == 9)
            {
                k = 0;
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            CheckLuckyCombination checkWin  = new CheckLuckyCombination();
            FieldPaint            paint     = new FieldPaint();
            NumberVision          numVision = new NumberVision();

            numVision.StreamInArray();


            //Ввод данных игроков
            Console.WriteLine("Введите имя 1 игрока и нажмите Enter:");
            string firstPlayerName = Console.ReadLine();

            Console.WriteLine("Введите имя 2 игрока и нажмите Enter:");
            string secondPlayerName = Console.ReadLine();

            Console.Clear();
            int  count = 0;
            bool x     = false;
            bool y     = false;
            int  id    = 0;

            while (true)
            {
                paint.NewField();
                Console.WriteLine($"Ходит {firstPlayerName}, введите число ячейке");
                x = numVision.SwapNumAndChar('X');
                count++;
                Console.Clear();
                if (x == true)  //Выход при выигрыше
                {
                    id += 1;
                    break;
                }
                if (count == 9)
                {
                    break;             //выход если все клеточки заняты
                }
                paint.NewField();
                Console.WriteLine($"Ходит {secondPlayerName}, введите число ячейке");
                y = numVision.SwapNumAndChar('O');
                count++;
                Console.Clear();

                if (y == true) //Выход при выигрыше
                {
                    id += 2;
                    break;
                }
            }
            if (id == 1)
            {
                Console.WriteLine($"Поздравляем,  {firstPlayerName} выиграл!");
            }
            if (id == 2)
            {
                Console.WriteLine($"Поздравляем,  {secondPlayerName} выиграл!");
            }
            if (id == 0)
            {
                Console.WriteLine("Все проиграли");
            }
        }