Exemplo n.º 1
0
        /// <summary>
        /// Wygenerowanie pierwszego rozwiązania.
        /// </summary>
        private void start_button_Click(object sender, EventArgs e)
        {
            try
            {
                String sciezka = @"..\..\..\alloc.pl";
                if (!File.Exists(sciezka))
                {
                    throw new FileNotFoundException("Brak pliku: " + sciezka);
                }

                String crew        = prepareCrewPrologList();
                String flightsReqs = prepareFlightsRequirements(); //DefaultData.prepareDefaultRequirements();

                if (!PlEngine.IsInitialized)
                {
                    String[] param = { "-f", sciezka };
                    PlEngine.Initialize(param);
                }

                prologParams    = new PlTermV(3);
                prologQuery     = new PlQuery("matchTeams", prologParams);
                prologParams[1] = new PlTerm(flightsReqs);
                prologParams[2] = new PlTerm(crew);

                generateResultAndShow();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Wyjatek:\n\n" + ex.Message);
            }
        }
Exemplo n.º 2
0
        public static void init()
        {
            SpaceForm.self.tbELRuleInput.Text    = "";
            SpaceForm.self.tbELOutput.Text       = "";
            SpaceForm.self.tbELDomainTheory.Text = "";
            if (!PlEngine.IsInitialized)
            {
                try
                {
                    PlEngine.Initialize(new string[] { "-q" });
                }
                catch
                {                       //32 on 64 bit
                    Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files (x86)\swipl");
                    try
                    {
                        PlEngine.Initialize(new string[] { "-q" });
                    }
                    catch
                    {                           //64/32 bit only
                        Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"C:\Program Files\swipl");
                        PlEngine.Initialize(new string[] { "-q" });
                    }
                }
                PlQuery.PlCall("consult('"
                               + (File.Exists("./source.pl") ? "./source.pl" : "../../source.pl")
                               + "')");
            }

            logApp("---Init---");
        }
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
        public static bool Start(string filePath)
        {
            if (PlEngine.IsInitialized)
            {
                return(true);
            }

            string currentSystemPath = Environment.GetEnvironmentVariable("Path");

            Environment.SetEnvironmentVariable(@"SWI_HOME_DIR", @"swipl");
            Environment.SetEnvironmentVariable(@"Path", currentSystemPath + @";swipl;swipl\bin");

            string[] args = { "-q", "-f", filePath };

            try
            {
                PlEngine.Initialize(args);
            }
            catch
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 5
0
 static private readonly String[] EmptyParam = { "-q" };  // suppressing informational and banner messages
 //        static public String[] EmptyParam = { "-nosignals" };
 //        static public String[] EmptyParam = { "--quit"};
 static private void InitializePlEngine()
 {
     if (!PlEngine.IsInitialized)
     {
         PlEngine.Initialize(EmptyParam);
     }
 }
Exemplo n.º 6
0
        private void startGame()
        {
            if (!PlEngine.IsInitialized)
            {
                // Thread clean = new Thread();
                //string filename = @"C:\Users\Mathieu\Documents\Visual Studio 2015\Projects\TarotAfricain\TarotAfricain\Prolog\prolog.pro";
                string filename = "TarotAfrikMulti.pl";

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

                string serialNames = SerializeList(names);
                string serialIsIa  = SerializeList(isIa);

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

                string query = "playGame(" + serialNames + ", " + serialIsIa + ", " + nbCarte.ToString() + "), write('end').";



                PlEngine.Initialize(param);
                Debug.WriteLine(PlEngine.IsInitialized);
                Debug.WriteLine(PlEngine.PlThreadSelf());

                //Debug.WriteLine("Attachement : " + PlEngine.PlThreadAttachEngine());
                PlEngine.SetStreamFunctionWrite(SbsSW.SwiPlCs.Streams.PlStreamType.Output, stdout);

                InitializeCallBack();
                PlQuery.PlCall(query);

                Debug.WriteLine("end");
            }
        }
Exemplo n.º 7
0
 //Nuevas..
 /// <summary>
 /// Abre la conexion con el archivo de pl.
 /// </summary>
 public void abrirConexionProlog()
 {
     //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.
 }
Exemplo n.º 8
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();
            }
        }
Exemplo n.º 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!");
        }
Exemplo n.º 10
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!");
            }
        }
Exemplo n.º 11
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();
            }
        }
        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];
        }
