示例#1
0
        static void Main(string[] args)
        {
            //Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"the_PATH_to_boot32.prc");  // or boot64.prc
            if (!PlEngine.IsInitialized)
            {
                String[] param = { "-q" };  // suppressing informational and banner messages
                PlEngine.Initialize(param);
                PlQuery.PlCall("assert(father(martin, inka))");
                PlQuery.PlCall("assert(father(uwe, gloria))");
                PlQuery.PlCall("assert(father(uwe, melanie))");
                PlQuery.PlCall("assert(father(uwe, ayala))");
                using (var q = new PlQuery("father(P, C), atomic_list_concat([P,' is_father_of ',C], L)"))
                {
                    foreach (PlQueryVariables v in q.SolutionVariables)
                    {
                        Console.WriteLine(v["L"].ToString());
                    }

                    Console.WriteLine("all children from uwe:");
                    q.Variables["P"].Unify("uwe");
                    foreach (PlQueryVariables v in q.SolutionVariables)
                    {
                        Console.WriteLine(v["C"].ToString());
                    }
                }
                PlEngine.PlCleanup();
                Console.WriteLine("finshed!");
            }
        }
示例#2
0
        private void FormNBA_FormClosing(object sender, FormClosingEventArgs e)
        {
            PlQuery zatvoriDatoteku = new PlQuery("zatvoriDatoteku");

            zatvoriDatoteku.NextSolution();
            PlEngine.PlCleanup();
        }
示例#3
0
        public static void Ex3()
        {
            if (!PlEngine.IsInitialized)
            {
                String[] param = { "-q" };  // suppressing informational and banner messages
                PlEngine.Initialize(param);

                // Test 1
                //PlQuery.PlCall("assert(father(martin, inka))");
                //Console.WriteLine(PlQuery.PlCall("father(martin, inkal)"));

                Del myComp = DoStuff;
                PlEngine.RegisterForeign(null, "mmm", 5, myComp);

                Console.WriteLine(PlQuery.PlCall("mmm(3, 6, 9, X, Y)"));


                using (PlQuery q = new PlQuery("mmm(3, 6, 9, X, Y)"))
                {
                    foreach (PlQueryVariables v in q.SolutionVariables)
                    {
                        Console.WriteLine(v["X"].ToString());
                        Console.WriteLine(v["Y"].ToString());
                    }
                }

                PlEngine.PlCleanup();
            }
        }
示例#4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (!System.IO.Directory.Exists("C:\\Program Files (x86)\\swipl\\") && !System.IO.Directory.Exists("C:\\Program Files\\swipl\\"))
            {
                MessageBox.Show("Prolog chưa được cài đăt hoặc vị trí sai, vui lòng cài đặt Prolog 6.6.5 vào vị trí mặc định trên ổ C và chọn lại đường dẫn đến thư mục swipl cài đặt Prolog, nếu không chương trình không thể chạy!");
                FolderBrowserDialog path = new FolderBrowserDialog();
                path.ShowDialog();
                String FolderPath = path.SelectedPath;
                Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"" + FolderPath);
            }
            else if (System.IO.Directory.Exists("C:\\Program Files (x86)\\swipl\\"))
            {
                Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files (x86)\swipl");
            }
            else if (System.IO.Directory.Exists("C:\\Program Files\\swipl\\"))
            {
                Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files\swipl");
            }


            if (!PlEngine.IsInitialized)
            {
                String[] empty_param = { "" };
                PlEngine.Initialize(empty_param);
                Application.Run(new frm_Main());
                PlEngine.PlCleanup();
            }
        }
示例#5
0
 private void Juego_Load(object sender, EventArgs e)
 {
     PlEngine.PlCleanup();
     Environment.SetEnvironmentVariable("Path", @"C:\\Program Files (x86)\\swipl\\bin");
     string[] p = { "-q", "-f", @"Prolog\\matriz.pl" };
     PlEngine.Initialize(p);
 }
示例#6
0
        private void formBD_FormClosing(object sender, FormClosingEventArgs e)
        {
            PlQuery q = new PlQuery("salva");

            q.NextSolution();
            PlEngine.PlCleanup();
        }
示例#7
0
 private void Home_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (PlEngine.IsInitialized)
     {
         PlEngine.PlCleanup();
     }
 }//////
        private void button1_Click(object sender, EventArgs e)  // cai dat nut start trong form
        {
            if (Checkload == false)
            {
                MessageBox.Show("Phai load file truoc", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            string s     = "C:/Users/Hasegawa/Documents/Visual Studio 2015/Projects/pplt/pplt/sourceimgandprologcode/" + tenfilepl;
            string query = "consult('" + s + "')";

            string[] p = { "-q", "-f", query };
            PlEngine.Initialize(p);
            PlQuery q = new PlQuery(query);

            Assert.IsTrue(q.NextSolution());
            using (var a = new PlQuery(querytextbox))
            {
                int i = 0;
                foreach (var sol in a.SolutionVariables)
                {
                    if (i % 2 == 0)
                    {
                        resultquery.Add(sol["P"].ToString());
                    }
                    i++;
                    if (i > Max)
                    {
                        break;
                    }
                }
                PlEngine.PlCleanup();
            }

            textBox1.Text = "List Thu " + index + " la P= " + resultquery[index];
        }
示例#9
0
        static void Main(string[] args)
        {
            // ------------
            // przyklad z instrukcji do wrappera SwiPlCs :

            //Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\swipl\bin");
            if (PlEngine.IsInitialized)
            {
                return;
            }
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            PlEngine.Initialize(param);
            PlQuery.PlCall("assert(father(martin, inka))");
            PlQuery.PlCall("assert(father(uwe, gloria))");
            PlQuery.PlCall("assert(father(uwe, melanie))");
            PlQuery.PlCall("assert(father(uwe, ayala))");
            using (var q = new PlQuery("father(P, C), atomic_list_concat([P,' is_father_of ',C], L)"))
            {
                foreach (var v in q.SolutionVariables)
                {
                    Console.WriteLine(v["L"].ToString());
                }

                Console.WriteLine("all child's from uwe:");
                q.Variables["P"].Unify("uwe");
                foreach (var v in q.SolutionVariables)
                {
                    Console.WriteLine(v["C"].ToString());
                }
            }
            PlEngine.PlCleanup();
            Console.WriteLine("finshed!");
        }
示例#10
0
        private void button2_Click(object sender, EventArgs e)
        {
            puntos[click] = 0;
            click--;

            if (click == 0)
            {
                btn_atras.Enabled     = false;
                btn_siguiente.Enabled = true;
                btn_finalizar.Enabled = false;
                click         = 0;
                puntos[click] = 0;
            }
            else if (click == 5)
            {
                btn_atras.Enabled     = true;
                btn_siguiente.Enabled = false;
                btn_finalizar.Enabled = true;
                click = 5;
            }
            else
            {
                btn_atras.Enabled     = true;
                btn_siguiente.Enabled = true;
                btn_finalizar.Enabled = false;
            }



            switch (click)
            {
            case 0:
                cargarPreguntas("sistemas");

                break;

            case 1:

                cargarPreguntas("administracion");
                break;

            case 2:
                cargarPreguntas("gastronomia");
                break;

            case 3:
                cargarPreguntas("civil");
                break;

            case 4:
                cargarPreguntas("medicina");
                break;

            case 5:
                cargarPreguntas("arqueologia");
                break;
            }
            PlEngine.PlCleanup();
        }
示例#11
0
 private void exitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (PlEngine.IsInitialized)
     {
         PlEngine.PlCleanup();
     }
     Application.Exit();
 }
示例#12
0
        public void Decide()
        {
            if (!PlEngine.IsInitialized)
            {
                string[] param = { "-q" };
                PlEngine.Initialize(param);
                PlQuery.PlCall("consult('HutBuiAct')");
                PlQuery.PlCall("assert(done(" + this.action + "))");
                PlQuery.PlCall("assert(in(" + this.InnerPosition.X + "," + this.InnerPosition.Y + "))");
                PlQuery.PlCall("assert(facing(" + this.a + "))");
                PlQuery.PlCall("assert(timePassed(" + this.timePassed + "))");
                PlQuery.PlCall("assert(leftmoves(" + this.leftmoves + "))");

                Console.WriteLine("assert(done(" + this.action + "))");
                Console.WriteLine("assert(in(" + this.InnerPosition.X + "," + this.InnerPosition.Y + "))");
                Console.WriteLine("assert(facing(" + this.a + "))");
                Console.WriteLine("assert(timePassed(" + this.timePassed + "))");
                Console.WriteLine("assert(leftmoves(" + this.leftmoves + "))");
                if (this.isDirty())
                {
                    PlQuery.PlCall("assert(dirty(" + this.InnerPosition.X + "," + this.InnerPosition.Y + "))");
                    Console.WriteLine("assert(dirty(" + this.InnerPosition.X + "," + this.InnerPosition.Y + "))");
                }
                for (int i = 0; i < 4; i++)
                {
                    string OsbtacleType = this.TypeOfObstacle(this.upFront());
                    if (OsbtacleType != null)
                    {
                        Point upfront = this.Outer2Inner(this.upFront());
                        Console.WriteLine("assert(obstacle(" + upfront.X + "," + upfront.Y + ",both))");
                        Console.WriteLine("assert(obstacle(" + upfront.X + "," + upfront.Y + "," + OsbtacleType + "))");
                        PlQuery.PlCall("assert(obstacle(" + upfront.X + "," + upfront.Y + ",both))");
                        PlQuery.PlCall("assert(obstacle(" + upfront.X + "," + upfront.Y + "," + OsbtacleType + "))");
                    }
                    this.Turn90();
                }
                foreach (Point w in this.weight.Keys)
                {
                    if (double.IsPositiveInfinity(this.weight[w]))
                    {
                        PlQuery.PlCall("assert(wasweight(" + w.X + "," + w.Y + ",inf))");
                        Console.WriteLine("assert(wasweight(" + w.X + "," + w.Y + ",inf))");
                    }
                    else
                    {
                        PlQuery.PlCall("assert(wasweight(" + w.X + "," + w.Y + "," + this.weight[w] + "))");
                        Console.WriteLine("assert(wasweight(" + w.X + "," + w.Y + "," + this.weight[w] + "))");
                    }
                }
                using (var q = new PlQuery("do(A)"))
                {
                    PlQueryVariables v = q.SolutionVariables.ElementAt(0);
                    this.action = v["A"].ToString();
                    Console.WriteLine("do(" + this.action + ")");
                }
                PlEngine.PlCleanup();
            }
        }
示例#13
0
        public void MT_3()
        {
            System.Diagnostics.Trace.WriteLine("MT3:" + System.Threading.Thread.CurrentThread.ManagedThreadId);
            PlEngine.Initialize(empty_param);
            PlTerm t = PlTerm.PlVar();

            Assert.AreEqual(PlType.PlVariable, t.PlType, "type enum");
            PlEngine.PlCleanup();
        }
示例#14
0
 protected override void OnFormClosing(FormClosingEventArgs e)
 {
     PlEngine.PlCleanup();
     base.OnFormClosing(e);
     if (e.CloseReason == CloseReason.WindowsShutDown)
     {
         return;
     }
 }
示例#15
0
        static void Main()
        {
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            PlEngine.Initialize(param);

            const string filename = "./test1.txt";

            AdeSystem.Initialize(param);
            string text = System.IO.File.ReadAllText(filename);

            AdeSystem.LoadDomain(text);
            AdeSystem.ConstructSystemDomain();
            AdeSystem.ParseQuery("possibly involved hador in chown by hador");
            AdeSystem.ParseQuery("possibly involved h in chown, shoot by epsilon, epsilon");
            //Parsowanie wyrazenia logicznego - w literals sa fluenty, a drzewo wyrazenia w logicTree
            List <Token>  literals;
            List <string> literalValues;
            //var expr = "(A|!B)&C";
            var      expr           = "!A";
            BoolExpr logicTree      = LogicFormulaParser.Parse(expr, out literals, out literalValues);
            var      dict           = literals.ToDictionary(i => i.Value, i => i.Value == "A" || i.Value == "B");
            var      b              = LogicFormulaParser.Eval(logicTree, dict);
            var      simplifiedTree = LogicFormulaParser.AndOrReformTree(logicTree);
            var      strings        = LogicFormulaParser.GetFluentStrings(simplifiedTree);

            Console.WriteLine(b);
            // ------------
            // przyklad z instrukcji do wrappera SwiPlCs :

            //Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\swipl\bin");
            if (PlEngine.IsInitialized)
            {
                return;
            }
            //String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            //PlEngine.Initialize(param);

            //const string filename = "./text.txt";
            //AdeSystem.Initialize(param);
            AdeSystem.LoadDomainFromFile(filename);

            //PlQuery.PlCall("assert(father(martin, inka))");
            //PlQuery.PlCall("assert(father(uwe, gloria))");
            //PlQuery.PlCall("assert(father(uwe, melanie))");
            //PlQuery.PlCall("assert(father(uwe, ayala))");
            //using (var q = new PlQuery("father(P, C), atomic_list_concat([P,' is_father_of ',C], L)"))
            //{
            //    foreach (var v in q.SolutionVariables)
            //        Console.WriteLine(v["L"].ToString());

            //    Console.WriteLine("all child's from uwe:");
            //    q.Variables["P"].Unify("uwe");
            //    foreach (var v in q.SolutionVariables)
            //        Console.WriteLine(v["C"].ToString());
            //}
            PlEngine.PlCleanup();
        }
示例#16
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (checkWinner != null)
     {
         if (checkWinner.ThreadState == ThreadState.Running)
         {
             checkWinner.Abort();
         }
     }
     PlEngine.PlCleanup();
 }
