def direction(self, loc1, loc2): 'determine the direction of the next step to take using A*' row1, col1 = loc1 path = heuristic_search(self.graph, loc1, loc2, scott()) try: row2, col2 = path[1] except IndexError: return False # translate into a direction SNEWSNEW! if row1 - row2 == -1: return 's' elif row1 - row2 == 1: return 'n' elif col1 - col2 == -1: return 'e' elif col1 - col2 == 1: return 'w' elif (row1 - row2) > 0: return 's' elif (row1 - row2) < 0: return 'n' elif (col1 - col2) > 0: return 'e' elif (col1 - col2) < 0: return 'w' else: return False
def distance(self, loc1, loc2): return len(heuristic_search(self.graph, loc1, loc2, scott()))