Exemplo n.º 13
0
 public void Initialize(params string[] initParams)
 {
     if (PlEngine.IsInitialized)
     {
         return;
     }
     PlEngine.Initialize(initParams);
 }
Exemplo n.º 14
0
 private void Form1_Load(object sender, EventArgs e)
 {
     //Ruta de instalacion de prolog
     Environment.SetEnvironmentVariable("Path", @"C:\\Program Files (x86)\\swipl\bin");
     //Cargar archivo prilig
     string[] p = { "-q", "-f", @"boxeador.pl" };
     PlEngine.Initialize(p);
 }
 public SWIPrologService2()
 {
     if (!PlEngine.IsInitialized)
     {
         String[] param = { "-q" }; // suppressing informational and banner messages
         PlEngine.Initialize(param);
     }
 }
Exemplo n.º 16
0
 private void Form1_Load(object sender, EventArgs e)
 {
     panel1.BackColor = Color.FromArgb(125, Color.Black);
     Environment.SetEnvironmentVariable("Path", @"C:\\PROGRAM FILES (x86)\\swipl\bin");
     string[] p = { "-q", "-f", @"componentes.pl" };
     PlEngine.Initialize(p);
     cargarDatosCombobox();
 }
Exemplo n.º 17
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();
            }
        }
Exemplo n.º 18
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();
        }
Exemplo n.º 19
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();
        }
Exemplo n.º 20
0
 public frmSudoku()
 {
     InitializeComponent();
     igra.popuniSlagalicu += igra_popuniSlagalicu;
     igra.vratiOdgovor    += igra_vratiOdgovor;
     String[] param = { "-q" };
     PlEngine.Initialize(param);
     PlQuery.PlCall("use_module(sudoku)");
 }
Exemplo n.º 21
0
        public KnowledgeBase()
        {
            // Build a prolog source file (skip this step if you already have one :-)
            //string filename = Path.GetFileName("C:\\Users\\abrhm\\Source\\Repos\\Wumpus-World\\Wumpus World\\Packages\\Agentkb");
            // build the parameterstring to Initialize PlEngine with the generated file
            String[] param = { "-q", "-f", "Agentkb.pl" };
            if (!PlEngine.IsInitialized)
            {
                try
                {
                    //initializing prolog engine
                    PlEngine.Initialize(param);
                    //PlQuery.PlCall("sensebreeze(true,[1,1])");
                    //Boolean q = PlQuery.PlCall("ispit([2,1])");
                    //Console.WriteLine(q);
                    //PlQuery.PlCall("sensebreeze(false,[1,1])");
                    // q = PlQuery.PlCall("ispit([2,1])");
                    //Console.WriteLine(q);
                }
                catch (PlException e)
                {
                    Console.WriteLine(e.MessagePl);
                    Console.WriteLine(e.Message);
                }
            }

            //if (!PlEngine.IsInitialized)
            //{
            //	String[] param = { "-q" };  // suppressing informational and banner messages
            //	PlEngine.Initialize(param);
            //	PlQuery.PlCall("assert(wumpus(1,1))");
            //	PlQuery.PlCall("assert(wumpus(1,2))");
            //	PlQuery.PlCall("assert(father(uwe, melanie))");
            //	PlQuery.PlCall("assert(father(uwe, ayala))");

            //	var w = new PlQuery("wumpus(X,Y)");
            //	foreach(PlQueryVariables z in w.SolutionVariables)
            //	{
            //		Console.WriteLine(z["X"].ToString());

            //	}


            //	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!");
            //}
        }
Exemplo n.º 22
0
        public static void SetupProlog2()
        {
            try
            {
#if USE_IKVM
                if (!JplDisabled)
                {
                    JPL.setNativeLibraryDir(SwiHomeDir + "/bin");
                    try
                    {
                        JPL.loadNativeLibrary();
                    }
                    catch (Exception e)
                    {
                        WriteException(e);
                        JplDisabled = true;
                    }
                    if (!JplDisabled)
                    {
                        SafelyRun(() => jpl.fli.Prolog.initialise());
                    }
                }
                SafelyRun(TestClassLoader);
#endif
                //if (IsPLWin) return;
                try
                {
                    if (!PlEngine.IsInitialized)
                    {
                        String[] param = { "-q" }; // suppressing informational and banner messages
                        PlEngine.Initialize(param);
                    }
                    if (IsPLWin)
                    {
                        return;
                    }
                    if (!PlEngine.IsStreamFunctionReadModified)
                    {
                        PlEngine.SetStreamReader(Sread);
                    }
                    PlQuery.PlCall("nl.");
                }
                catch (Exception e)
                {
                    WriteException(e);
                    PlCsDisabled = true;
                }
                //                PlAssert("jpl:jvm_ready");
                //                PlAssert("module_transparent(jvm_ready)");
            }
            catch (Exception exception)
            {
                WriteException(exception);
                return;
            }
        }
