コード例 #1
0
        private bool GoalVerify(IKnowledge obj, EqGoal eqGoal, out string msg, out object output)
        {
            msg = AGTutorMessage.VerifyWrong;
            output = null;

            List<Tuple<object, object>> trace = null;

            var agPropExpr = new AGPropertyExpr(obj.Expr, eqGoal);
            agPropExpr.IsSelected = true;
            agPropExpr.GenerateSolvingTrace();
            trace = agPropExpr.AutoTrace;

            BehaviorGraphNode node;
            if (trace == null || trace.Count == 0)
            {
                node = UserGraph.UpdateSolvingCache(agPropExpr);
                //node = UserGraph.SearchInnerLoopNode(eqGoal);

                if (node == null)
                    return false;
            }
            if (trace != null)
            {
                bool matchResult = UserGraph.Match(trace);
                if (!matchResult) return false;
                //insert nodes
                UserGraph.Insert(trace);
                CurrentStateNode = UserGraph.SearchInnerLoopNode(obj); //update _currentStateNode;
            }
            else
            {
                CurrentStateNode = UserGraph.SearchInnerLoopNode(eqGoal); 
            }
           /* var nextTuple1 = UserGraph.SearchNextInnerLoopNode(CurrentStateNode);
            if (nextTuple1 == null) // query-end
            {
                msg = AGTutorMessage.SolvedProblem;
                return true;
            }
            */
            msg = AGTutorMessage.VerifyCorrect;
            return true;
        }