Skip to content
/ Maze Public

Maze generation and recursive back tracking

Notifications You must be signed in to change notification settings

algarv/Maze

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a-MAZE-ing Python Challenge

This package generates a maze then solves it with recursive back tracking.

Maze Gif

Maze Generation:

The maze generation function randomly selects a start and end point and creates an array of wall indexes and path indexes, with at least one chain of open paths between the start and end points. The function takes a size input to determine the number of rows and columns of the array.

Maze Solving:

The solver employs recursive backtracking to find a path between the start and end pixels. From the stating point, it randomly selects an ajacent index. If the index is valid, it will "move" to that index and then choose a new adjacent index. If the path is a wall (the value is 1), it will add the index to the list of walls and choose a new adjacent index. Any paths previously travelled to are added to their own list, and will only be returned to if an index has no other adjacent paths. In that case, any index that requires backtracking is added to the wall list. This is visualized as the travelling blue square turning cyan.

About

Maze generation and recursive back tracking

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages