本文整理汇总了Python中State.State.get_children方法的典型用法代码示例。如果您正苦于以下问题:Python State.get_children方法的具体用法?Python State.get_children怎么用?Python State.get_children使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类State.State
的用法示例。
在下文中一共展示了State.get_children方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remove_recursively
# 需要导入模块: from State import State [as 别名]
# 或者: from State.State import get_children [as 别名]
def remove_recursively(self,queue):
if(len(queue) == 0):
return
front = queue.pop(0)
best_state = front[0]
child = front[1]
weight = front[2]
old_state = self.get_from_closed_list(str(child),best_state.direction)
if(old_state.g_score > best_state.g_score + weight):
if(best_state.direction):
n_state = State(child,best_state.g_score + weight,best_state.value,self.goal,best_state.direction,self.scale)
else:
n_state = State(child,best_state.g_score + weight,best_state.value,self.start,best_state.direction,self.scale)
self.put_in_closed_list(n_state)
new_values = n_state.get_children()
for edge in new_values:
n_child = edge[0]
n_weight = edge[1]
if(self.OL.is_contained(n_child)):
self.OL.update(n_child,n_weight+n_state.g_score,n_state.value,n_state.direction)
elif(str(n_child) in self.CL.keys()):
queue.append((n_state,n_child,n_weight))
else:
print("LOGICAL ERROR OCCURED")
self.remove_recursively(queue)