diff --git a/cell.py b/cell.py index ecdaee1..82e4126 100644 --- a/cell.py +++ b/cell.py @@ -99,12 +99,10 @@ class Cell: """ return self._centre - def wall_exists(self, wall: int) -> bool: + def wall_exists(self, wall: CellWallLabel) -> bool: """ returns True if a given cell wall exists, or false otherwise. """ - if wall not in self._walls: - raise errors.CellInvalidWallError(wall) return self._walls[wall].exists # def break_walls_r(self, i: int, j: int) -> None: @@ -121,8 +119,8 @@ class Cell: if not self._window: return - for _, wall in self._walls.items(): - wall.draw() + for label in CellWallLabel: + self._walls[label].draw() def draw_move(self, to_cell: 'Cell', undo: bool = False) -> None: """ diff --git a/errors.py b/errors.py index 50a7235..a646514 100644 --- a/errors.py +++ b/errors.py @@ -1,17 +1,3 @@ -class CellInvalidWallError(Exception): - """ - CellInvalidWallError is raised when the program tries to specify a Cell's - Wall that does not exist. - """ - - def __init__(self, wall: int, *args): - super().__init__(args) - self.wall = wall - - def __str__(self): - return f"Invalid Cell Wall (wall int: {self.wall}) specified." - - class CellInvalidError(Exception): """ CellInvalidError is raised when the program tries to create a Cell whose