Moved unused condition to its propper place.

This commit is contained in:
d3rped 2018-03-21 14:44:55 +01:00
parent 57d731409f
commit 7cff115075

View file

@ -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.")