Example #1
0
        /// <summary>
        /// Mutate a conditional by changing its functor. TODO: right now the condition expression is simply replaced. in the future, actually modify it.
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public Node Mutate(Conditional c)
        {
            var e = c.Condition;
            //TODO: actually mutate
            var newC = CreateConditional();

            newC.Success = c.Success;
            newC.Failure = c.Failure;
            return(newC);
        }
Example #2
0
        /// <summary>
        /// Creates a random node
        /// </summary>
        /// <returns></returns>
        public Node CreateNode()
        {
            Node n;

            if (Random.Next(100) < NewActionChance)
            {
                n = new Action(CreateActionParameters());
            }
            else
            {
                n = new Conditional(CreateConditionParameters());
            }
            return(n);
        }
Example #3
0
        public override object Clone()
        {
            var n = new Conditional(Condition);

            if (Success != null)
            {
                n.Success = Success.Clone() as Node;
            }
            if (Failure != null)
            {
                n.Failure = Failure.Clone() as Node;
            }
            return(n);
        }
Example #4
0
 public override object Clone()
 {
     var n = new Conditional(Condition);
     if (Success != null)
         n.Success = Success.Clone() as Node;
     if (Failure != null)
         n.Failure = Failure.Clone() as Node;
     return n;
 }
Example #5
0
 /// <summary>
 /// Mutate a conditional by changing its functor. TODO: right now the condition expression is simply replaced. in the future, actually modify it.
 /// </summary>
 /// <param name="c"></param>
 /// <returns></returns>
 public Node Mutate(Conditional c)
 {
     var e = c.Condition;
     //TODO: actually mutate
     var newC = CreateConditional();
     newC.Success = c.Success;
     newC.Failure = c.Failure;
     return newC;
 }
Example #6
0
 /// <summary>
 /// Creates a random node
 /// </summary>
 /// <returns></returns>
 public Node CreateNode()
 {
     Node n;
     if (Random.Next(100) < NewActionChance)
     {
         n = new Action(CreateActionParameters());
     }
     else
     {
         n = new Conditional(CreateConditionParameters());
     }
     return n;
 }