示例#17
0
 public void StopGame()
 {
     Debug.WriteLine("On es ici");
     if (tarot != null && tarot.IsAlive)
     {
         PlEngine.PlHalt();
         tarot.Abort();
     }
     else if (tarot.ThreadState == System.Threading.ThreadState.Stopped)
     {
         PlEngine.PlCleanup();
     }
 }
示例#18
0
 static void Main()
 {
     Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files\swipl");
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     if (!PlEngine.IsInitialized)
     {
         String[] empty_param = { "" };
         PlEngine.Initialize(empty_param);
         Application.Run(new Form1());
         PlEngine.PlCleanup();
     }
 }
示例#19
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            // Initialize ListView
            paintingListView.ItemsSource = null;
            items = new List <ListViewModel>();

            // ComboBox Variables
            ComboBoxPairsModel artist, museum, technique, year, description;
            string             artistValue, museumValue, techniqueValue, yearValue, descriptionValue;

            // Connect to Prolog Engine
            string[] p = { "-q", "-f", @"ArtGallery.pl" };
            PlEngine.Initialize(p);

            // Prolog Initialization
            PlQuery consult;
            PlQuery cargar = new PlQuery("cargar('ArtGallery.bd')");

            cargar.NextSolution();

            // Get ComboBox Values
            try { artist      = (ComboBoxPairsModel)artistComboBox.SelectedItem;
                  artistValue = artist._Value; } catch { artistValue = "Artist"; }

            consult = new PlQuery("paintingsOf(Name," + artistValue + ",Museum,Technique,Year,Description).");
            foreach (PlQueryVariables data in consult.SolutionVariables)
            {
                items.Add(new ListViewModel()
                {
                    Name        = data["Name"].ToString(),
                    Artist      = artistValue,
                    Museum      = data["Museum"].ToString(),
                    Technique   = data["Technique"].ToString(),
                    Year        = data["Year"].ToString(),
                    Description = data["Description"].ToString(),
                });
            }

            // Close Prolog Connection
            PlEngine.PlCleanup();

            // Render Images
            foreach (ListViewModel item in items)
            {
                item.ImageSource = "Resources/" + item.Name + ".png";
            }


            paintingListView.ItemsSource = items;
            ComboBoxNull();
        }
