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
        static void Main(string[] args)
        {
            IsConsoleCursorVisible();
            Music.InitMusic();
            Preview.InitPreview();
            Menu.InitMenu();

            Cursor.InitCursor();
            var decision = Cursor.ReturnMainMenuDecision();

            if (decision == MenuDecision.EXIT)
            {
                Exit();
            }

            if (decision == MenuDecision.PLAYER_VS_PLAYER)
            {
                ShowWhoseStep.WritePlayersName(true);
            }
            else
            {
                ShowWhoseStep.WritePlayersName(false);
            }

            while (true)
            {
                ShowCoordinatesOfCells.WriteTable();

                if (decision == MenuDecision.PLAYER_VS_PLAYER)
                {
                    Game.StartGame(GameMode.PLAYER_VS_PLAYER);
                }
                else if (decision == MenuDecision.PLAYER_VS_COMPUTER)
                {
                    Game.StartGame(GameMode.PLAYER_VS_COMPUTER);
                }

                ManuAfterGame.InitMenu();
                Cursor.InitCursor(true);
                var decision0 = Cursor.ReturnAfterGameDecision();
                if (decision0 == AfterGameDesicion.EXIT)
                {
                    break;
                }
            }

            Exit();
        }