Madra_smieciarka/classes/Node.py

32 lines
682 B
Python
Raw Normal View History

class Node:
def __init__(self, state):
self.state = state
self.action = ""
self.parent: Node = None
2024-04-27 22:59:39 +02:00
self.cost = 0
def getState(self):
return self.state
def getAction(self):
return self.action
def setAction(self, action):
self.action = action
return self
def getParent(self):
return self.parent if self.parent else False
def setParent(self, parent):
self.parent = parent
return self
2024-04-27 21:55:48 +02:00
2024-04-27 22:59:39 +02:00
def getCost(self):
return self.cost
def setCost(self, cost):
self.cost = cost
2024-04-27 21:55:48 +02:00
def __lt__(self, other):
return self.getState() < other.getState()