예제 #1
0
        public char?[,] OtherHardMoves()
        {
            var moveGenerator = new MoveChecker(GameState);

            if (moveGenerator.IsChanceToWin(GameState, 'O', 'X'))
            {
                int[] finalMovePosition = moveGenerator.FinalMovePosition();
                GameState[finalMovePosition[0], finalMovePosition[1]] = 'O';
            }
            else if (moveGenerator.IsDefendNeeded() && moveGenerator.IsChanceToWin(GameState, 'X', 'O'))
            {
                int[] dangerPosition = moveGenerator.DangerPosition();
                GameState[dangerPosition[0], dangerPosition[1]] = 'O';
            }
            else if (moveGenerator.PerspectiveMovePosition() != null)
            {
                GameState[moveGenerator.PerspectiveCoordinates[0], moveGenerator.PerspectiveCoordinates[1]] = 'O';
            }
            else //random move
            {
                return(EasyModeLogic.EasyModeMove(GameState));
            }
            return(GameState);
        }