Projekt_AI-Automatyczny_saper/Engine/State.py

26 lines
675 B
Python
Raw Normal View History

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