Giter Site home page Giter Site logo

rasitayaz / maze-solver Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 39 KB

Finds the best solution path for a maze using artificial intelligence

Java 100.00%
artificial-intelligence maze-solver search-algorithm breadth-first-search depth-first-search a-star-search greedy-best-first-search iterative-deepening-search uniform-cost-search

maze-solver's Introduction

Maze Solver

This is a program that finds the best solution path for a maze using artificial intelligence. It takes a maze file as an input and can use 6 different AI based search algorithms to find the best solution path for that maze. The user can select the algorithm to apply for a given maze using the command line menu. After running the selected algorithm, program prints the results.

Rules

  • Maze consists of NxN tiles.
  • Searching starts at the tile marked as 'S' (start tile).
  • Searching ends at one of the tiles marked as 'G' (goal tile).
  • Walls of the maze are denoted with '#'.
  • Program can expand towards the right, down, left, up directions if there is no wall.
  • Exploring to an empty tile marked as whitespace ' ' costs 1 unit.
  • Exploring to a trap tile marked as 'T' costs 10 units.

Algorithms Used

  • A* Search
  • Breadth First Search
  • Depth First Search
  • Greedy Best First Search
  • Iterative Deepening Search
  • Uniform Cost Search

Test Mazes

Best solution path for maze.txt input file visualized:

       1   2   3   4   5   6   7   8

     # # # # # # # # # # # # # # # # #
 1   # . . . # . . . . . . . . . . . #
     # . # . # . # # #   # # # # # . #
 2   # . # . . .   T #   #         . #
     # . # # # # #   #   #   # # # . #
 3   # . . S #   #         T   G # . #
     #   #   #   # # # # #   # # # . # 
 4   #   #       #       #   #     . #
     #   #   #   #   #   #   # # # . #
 5   #   #   #   #   #   #   #   # . #
     #   # # #   #   #   #   #   # . #
 6   #               #   #   # G . . #
     #   # # # # # # #   #   # # #   #
 7   #               #   # T     # T #
     #   # # #   #   # # # # #   #   #
 8   #       #   #   # G         # G #
     # # # # # # # # # # # # # # # # #

Best solution path for maze2.txt input file visualized:

       1   2   3   4   5   6   7   8

     # # # # # # # # # # # # # # # # #
 1   #                 G # . . . . . #
     #   # # # # # # # # # . #   # . #
 2   #         T # . . . # . # T # . #
     # # # # #   # . # . # . #   # . #
 3   #             . # . . .     # . #
     # # # # # # # . # # # # # # # . #
 4   #             S             # G #
     #   # # # # # # #   #   #   # # # 
 5   #   #               # T #   #   #
     #   #   # # # # # # #   #   #   #
 6   #   #                   #     T #
     #   # # # # # # # # #   #   #   #
 7   #     T   G # G         #   #   #
     #   # # # # # # # # # # #   #   #
 8   #                           # G #
     # # # # # # # # # # # # # # # # #

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.