23 lines
524 B
Python
23 lines
524 B
Python
class Node:
|
|
|
|
def __init__(self, state, action):
|
|
self.state = state
|
|
self.action = action
|
|
self.parent = 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.state == other.state
|
|
else:
|
|
return False
|
|
|
|
def __ne__(self, other):
|
|
return not self.__eq__(other) |