2021-04-26 21:51:08 +02:00
|
|
|
from Constants import RIGHT, LEFT, UP, DOWN
|
2021-04-26 20:24:52 +02:00
|
|
|
class State:
|
|
|
|
|
2021-04-26 21:51:08 +02:00
|
|
|
def __init__(self, direction, point):
|
|
|
|
self.direction = direction
|
2021-04-26 20:24:52 +02:00
|
|
|
self.point = point
|
|
|
|
|
|
|
|
def getPoint(self):
|
|
|
|
return self.point
|
|
|
|
|
2021-04-26 21:51:08 +02:00
|
|
|
def getDirection(self):
|
|
|
|
return self.direction
|
2021-04-26 20:24:52 +02:00
|
|
|
|
2021-04-26 21:51:08 +02:00
|
|
|
def __hash__(self):
|
|
|
|
"""Overrides the default implementation"""
|
|
|
|
return hash(tuple(sorted(self.__dict__.items())))
|
2021-04-26 20:24:52 +02:00
|
|
|
|
2021-04-26 21:51:08 +02:00
|
|
|
def __eq__(self, other):
|
|
|
|
if isinstance(other, self.__class__):
|
2021-04-27 21:10:01 +02:00
|
|
|
return self.point == other.point and self.direction == other.direction
|
2021-04-26 21:51:08 +02:00
|
|
|
else:
|
|
|
|
return False
|
|
|
|
|
|
|
|
def __ne__(self, other):
|
|
|
|
return not self.__eq__(other)
|