Skip to content

Divdude77/Python-Pathfinder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python-Pathfinder

A pathfinding algorithm I designed completely by myself using Python! Use it to solve complex mazes!

Note:

This is NOT a shortest pathfinding algorithm, just a correct path.

USAGE:

Input:

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.

Output:

There are two ways in which a suitable output can be recieved:

  1. In the form of steps taken
  2. In the form of a completed map (Prefered for larger maps)

Steps taken:

At the end, use the statement: print(final) to get a series on moves leading from start to finish. Screen Shot 2022-03-19 at 12 46 28 PM

Completed map:

At the end, use the statement: print("\n".join(map)) to get a completed map with the path highlighted.

Screen Shot 2022-03-19 at 12 48 14 PM

About

A pathfinder algorithm I designed on my own using Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages