Пример #1
0
        /// <summary>
        /// Gets all potential moves of the specified game board for the current player, in the form of a
        /// List of GameBoards where each board has one of the moves performed.
        /// </summary>
        /// <param name="board">The GameBoard whose children should be generated.</param>
        /// <returns>Returns a List of GameBoards, each representing possible states that the specified GameBoard could reach.</returns>
        public static List <GameBoard> GenerateChildren(GameBoard board)
        {
            List <GameBoard> children = new List <GameBoard>();

            Utility.ActOnMatrix((i, j) =>
            {
                if (board.MoveMatrix[i, j] == 'N')
                {
                    GameBoard copy = board.Duplicate();
                    copy.Mark(j, i);
                    children.Add(copy);
                }
            });

            return(children);
        }