2022-04-07 00:55:36 +02:00
|
|
|
class Node:
|
2022-04-24 11:18:17 +02:00
|
|
|
def __init__(self, parent, action, state_array, cost):
|
2022-04-07 00:55:36 +02:00
|
|
|
self.parent = parent
|
2022-04-16 00:11:24 +02:00
|
|
|
self.action = action
|
2022-04-07 00:55:36 +02:00
|
|
|
self.position = state_array
|
2022-04-24 11:18:17 +02:00
|
|
|
self.cost = cost
|
2022-04-07 05:33:10 +02:00
|
|
|
|
2022-04-07 00:55:36 +02:00
|
|
|
def get_position(self):
|
|
|
|
return self.position
|
|
|
|
|
|
|
|
def get_action(self):
|
|
|
|
return self.action
|
|
|
|
|
|
|
|
def get_parent(self):
|
|
|
|
return self.parent
|
|
|
|
|
|
|
|
def set_parent(self, parent):
|
|
|
|
self.parent = parent
|
|
|
|
|
2022-04-24 11:18:17 +02:00
|
|
|
def get_cost(self):
|
|
|
|
return self.cost
|
2022-04-07 00:55:36 +02:00
|
|
|
|
2022-04-28 09:32:14 +02:00
|
|
|
def __lt__(self, other):
|
|
|
|
return self.cost < other.get_cost()
|
|
|
|
|