Amable-Valdes / Prolog-Mazes

Algorithms to solve small mazes with prolog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to run MazeSolver.pl

Manopphysics opened this issue · comments

/* EXAMPLE OF USAGE: solve_problem('maze5.pl', Problem, Solution, _). /
/
(The name of the problem is infered, the solution is given as output /
/
and the time are not shown).

what is Problem and Solution as arguments?
The program fails to work because I do not know how to run this file correctly

You don't need to "define" Problem and Solution as arguments, prolog will infered it for you. You only need to define the *.pl file where you are going to read the maze. Think about Problem and Solutions as variables where you are going to save your results.

For example, try to run MazeSolver_Maze0_with_facts.pl (This file has the maze writen inside the code as facts, so you don't need to read a file). You can do it installing a prolog interpreter on your computer, but i recomend you to use an online interpreter like this.

Only ask your query using the predicate like this solve_problem(Problem, Solution), nothing more:

image

If you want to solve your own mazes, you will need to write its information as facts/rules in a file or inside the code as you can see in this examples.

If you use a program in your own computer, you will be able to read the facts from a file and pass it as argument. If you use an online interpreter, you will need to put the facts inside the code as is shown in the examples.

I hope this will help you.

Hello sir, Thank you very much, I am not a professional when it comes to prolog and you helped me understand a lot, thanks a lot!