Exemplo n.º 1
0
 private DecisionTree(DecisionTree parent, ChessBoard board, ChessMove move)
 {
     UvsChess.Framework.Profiler.AddToMainProfile((int)ProfilerMethodKey.DecisionTree_ctor_DecisionTree_ChessBoard_ChessMove);
     Children = new List<DecisionTree>();
     Parent = parent;
     Board = board;
     Move = move;
     BestChildMove = null;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Create a DecisionTree exactly like this one.
        /// </summary>
        /// <param name="parent">The parent decision</param>
        /// <returns>The cloned decision tree</returns>
        public DecisionTree Clone(DecisionTree parent)
        {
            UvsChess.Framework.Profiler.AddToMainProfile((int)ProfilerMethodKey.DecisionTree_Clone_DecisionTree);
            DecisionTree retVal = null;

            if (parent == null)
            {
                retVal = new DecisionTree(this.Board);
            }
            else
            {
                retVal = new DecisionTree(parent, this.Board, this.Move);
            }

            retVal.EventualMoveValue = this.EventualMoveValue;
            retVal.BestChildMove     = this.BestChildMove;

            foreach (DecisionTree curChild in this.Children)
            {
                retVal.Children.Add(curChild.Clone(this));
            }

            return(retVal);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create a DecisionTree exactly like this one.
        /// </summary>
        /// <param name="parent">The parent decision</param>
        /// <returns>The cloned decision tree</returns>
        public DecisionTree Clone(DecisionTree parent)
        {
            UvsChess.Framework.Profiler.AddToMainProfile((int)ProfilerMethodKey.DecisionTree_Clone_DecisionTree);
            DecisionTree retVal = null;

            if (parent == null)
            {
                retVal = new DecisionTree(this.Board);
            }
            else
            {
                retVal = new DecisionTree(parent, this.Board, this.Move);
            }

            retVal.EventualMoveValue = this.EventualMoveValue;
            retVal.BestChildMove = this.BestChildMove;

            foreach (DecisionTree curChild in this.Children)
            {
                retVal.Children.Add(curChild.Clone(this));
            }

            return retVal;
        }