optimalized astar
This commit is contained in:
parent
ba2ed3705d
commit
9d9c1aaa4c
4
astar.py
4
astar.py
@ -17,9 +17,9 @@ def astar(istate, goalx, goaly, passedFields):
|
||||
return steps
|
||||
|
||||
element = successors(state, passedFields, goalx, goaly)
|
||||
explored.add((state.xpos, state.ypos, state.orientation, state.priority))
|
||||
explored.add((state.xpos, state.ypos, state.orientation))
|
||||
for value in element:
|
||||
val = (value.xpos, value.ypos, value.orientation, value.priority)
|
||||
val = (value.xpos, value.ypos, value.orientation)
|
||||
if val in explored:
|
||||
continue
|
||||
cost = state.priority + value.priority
|
||||
|
Loading…
Reference in New Issue
Block a user