diff --git a/RouteFinding/05_tests.py b/RouteFinding/05_tests.py index d3febba..5fbc049 100644 --- a/RouteFinding/05_tests.py +++ b/RouteFinding/05_tests.py @@ -1,5 +1,15 @@ # Define Searcher, hSLD, SearchNode. 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: def __init__(self, label, pathcost):