Compare commits

..

No commits in common. "b2cc1e814c3dea3b2582c2b85726db387acfca3d" and "2bec56eb1ca01c13f68ef1e3cb2e55da9bc3b70e" have entirely different histories.

View File

@ -187,7 +187,7 @@ class Coordinate(tuple):
nb_list = [(-1, 0), (1, 0), (0, -1), (0, 1)] nb_list = [(-1, 0), (1, 0), (0, -1), (0, 1)]
for dx, dy in nb_list: for dx, dy in nb_list:
if minX <= self[0] + dx <= maxX and minY <= self[1] + dy <= maxY: if minX <= self[0] + dx <= maxX and minY <= self[0] + dy <= maxY:
yield self.__class__(self[0] + dx, self[1] + dy) yield self.__class__(self[0] + dx, self[1] + dy)
else: else:
if includeDiagonal: if includeDiagonal:
@ -261,15 +261,6 @@ class Coordinate(tuple):
else: else:
return self.__class__(-self[0], -self[1], -self[2]) return self.__class__(-self[0], -self[1], -self[2])
def __hash__(self) -> int:
return hash((self[0], self[1], self[2]))
def __eq__(self, other: Coordinate | tuple) -> bool:
if self[2] is None:
return self[0] == other[0] and self[1] == other[1]
else:
return self[0] == other[0] and self[1] == other[1] and self[2] == other[2]
def __add__(self, other: Coordinate | tuple) -> Coordinate: def __add__(self, other: Coordinate | tuple) -> Coordinate:
if self[2] is None: if self[2] is None:
return self.__class__(self[0] + other[0], self[1] + other[1]) return self.__class__(self[0] + other[0], self[1] + other[1])