Projekt_AI-Automatyczny_saper/Engine/State.py
2021-04-27 21:10:01 +02:00

26 lines
673 B
Python

from Constants import RIGHT, LEFT, UP, DOWN
class State:
def __init__(self, direction, point):
self.direction = direction
self.point = point
def getPoint(self):
return self.point
def getDirection(self):
return self.direction
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.point == other.point and self.direction == other.direction
else:
return False
def __ne__(self, other):
return not self.__eq__(other)