Projekt_AI-Automatyczny_saper/Engine/Node.py

23 lines
524 B
Python
Raw Normal View History

2021-04-26 21:51:08 +02:00
class Node:
2021-04-27 21:10:01 +02:00
def __init__(self, state, action):
2021-04-26 21:51:08 +02:00
self.state = state
2021-04-27 21:10:01 +02:00
self.action = action
self.parent = None
2021-04-26 21:51:08 +02:00
def getAction(self):
return self.action
def __hash__(self):
"""Overrides the default implementation"""
return hash(self.state)
def __eq__(self, other):
if isinstance(other, self.__class__):
2021-04-27 21:10:01 +02:00
return self.state == other.state
2021-04-26 21:51:08 +02:00
else:
return False
def __ne__(self, other):
return not self.__eq__(other)