Git Product home page Git Product logo

prolog-mazes's Introduction

Prolog-Mazes

The Prolog Maze Solver Project

The Jupyter Notebook "Mazes Manipulation Script" (and also the python script with the same name) allows us to convert images of labyrinths into rules or facts or draw the path that would be followed to solve the labyrinth.

The prolog file "MazeSolver.pl" is the skeleton on which we have worked to solve mazes. With this file you can select the .pl file you want to read with the facts that represent the laberint (generated by the python script) and solve it!

If you don't want to select the file you can embed the rules or facts as you can see in the examples on the folder "embedded facts or rules examples" like "MazeSolver_Maze0_with_rules.pl" or others.

In the folder of "mazes" there are several .png images of labyrinths that, through the Jupyter Notebook we have translated to facts. Next to every image there are the text file with the facts (entry point to the labyrinth, exit and the existing walls) that prolog can understand. The prolog file that we have programmed can read files so we just have to indicate the path of the file we want to solve. Next to the files you can see the maze solution with the path drawed writen in a .png image generated by our python script.

Why this project? Time to tell a story...

Well, We both are finishing the master degree in Artificial Inteligent in the "Universidad Politecnica de Madrid" MUIA and we have a Prolog subject. We have been asked to do a project in which we use prolog to solve a problem based on rules and we both think about using prolog to solve mazes, defining the labyrinths in images, translating them into a matrix and then rules that prolog could understand and finally, use prolog to return the path that must be followed to solve the labyrinths.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

If you read any bad translation in documentation or code send us an email with the sentence that is poorly written together with a more accurate sentence (^.^)

Thanks for read me!

prolog-mazes's People

Contributors

amable-valdes avatar zerolfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

zerolfer

prolog-mazes's Issues

How to run MazeSolver.pl

/* 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

When input other mazes an error is produced.

The mazes that you have given in your example file works perfectly, but when I download other maze images from google such as this:
mazeC

The python Maze Manipulation Script produces this error:
Traceback (most recent call last): File "<pyshell#17>", line 1, in <module> translate_image_into_rules("mazes/mazeC.png") File "C:\Users\name\Desktop\python\Project\Prolog-Mazes-master\Mazes Manipulation Script.py", line 189, in translate_image_into_rules maze = translate_image_to_maze(img) File "C:\Users\name\Desktop\python\Project\Prolog-Mazes-master\Mazes Manipulation Script.py", line 155, in translate_image_to_maze maze[i][j] = float(label) TypeError: float() argument must be a string or a number, not 'NoneType'

This is understandable there might be some problems with the image quality and the color from other sources.

My question is, How to generate other mazes like in your example that works perfectly with the program?

Thanks a lot!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.