// makes copy of searched
 public ActionConversion(ActionEnvironment actenv, IArgumentType resultType, Dictionary<IAction, int> searched, Aborter aborter)
 {
     this.actenv = actenv;
     this.resultType = resultType;
     this.searched = new Dictionary<IAction, int>(searched);
     this.aborter = aborter;
 }
Example #2
0
        public static Aborter NewAborter(int maxlevel)
        {
            Aborter common = new Aborter(maxlevel);
            Aborter child = new Aborter(common);
            child.level = 1;

            return child;
        }
        // faillet: Look for ways to get to these inputs, to get that result type
        public bool RecurseConversionAttempt(IArena arena, double salience, string reason, IContinuation skip, params object[] args)
        {
            // params: object value, IEnumerable<IAction> actions, IContinuation succ
            if (aborter.IsAborted)
                return true;   // abort!

            // Can we go down another level?
            Aborter next = new Aborter(aborter);
            if (next.IsAborted)
                return true;

            object value = args[0];
            IEnumerable<IAction> actions = (IEnumerable<IAction>)args[1];
            IContinuation succ = (IContinuation)args[2];

            foreach (IAction action in actions)
                arena.Call(new ActionConversion(actenv, action.Input, searched, next), salience * .9, value,
                    new CallableAsContinuation(action, succ), new NopCallable());

            return true;
        }
Example #4
0
 protected Aborter(int maxlevel)
 {
     this.level = maxlevel;
     this.common = this;
 }
Example #5
0
 public Aborter(Aborter parent)
 {
     this.level = parent.level + 1;
     this.common = parent.common;
 }