private static void CreatePrologKBAFromFileAndQuery()
        {
            // fixme: KnowledgeBase wants a reference to a game object. This is because GameObjects can form a tree of knowledge bases.
            // But I don't need this. Ideally we'd refactor prolog so that there is a lower abstract level that makes no reference to Unity classes.
            // Alternatively, a KB could be created on the Unity side and passed into the CSA.
            KnowledgeBase kb = new KnowledgeBase("Global", null);

            kb.Consult("PrologTest.prolog");
            var query = ISOPrologReader.Read("mortal(socratese).");

            if (kb.IsTrue(query))
            {
                Console.WriteLine("Socratese is mortal.");
            }
            else
            {
                Console.WriteLine("Something is wrong with logic!");
            }
        }
Exemplo n.º 2
0
 protected void Init(string kbPath, string kbName)
 {
     myKB = new KnowledgeBase(kbName, gameObject);
     myKB.Consult(kbPath);
     myKB.IsTrue(new ISOPrologReader("init.").ReadTerm(), this);
 }
Exemplo n.º 3
0
 public void LateUpdate()
 {
     myKB.IsTrue(new ISOPrologReader("go_on.").ReadTerm(), this);
 }
 public static bool IsTrueParsed(this KnowledgeBase kb, string query)
 {
     return(kb.IsTrue(ISOPrologReader.Read(query)));
 }