22 lines
528 B
Python
22 lines
528 B
Python
|
class Node:
|
||
|
|
||
|
def __init__(self, state):
|
||
|
self.state = state
|
||
|
self.action = None
|
||
|
|
||
|
|
||
|
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__):
|
||
|
return self.__dict__ == other.__dict__ and self.state.__eq__(other.state)
|
||
|
else:
|
||
|
return False
|
||
|
|
||
|
def __ne__(self, other):
|
||
|
return not self.__eq__(other)
|