16 lines
350 B
Python
16 lines
350 B
Python
|
class Node:
|
||
|
def __init__(self, parent, state_tuple, cost):
|
||
|
self._cost = cost
|
||
|
self._action = state_tuple[0]
|
||
|
self._state = state_tuple[1]
|
||
|
self._parent = parent
|
||
|
|
||
|
def get_predecessor(self):
|
||
|
return self._parent
|
||
|
|
||
|
def set_predecessor(self, predecessor):
|
||
|
self._parent = predecessor
|
||
|
|
||
|
def __lt__(self, other):
|
||
|
return self._cost < other._cost
|