This is the 2nd assignment in the course TDT4136 - Introduction to Artificial Intelligence
at NTNU.
This project uses pipenv
to handle dependencies and virtual environments. Make sure you have pipenv installed before proceeding.
cd mazesolver
pipenv install
Store the mazes to be solved in mazesolver/mazes/
. Every file in this folder will be read as a maze,
so be sure to only store valid maze files here.
pipenv shell
Run the main.py
file by running the following command in the shell:
python3 src/main.py
Solved mazes are stored in solved_mazes/
Maze file must be a .txt
file consisting of only the following characters and each row must
consist of exactly the same amount of characters.
Character map
---------------------------
# : Wall, impassable
A : Start of maze (*)
B : End of maze (*)
. : Corridor cost = 1
: Corridor cost = 1
w : Water, cost = 100
m : Mountain, cost = 50
f : Forest, cost = 10
g : Grassland, cost = 5
r : Roads, cost = 1
(*) = Mandatory characters which can only appear once in the document.
Without character an IOError will be raised.
A.#.......#......#..
#.#.#####.#.####.#..
..#.....#.#....#....
.##.###.######.#####
..#.B#..#....#...#..
#.####.##.##.#.#.##.
...........#...#....
wwwwwggggggggggggggggggggggggggggggrrrrr
wwwwwwwgggggggggggggggggggggwwwwwgrrgggg
wwwwwwwwwwwgggAgggggggwwwwwwwwwwwwrwgggg
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrwwwww
wwwwwwwwgggggBgggggwwwwwwwwwwwwwwrwwwwww
wwwwggggggffffffgggggggggwwwwwwwwrwwwwww
wwggggffffffffffffffggggggggggggrrgwwwww
wgggfffrrrrrrrrrrrrrrrrrrrrrrrrrrggggggg