public DepthLimitedUCTTreeNode(IGameMove move, DepthLimitedUCTTreeNode parent, IGameState state, int depth, int maxDepth, IStateBestMoveEstimator stateEstimator, double constant = 1.0)
     : base(move, parent, state, constant, false)
 {
     this.maxDepth       = maxDepth;
     this.depth          = depth;
     this.stateEstimator = stateEstimator;
     if (depth <= maxDepth)
     {
         untriedMoves = state.GetMoves();
     }
     else
     {
         untriedMoves = new List <IGameMove>();
         if (!state.isTerminal())
         {
             IGameMove estimatedMove = stateEstimator.EstimateMove(state);
             state.DoMove(estimatedMove);
             AddChild(estimatedMove, state);
         }
         else
         {
             ITreeNode node = this;
             while (node != null)
             {
                 node.Update(state.GetResult(node.PlayerWhoJustMoved));
                 node = node.Parent;
             }
         }
     }
 }
Example #2
0
 public DepthLimitedUCTTreeNodeCreator(int maxDepth, IStateBestMoveEstimator stateEstimator, double constant = 1.0)
 {
     this.constant       = constant;
     this.maxDepth       = maxDepth;
     this.stateEstimator = stateEstimator;
 }