INNER CODE UNIT · Python
contains_state
Kushal997-das/Project-Guidance · Desktop Application/Basic/Python/Maze Solver/main.py:18
def contains_state(self, state):
return any(node.state == state for node in self.frontier)
def empty(self):
return len(self.frontier) == 0
def remove(self):
if self.empty():
raise Exception("Frontier is empty")
else:
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()