Finished the RouteFinding Pt 0 assignment.

This commit is contained in:
Charles Descamps 2025-02-16 00:02:27 -07:00
parent 54477a4266
commit 45f4f3b707

View file

@ -1,5 +1,15 @@
# Define Searcher, hSLD, SearchNode. # Define Searcher, hSLD, SearchNode.
import DRDViz import DRDViz
import math
def hSLD(node, search):
# take the node value in
# find the node value coordinates
coords = search.nodeLocs[node]
goalCoords = search.nodeLocs[search.endNode]
# calculate the distance between the two points
distance = math.sqrt((abs(int(coords[0]) - int(goalCoords[0])))**2 + abs(int(coords[1]) - int(goalCoords[1]))**2)
return distance
class SearchNode: class SearchNode:
def __init__(self, label, pathcost): def __init__(self, label, pathcost):