diff --git a/coordinate.py b/coordinate.py index 3da267a..b949255 100644 --- a/coordinate.py +++ b/coordinate.py @@ -74,6 +74,12 @@ class Coordinate: else: return 180.0 + abs(angle) + def __add__(self, other: Coordinate) -> Coordinate: + return Coordinate(self.x + other.x, self.y + other.y) + + def __sub__(self, other: Coordinate) -> Coordinate: + return Coordinate(self.x - other.x, self.y - other.y) + @staticmethod def generate(from_x: int, to_x: int, from_y: int, to_y: int) -> List[Coordinate]: return [Coordinate(x, y) for x in range(from_x, to_x + 1) for y in range(from_y, to_y + 1)]