Ejemplo n.º 1
0
        /// <summary>
        /// Move Expectation
        /// </summary>
        public static GameOutcome MoveExpectation(this TicTacToePosition position, int index)
        {
            if (position is null)
            {
                return(GameOutcome.Illegal);
            }

            if (position[index] != Mark.None)
            {
                return(GameOutcome.Illegal);
            }
            else if (index < 1 || index > 9)
            {
                return(GameOutcome.Illegal);
            }

            return(ExpectedWinner(position.MakeMove(index)));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Move Expectation
        /// </summary>
        public static GameOutcome MoveExpectation(this TicTacToePosition position, int line, int column)
        {
            if (position is null)
            {
                return(GameOutcome.Illegal);
            }

            if (position[line, column] != Mark.None)
            {
                return(GameOutcome.Illegal);
            }
            else if (line < 0 || line > 2 || column < 0 || column > 2)
            {
                return(GameOutcome.Illegal);
            }

            return(ExpectedWinner(position.MakeMove(line, column)));
        }