2D Puzzle Solver

For this little project I created a 2D puzzle solving program. The program uses breadth first search (BFS) for graph traversal to find a path from the source to the destination in the fewest moves possible. If a solution is found the program returns a tuple containing the path (coordinates of each cell visited) and directions taken (Up, Down, Left, Right). If there is no solution the program will return None. A sample puzzle is included and can be tested by running the file as a script.

When creating puzzles each cell in the puzzle is either empty or has a barrier. An empty cell is marked by ‘-’ (hyphen) and a barrier is marked by ‘#’. You must give two coordinates (a,b) and (x,y), which represent the start and end points.

Source Code