示例#1
0
        public static IEnumerable <Runtime.ISolutionTreeNode> Solve (Compiled.Program program, out Tracer tracer, params AST.Goal [] goals)
        {
            var engine = new Runtime.Engine ();

            tracer = new Tracer();
            //engine.NewGoal += tracer.Engine_NewGoal;
            //engine.Unified += tracer.Engine_Unified;
            //engine.Failed  += tracer.Engine_Failed;

            return Compiler.Solve (engine, goals, program);
        }
示例#2
0
        public void TraceUnifiedTest()
        {
            var database = MakePathsDatabase();

            // ?- path (moscow, vladivostok).
            var goal = Helper.MakeGoal ("path", "moscow", "novosib");

            var engine = new Runtime.Engine ();

            var tracer = new Tracer();
            engine.Unified += tracer.Engine_Unified;
            Compiler.Solve (engine, new [] {goal}, database).Any();

            Assert.AreEqual (@"Unified: path(moscow, novosib)
Unified: path(moscow, novosib)
Unified:     road(X=moscow, Z=ekat)
Unified:     path(Z=ekat, Y=novosib)
Unified:     path(Z=ekat, Y=novosib)
Unified:         road(X=ekat, Z=vladivostok)
Unified:         path(Z=vladivostok, Y=novosib)
Unified:         path(Z=vladivostok, Y=novosib)
", tracer.Trace);
        }