Beispiel #1
0
        /*
         * Метод, где происходит сам процесс игры
         */
        public static void StartGame(GameMode mode)
        {
            Console.Clear();

            ShowCoordinatesOfCells.WriteTable();

            Table.InitField(mode);
            Table.WriteTable();
            (int x, int y)stepCoordinates = (-1, -1);

            PlayersCodes winner = CheckWinLine();

            while ((winner == PlayersCodes.NULL) && HaveEmptyField())
            {
                var isContinue = CheckWinLine();
                if (isContinue == PlayersCodes.NULL)
                {
                    ChangeStep();
                }
                else
                {
                    break;
                }

                stepCoordinates = MakeSteps(stepCoordinates, mode);

                //stepCoordinates = ConvertStep(step);
                Table.InsertValue(stepCoordinates.x, stepCoordinates.y, isUsersStep);
                Table.WriteTable();

                winner = CheckWinLine();
            }

            FinishGame(winner);
        }
Beispiel #2
0
 /*
  * Заполнение поля в соответствии с ходами
  */
 public static bool InsertValue(int x, int y, PlayersCodes isUser)
 {
     if (field[x, y] != PlayersCodes.NULL)
     {
         return(false);
     }
     else
     {
         field[x, y] = isUser;
     }
     return(true);
 }