Exemple #1
0
        public bool EvaluateORNode(ORNode node, ADTreeContext context)
        {
            bool l = node.LeftChild.Accept(this, context);
            bool r = node.RightChild.Accept(this, context);

            return(l || r);
        }
Exemple #2
0
        public int EvaluateORNode(ORNode node, ADTreeContext context)
        {
            int a = node.LeftChild.Accept(this, context) + node.Cost;
            int b = node.RightChild.Accept(this, context) + node.Cost;

            return(a > b ? b : a);
        }
Exemple #3
0
 public int GetValue(IADTreeNode node, IEvaluateVisitor <int> v, ADTreeContext context)
 {
     if (node.Left == null && node.Right == null)
     {
         return(node.Duration);
     }
     return(node.DurationProvider.GetDuration(v.GetValue(node.Left, v, context), v.GetValue(node.Right, v, context)) + node.Duration);
 }
Exemple #4
0
        public bool EvaluateLeaf(Leaf node, ADTreeContext context)
        {
            bool?amiok = context.GetNodeOutcome(node.Name);

            if (amiok == null)
            {
                Random random = new Random();
                amiok = random.NextDouble() > 0.5;
            }
            return((bool)amiok);
        }
        public bool GetValue(IADTreeNode node, IEvaluateVisitor <bool> v, ADTreeContext context)
        {
            Random rnd = new Random();

            if (node.Left == null && node.Right == null)
            {
                bool?nb = context.GetNodeOutcome(node.Name);
                return((nb.HasValue) ? nb.Value : Convert.ToBoolean(rnd.Next(1)));
            }

            return(node.StatusProvier.GetStatus(v.GetValue(node.Left, v, context), v.GetValue(node.Right, v, context)));
        }
Exemple #6
0
 public int GetValue(IADTreeNode node, IVisitor <int> visitor, ADTreeContext context)
 {
     return(node.Accept(this, context));
 }
Exemple #7
0
 public int EvaluateLeaf(Leaf node, ADTreeContext context)
 {
     return(node.Cost);
 }
Exemple #8
0
 public int EvaluateANDNode(ANDNode node, ADTreeContext context)
 {
     return(node.LeftChild.Accept(this, context) + node.RightChild.Accept(this, context) + node.Cost);
 }
 public override T Accept <T>(Visitor.IVisitor <T> visitor, ADTreeContext context)
 {
     return(visitor.EvaluateLeaf(this, context));
 }
 public int EvaluateLeaf(Leaf node, ADTreeContext context)
 {
     return(node.Duration);
 }