INNER CODE UNIT · Python
node
Kushal997-das/Project-Guidance · Desktop Application/Basic/Python/Maze Solver/main.py:28
node = self.frontier[-1]
self.frontier = self.frontier[:-1]
return node
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)