Coder Social home page Coder Social logo

mazesolver's Introduction

Maze solver

About project

This is the 2nd assignment in the course TDT4136 - Introduction to Artificial Intelligence at NTNU.

Installation

Install pipenv

This project uses pipenvto handle dependencies and virtual environments. Make sure you have pipenv installed before proceeding.

Install dependencies

cd mazesolver
pipenv install

Solve mazes

1) Store mazes in mazes

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.

2) Open shell

pipenv shell

3) Run main.py from 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 format

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.

Example file and rendering:

Example 1

A.#.......#......#..
#.#.#####.#.####.#..
..#.....#.#....#....
.##.###.######.#####
..#.B#..#....#...#..
#.####.##.##.#.#.##.
...........#...#....

Image not available

Example 2

wwwwwggggggggggggggggggggggggggggggrrrrr
wwwwwwwgggggggggggggggggggggwwwwwgrrgggg
wwwwwwwwwwwgggAgggggggwwwwwwwwwwwwrwgggg
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrwwwww
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwrrwwwww
wwwwwwwwgggggBgggggwwwwwwwwwwwwwwrwwwwww
wwwwggggggffffffgggggggggwwwwwwwwrwwwwww
wwggggffffffffffffffggggggggggggrrgwwwww
wgggfffrrrrrrrrrrrrrrrrrrrrrrrrrrggggggg

Image not available

mazesolver's People

Contributors

sigurdmm avatar

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.