Table of Contents
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!
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.
- Install NumPy
pip install numpy
- Install PyGame
pip install pygame
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
After providing the table as input you should see something like this:
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
M. Amin Habibollah
Email: amin.habibllh@gmail.com
Project Link: https://github.com/aminhbl/pathfinding-algorithms