aminhbl / search-algorithms

A pathfinding robot operating based on IDS, bidirectional BFS, and A-star search algorithms.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Logo

Pathfinding Algorithms

Best path to pass the butter!
GitHub Page

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

There are many algorithms for finding the optimal path between two points, here we practice IDS, Bidirectional-BFS, and A* for a robot that its job is to pass the butter on a breakfast table with other objects as obstacles. The map of the table is given as input in form of a matrix with the following descriptions:

  • The price for the robot to go from a cell to another is given in each matrix cell
  • Robot's initial place is represented with the letter 'r'
  • Butters, Obstacles, and targets are represented with 'b', 'x', and 'p' respectively

Robot itself has the following restrictions:

  • Robot can only push the butter, and it cannot be dragged.
  • There can be many butters on the table though robot can only push one butter at the time.
  • Robot can only move in four cardinal directions.
  • Entirety of table is visible to robot.
  • Robot shall not drop itself, or a butter off the table.

As mentioned the goal is for the robot to pass the butters to as many target points as we have.

This project is inspired by the Rick and Morty robot, that in one episode is designed by Rick for the sheer purpose of passing the butter on the breakfast table!

Built With

(back to top)

Getting Started

First off make sure that you have pip installed on your system and then you need to have the following installations to run the program.

Installation

  1. Install NumPy
    pip install numpy
  2. Install PyGame
    pip install pygame

(back to top)

Usage

Example Run

You can run each algorithm separately, just choose your algorithm and run it like this:

    $ python3 ids.py

After running the program you need to provide a matrix and its width and length to map the table. An example of this matrix is shown below:

    5   5
    1   1   1   1   1
    1   1   1   1   1
    1   1b  1r  1b  1
    1   x   x   x   1
    1p  1   1   1   1p

Preview

After providing the table as input you should see something like this: Example Run

(back to top)

Contributing

If you have a suggestion that would make this project better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE for more information.

(back to top)

Contact

M. Amin Habibollah
Email: amin.habibllh@gmail.com
Project Link: https://github.com/aminhbl/pathfinding-algorithms

LinkedIn

(back to top)

About

A pathfinding robot operating based on IDS, bidirectional BFS, and A-star search algorithms.

License:MIT License


Languages

Language:Python 100.0%