INNER CODE UNIT · Python

empty

Kushal997-das/Project-Guidance · Desktop Application/Basic/Python/Maze Solver/main.py:21

    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()

        if contents.count("A") != 1:
            raise Exception("Maze must have exactly one starting point.")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…