示例#20
0
        private void check()
        {
            string[] p = { "-q" };
            PlEngine.Initialize(p);
            PlQuery.PlCall("consult('IZ7.pl')");
            PlQuery c = new PlQuery("startAkinator");

            c.NextSolution();
            str.Clear();
            formBD.itstring = 0;
            PlQuery q = new PlQuery("check(Char," + formBD.ans[0].ToString() + "," + formBD.ans[1].ToString() + "," + formBD.ans[2].ToString() + "," + formBD.ans[3].ToString() + "," + formBD.ans[4].ToString() + "," + formBD.ans[5].ToString() + "," + formBD.ans[6].ToString() + "," + formBD.ans[7].ToString() + ")");

            foreach (PlTermV s in q.Solutions)
            {
                formBD.str.Add(s[0].ToString().Trim(new Char[] { '[', ']' }).Replace(",", " "));
            }
            PlEngine.PlCleanup();

            if (formBD.str.Count > 0)
            {
                label2.Text = "Ваш стенд " + formBD.str[0];
                button1.Hide();
                button2.Hide();
                button4.Show();
                button5.Show();


                label1.Hide();

                try
                {
                    pictureBox1.Image = Image.FromFile("F:/desktop/Новая папка (14)/" + formBD.str[formBD.itstring] + ".png");
                }
                catch
                {
                    pictureBox1.Image = Image.FromFile("F:/desktop/Новая папка (14)/aki.png");
                }
                formBD.itstring++;
            }
            else
            {
                label2.Text = "Ваш стенд не найден. Желаете добавить?";
                button1.Hide();
                button2.Hide();
                button4.Hide();
                button5.Hide();
                button6.Show();
                button7.Show();
            }
        }
