Projekt_AI-Automatyczny_saper/Engine/Point.py
2021-04-12 22:54:33 +02:00

27 lines
656 B
Python

class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def getY(self):
return self.y
def getX(self):
return self.x
def distance(self,endpoint):
return abs(self.getX() + endpoint.getX()) + abs(self.getY() + endpoint.getY())
def __hash__(self):
"""Overrides the default implementation"""
return hash(tuple(sorted(self.__dict__.items())))
def __eq__(self, other):
if isinstance(other, self.__class__):
return self.__dict__ == other.__dict__
else:
return False
def __ne__(self, other):
return not self.__eq__(other)