Moved unused condition to its propper place.
This commit is contained in:
parent
57d731409f
commit
7cff115075
1 changed files with 3 additions and 3 deletions
|
@ -68,7 +68,8 @@ class Planet:
|
|||
|
||||
'''
|
||||
Returns a shortest path between two nodes.
|
||||
Used Algorithm: Dijkstra's Algorithm, will be "replaced" by A* later
|
||||
Used Algorithm: Dijkstra's Algorithm
|
||||
Have a look at heapqueue: https://docs.python.org/2/library/heapq.html
|
||||
Formatting:
|
||||
List = [(total_len, (current_node, [((node), Direction)]))]
|
||||
'''
|
||||
|
@ -87,11 +88,10 @@ class Planet:
|
|||
self.path_found.append(self.path_search[0][1][0])
|
||||
self.path_search.pop(0)
|
||||
if(self.path_search == []): # if map is empty
|
||||
print("Destination is not reachable from start.")
|
||||
break
|
||||
self.path_search.sort()
|
||||
if(self.path_search[0][1][0] == target):
|
||||
return self.path_search[0][1][1]
|
||||
else:
|
||||
print("Destination is not reachable from start.")
|
||||
else:
|
||||
print("Cannot calculate shortest Path. Start or target is not in known.")
|
||||
|
|
Loading…
Reference in a new issue