26 lines
675 B
Python
26 lines
675 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.__dict__ == other.__dict__ and self.point.__eq__(other.point)
|
|
else:
|
|
return False
|
|
|
|
def __ne__(self, other):
|
|
return not self.__eq__(other)
|