Ejemplo n.º 1
0
 private void Visit(IComputerNode node, int searchDepth)
 {
     foreach (var child in node.Children)
     {
         this.Visit(child, searchDepth - 1);
     }
 }
Ejemplo n.º 2
0
 private void Visit(IComputerNode node, int searchDepth)
 {
     foreach (var child in node.Children)
     {
         this.Visit(child, searchDepth - 1);
     }
 }
        private double GetPositionEvaluation(IComputerNode computerNode, int depth, double probability)
        {
            this.searchStatistics.NodeCount++;

            var childrenCount = computerNode.ChildrenWith2.Count();

            var resultWith2 = computerNode.ChildrenWith2.Average(child =>
                                                                 this.GetPositionEvaluation(child, depth - 1, probability * ProbabilityOf2 / childrenCount));
            var resultWith4 = computerNode.ChildrenWith4.Average(child =>
                                                                 this.GetPositionEvaluation(child, depth - 1, probability * ProbabilityOf4 / childrenCount));

            var result = resultWith2 * ProbabilityOf2 + resultWith4 * ProbabilityOf4;

            return(result);
        }