INNER CODE UNIT · Python
Maze
Kushal997-das/Project-Guidance · Desktop Application/Basic/Python/Maze Solver/main.py:32
class Maze:
def __init__(self, filename):
with open(filename) as f:
contents = f.read()
if contents.count("A") != 1:
raise Exception("Maze must have exactly one starting point.")
if contents.count("B") != 1:
raise Exception("Maze must have exactly one finishing point.")
contents = contents.splitlines()
self.height = len(contents)
self.width = max(len(line) for line in contents)
self.walls = []
for i in range(self.height):
row = []
for j in range(self.width):