コード例 #1
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);
        }
コード例 #2
0
        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)));
        }