A pathfinding algorithm I designed completely by myself using Python! Use it to solve complex mazes!
This is NOT a shortest pathfinding algorithm, just a correct path.
The map is stored in file called map.txt stored in the same directory as main.py. The walls can be made with any character, preferably # or █, but the paths have to be whitespaces. The start and end points are denoted by O and X respectively.
To easily make mazes, you can use https://www.dcode.fr/maze-generator. Make sure that the Path Design option is set to empty space and Display option is set to single character.
The Samples folder contains various sample maps with different sizes and designs. If using them, make sure to drag the file to the root directory and rename it to map.txt. Feel free to move the start and end points to see different paths formed.
There are two ways in which a suitable output can be recieved:
- In the form of steps taken
- In the form of a completed map (Prefered for larger maps)
At the end, use the statement: print(final)
to get a series on moves leading from start to finish.
At the end, use the statement: print("\n".join(map))
to get a completed map with the path highlighted.