public static object CallResult(ICallable callable, object value, int maxtime, double exitscore)
        {
            QueueArena arena = new QueueArena();
            BestContinuation getbest = new BestContinuation();
            LastFailure getlast = new LastFailure();

            arena.Call(callable, 100.0, value, getbest.GetContinue(), getlast.GetFail());

            while (maxtime > 0 && getbest.Salience <= exitscore && !arena.IsEmpty)
                maxtime -= arena.EvaluateOne();

            if (getbest.Value == null && getlast.Reason != null)
                return new Exception(getlast.Reason);

            return getbest.Value;
        }
Beispiel #2
0
        public static object CallResult(ICallable callable, object value, int maxtime, double exitscore)
        {
            QueueArena       arena   = new QueueArena();
            BestContinuation getbest = new BestContinuation();
            LastFailure      getlast = new LastFailure();

            arena.Call(callable, 100.0, value, getbest.GetContinue(), getlast.GetFail());

            while (getbest.Salience <= exitscore && !arena.IsEmpty)
            {
                arena.EvaluateOne();
            }

            if (getbest.Value == null && getlast.Reason != null)
            {
                return(new Exception(getlast.Reason));
            }

            return(getbest.Value);
        }