GithubHelp home page GithubHelp logo

maze-pathfinder's Introduction

Maze Pathfinder

  • An implementation of the A* shortest path algorithm for solving parsed mazes, written in Ruby for the terminal console.

  • I have added a sleep method for improved UX. If the focus is efficiency, run the code without it.

Overview

  • Run the command bundle install in your terminal

  • To run the pathfinder: ruby lib/maze_solver.rb

  • I have provided 3 test mazes in the mazes directory

    • The current setting is to run the pathfinder on the first maze. If you would like to try running the others, you can change the input .txt file in lib/maze_solver.rb. Save your changes, then run the ruby lib/maze_solver.rb command again.

Implementation Notes

  • Two files in the lib directory hold the code:

    • maze.rb loads in the maze.txt file and parses it. It holds all of the information on the maze itself

    • maze_solver.rb holds all of the logic for the A* algorithm

  • Find specific comments on my implementation of the A* algorithm in my code, as well as other useful notes

  • Possible outputs from testing:

    • 1) If the path is blocked with not even an initial move available, "This maze has no available moves" will print to the terminal screen.

    • 2) If there are moves but the maze is found to be unsolvable, the traveling path that got the closest to the end will print to the terminal screen.

    • 3) Otherwise you will get the fastest path according to the A* algorithm (selecting from multiple equally fast paths may be handled by this implementation differently than others)

  • Note that all of the mazes I provided are solvable

Ruby Concepts (personal use)

  • colorize gem
  • Reversing a grid to have graph perspective
  • File class I/O
  • Computer pathfinding
  • Overriding to_s
  • send method
  • hash deep dup

maze-pathfinder's People

Contributors

sashadev-sky avatar

Watchers

 avatar  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.