BFS and DFS AI Path Search - Part 4

outside class Maze…

if len(sys.argv) != 2:

sys.exit("Usage: python maze.py maze.txt")

m = Maze(sys.argv[1])

print("Maze:")

m.print()

print("Solving...")

m.solve()

print("States Explored:", m.num_explored)

print("Solution:")

m.print()

m.output_image("maze.png", show_explored=True)

Input: say "maze.txt"

##    #
## ## #
#B #  #
# ## ##
     ##
A######

Output is in the picture attached using DFS

maze

Following is the console output for DFS

Maze:

██ █
██ ██ █
█B █ █
█ ██ ██
██
A██████

Solving…
States Explored: 17
Solution:

███
██
██
█
█B
█**█
█ ██
██
*****██
A██████