示例#21
0
        private void BattleShip_Load_1(object sender, EventArgs e)
        {
            //Lee las variables del entorno, donde se encuentra Ubicado prolog.exe.
            Environment.SetEnvironmentVariable("Path", @"C:\\Program Files (x86)\\swipl\\bin");
            String[] param = { "-q", "-f", @"conexion.pl" };                //Busca el archivo de conocimiento, esta dentro de debug
            PlEngine.Initialize(param);                                     //Inicializa el archivo de conocimiento.

            PlQuery consulta1 = new PlQuery("cargar(" + "Se_leyo" + ",R)"); //Ejecuta la consulta a prolog. devolviendo n resultados.

            foreach (PlQueryVariables n in consulta1.SolutionVariables)     //Recorre todos los resultados devueltos.
            {
                Console.WriteLine(n["R"]);                                  //Los imprime en pantalla.
            }
            PlEngine.PlCleanup();
        }
        public void Test02()
        {
            //Arrange
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            Core.AdeSystem.Initialize(param);
            Core.AdeSystem.LoadDomain(YaleProblem);
            Core.AdeSystem.ConstructSystemDomain();

            //Act
            var query  = new AlwaysExecutableQuery("always executable entice by hador from !a & !w");
            var result = query.ToProlog();

            //Assert
            Assert.AreEqual(result, FalseString);

            PlEngine.PlCleanup();
        }
        public void Test03()
        {
            //Arrange
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            Core.AdeSystem.Initialize(param);
            Core.AdeSystem.LoadDomain(YaleProblem);
            Core.AdeSystem.ConstructSystemDomain();

            //Act
            var query  = new PossiblyAccessibleQuery("possibly accessible a from !a");
            var result = query.ToProlog();

            //Assert
            Assert.AreEqual(result, TrueString);

            PlEngine.PlCleanup();
        }
        public void Test04()
        {
            //Arrange
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            Core.AdeSystem.Initialize(param);

            Core.AdeSystem.Initialize(param);
            Core.AdeSystem.LoadDomain(LighbulbsProblem);
            Core.AdeSystem.ConstructSystemDomain();
            //Act
            var query  = new AlwaysAfterQuery("always !sone&!stwo after TURNTWO,TURNONE by epsilon,epsilon from sone&stwo");
            var result = query.ToProlog();

            //Assert
            Assert.AreEqual(result, FalseString);

            PlEngine.PlCleanup();
        }
        public void Test12()
        {
            //Arrange
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            Core.AdeSystem.Initialize(param);

            Core.AdeSystem.Initialize(param);
            Core.AdeSystem.LoadDomain(LighbulbsProblem);
            Core.AdeSystem.ConstructSystemDomain();
            //Act
            var query  = new TypicallyInvolvedQuery("typically involved Mietus in TURNTWO, TURNONE by epsilon,epsilon");
            var result = query.ToProlog();

            //Assert
            Assert.AreEqual(result, FalseString);

            PlEngine.PlCleanup();
        }
示例#26
0
        public static void Ex2()
        {
            string       filename = Path.GetTempFileName();
            StreamWriter sw       = File.CreateText(filename);

            sw.WriteLine("father(martin, inka).");
            sw.WriteLine("father(uwe, gloria).");
            sw.WriteLine("father(uwe, melanie).");
            sw.WriteLine("father(daddy, ayala).");
            sw.Close();

            String[] param = { "-q", "-f", filename };

            try
            {
                PlEngine.Initialize(param);

                Console.WriteLine("uwe children:");
                using (PlQuery q = new PlQuery("father(uwe, Child)"))
                {
                    foreach (PlQueryVariables v in q.SolutionVariables)
                    {
                        Console.WriteLine(v["Child"].ToString());
                    }
                }
                Console.WriteLine("daddy children:");
                using (PlQuery q = new PlQuery("father(daddy, Child)"))
                {
                    foreach (PlQueryVariables v in q.SolutionVariables)
                    {
                        Console.WriteLine(v["Child"].ToString());
                    }
                }
            }
            catch (PlException e)
            {
                Console.WriteLine(e.MessagePl);
                Console.WriteLine(e.Message);
            }
            finally
            {
                PlEngine.PlCleanup();
            }
        }
        public void Test18()
        {
            //Arrange
            String[] param = { /*"-q"*/ };  // suppressing informational and banner messages
            Core.AdeSystem.Initialize(param);

            Core.AdeSystem.Initialize(param);
            Core.AdeSystem.LoadDomain(YaleProblem);
            Core.AdeSystem.ConstructSystemDomain();

            //Act
            var query  = new TypicallyInvolvedQuery("typically involved Hador in SHOOT,SHOOT,ENTICE by Hador,Mietus,Hador");
            var result = query.ToProlog();

            //Assert
            Assert.AreEqual(result, TrueString);

            PlEngine.PlCleanup();
        }
        public MainWindow()
        {
            InitializeComponent();

            // Try to clean up dirty Prolog engine resources from previous runs if execution terminates unexpectedly
            try
            {
                PlEngine.PlCleanup();
            }
            catch (PlException) { }
            catch (Exception) { }

            // Initialize Prolog engine with sandwich.pl file
            String[] param = { "-q", "-f", "sandwich.pl" };
            PlEngine.Initialize(param);

            // Ensure all values are at its initial state
            Reset();
        }
示例#29
0
        public void SolveMaze()
        {
            //get solv
            //print the solv

            try
            {
                WritePLFile(NewMazeCode());
                //Solv
                string solv = "";

                if (PlEngine.IsInitialized)
                {
                    PlEngine.PlCleanup();
                }

                string[] p = { "-q", "-f", maze_code_path };
                PlEngine.Initialize(p);

                PlQuery q = new PlQuery("search(R).");

                foreach (PlQueryVariables v in q.SolutionVariables)
                {
                    solv += v["R"];
                }

                if (solv == "")
                {
                    lbStatus.Text = "There are no answer"; return;
                }

                PrintSol(solv);
            }
            catch (Exception ex)
            {
                lbStatus.Text = ex.Message;
            }
            if (PlEngine.IsInitialized)
            {
                PlEngine.PlCleanup();
            }
        }
示例#30
0
        private void button1_Click(object sender, EventArgs e)
        {
            string valorObtenido = textBox1.Text;


            PlQuery cargar = new PlQuery("cargar('base_de_conocimiento.bd')");

            cargar.NextSolution();

            PlQuery consulta1 = new PlQuery("amigos_solteros(X,Y)");

            foreach (PlQueryVariables z in consulta1.SolutionVariables)
            {
                listBox1.Items.Add(z["X"].ToString());
            }


            PlEngine.PlCleanup();
            cargar.Dispose();
        }