Exemplo n.º 23
0
        public void Initialize(params string[][] initParams)
        {
            var p = new List <string>();

            foreach (var strArr in initParams)
            {
                p.AddRange(strArr);
            }
            PlEngine.Initialize(p.ToArray());
        }
Exemplo n.º 24
0
        private void FormPrincipal_Load(object sender, EventArgs e)
        {
            /* usando o método Environment.SetEnvironmentVariable para crear variable de ambiente de swipl .
             * para trabajar com prolog*/
            Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"prolog"); // establecer las variables en el archivo PL
            Environment.SetEnvironmentVariable("Path", @"prolog");         // establecer las variables en el archivo PL
            Environment.SetEnvironmentVariable("Path", @"prolog\\bin");    // establecer las variables en el archivo PL

            string[] p = { "-q", "-f", @"Peliculas.pl", @"Peliculas_estreno.pl" };
            PlEngine.Initialize(p);
        }
Exemplo n.º 25
0
 public FrmNewGame()
 {
     InitializeComponent();
     CreateBoxes();
     SetColors();
     if (!PlEngine.IsInitialized)
     {
         PlEngine.Initialize(FrmMain.p);
     }
     //pocistit plocu
 }
Exemplo n.º 26
0
        private void formBD_Load(object sender, EventArgs e)
        {
            Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"prolog");
            Environment.SetEnvironmentVariable("Path", @"prolog");
            Environment.SetEnvironmentVariable("Path", @"prolog\bin");
            string[] p = { "-q", "-f", @"materia.pl" };
            PlEngine.Initialize(p);
            PlQuery c = new PlQuery("educacion");

            c.NextSolution();
        }
Exemplo n.º 27
0
 private void AnimalsForm_Load(object sender, EventArgs e)
 {
     cbInferencias.SelectedIndex           = 0;
     cmb_habitat_finder2.SelectedIndex     = 0;
     cmb_foodtype_finder2.SelectedIndex    = 0;
     cmb_development_finder2.SelectedIndex = 0;
     cmb_class_finder2.SelectedIndex       = 0;
     Environment.SetEnvironmentVariable("Path", @"C:\\Program Files (x86)\\swipl\\bin");
     String[] p = { "-q", "-f", @"Animals.pl" };
     PlEngine.Initialize(p);
 }
Exemplo n.º 28
0
        private void FormNBA_Load(object sender, EventArgs e)
        {
            Environment.SetEnvironmentVariable("SWI_HOME_DIR", @"prolog");
            Environment.SetEnvironmentVariable("Path", @"prolog");
            Environment.SetEnvironmentVariable("Path", @"prolog\bin");
            string[] parametri = { "-q", "-f", @"nba.pl" };
            PlEngine.Initialize(parametri);
            PlQuery postojiDatoteka = new PlQuery("postojiDatoteka");

            postojiDatoteka.NextSolution();
        }
Exemplo n.º 29
0
 private void button1_Click(object sender, EventArgs e)
 {
     string[] args = { "-q" };
     PlEngine.Initialize(args);
     using (var query = new PlQuery("member(X, [ngo, xuan, bach])."))
     {
         foreach (var sol in query.SolutionVariables)
         {
             MessageBox.Show(sol["X"].ToString());
         }
     }
 }
Exemplo n.º 30
0
 private void Form1_Load(object sender, EventArgs e)
 {
     /**
      * Poner la dirección del bin de donde tiene instalado prolog
      */
     Environment.SetEnvironmentVariable("Path", @"C:\\Program Files (x86)\\swipl\\bin");
     string[] p = { "-q", "-f", @"operations.pl" };
     PlEngine.Initialize(p);
     button2.Enabled   = false;
     button3.Enabled   = false;
     button5.Enabled   = false;
     comboBox1.Enabled = false;
 }