Skip to content

A simple and optimised pathfinding implementation for solving image based mazes

License

Notifications You must be signed in to change notification settings

Sma-Das/PathFinding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pathfinding Algorithms with Mazes

An implementation of a visual path-finder using Python3.

Notes:

Mazes are simple parameters, where a pixel denotes path(white), or wall(black). Unconventional mazes or RGB mazes can be retrofitted by specifiying within the state class

The start and end is considered to be the first open path on both the top and bottom of the maze respectively.

Modify the color transition of the solver by editing the RGB transition value in the ScanImage class.

Current Working Algorithms:

  • A* optimised
    • As opposed to brute forcing each available path the program finds nodes

    • This can reduce total working area by a significant amount

    • 4k x 4k (16 million pixels) Mazes with multiple solutions can take under a minute to solve on basic hardware

    • It is not optimised to work with multiple threads

Special thanks to MikePound, I used a few of his mazes and ideas from Computerphile to get going!

Demonstration

Maze (41x41)

Maze

Finding nodes:

Terminal

Maze Node

Solved:

image

image

Additional Solved mazes can be found in the solved folder

  • Notes:
    • Larger mazes example
    • 4 million pixel width
    • image
    • Trimmed to nearly 600k (~85% reduction)
    • Node discovery is approx 75k/s (on an older laptop, yet to test on others)
    • Started at ~12.5k/s initally (500% increase)

Additonal mazes:

400x100

400x100

200x200

200x200

Computerphile

400x100