Maze solving implemented in prolog.
Originally, it was an assignment on Introduction to AI course in Innopolis University (Spring 2020, 2nd year).
The original report with more information can be found here.
- For additional info about available parameters
swipl -s main.pl -g main -- -h
- For running random search with defined max path length
swipl -s main.pl -g main -- --map maps/map.pl --alg random_search --max 500
- For help running heuristic search with increased vision
swipl -s main.pl -g main -- --map maps/map.pl --alg heuristic_search -v 2
Each input file should contain:
- Exactly one
size/1
rule, which defines size of the map. For example,size(5)
would mean that map is 5 by 5. - Exactly one
start/2
rule, which defines on which cell maze starts. Usually it isstart(0, 0)
- Any amount of
o/2
rules. Defines the unpassable wall. - Any amount of
t/2
rules. Defined the end points of the maze. - Any amount of
h/2
rules. Defines the "teleport" field. It is possible to teleport to such a field from any distance, if it is on the same line. Works diagonally.
However, more than one o/2
, h/2
and/or t/2
can’t be at the same coordinates.
The code is tested only on SWI-Prolog (threaded, 64 bits, version 8.1.21-198-gd129a7435
).
The code uses a clpfd
library for convenient working with integers.