Skip to content

Commit bb79269

Browse files
committed
Pathfinding: Added a small fix (ugly but works)
1 parent 4c612b2 commit bb79269

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

2019/pathfinding.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,12 @@ def dijkstra(self, start, end=None):
513513
continue
514514

515515
# Adding for future examination
516-
heapq.heappush(frontier, (current_distance + weight, neighbor))
516+
if type(neighbor) == complex:
517+
heapq.heappush(
518+
frontier, (current_distance + weight, SuperComplex(neighbor))
519+
)
520+
else:
521+
heapq.heappush(frontier, (current_distance + weight, neighbor))
517522

518523
# Adding for final search
519524
self.distance_from_start[neighbor] = current_distance + weight

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy