MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / heuristic_1

Function heuristic_1

graphs/multi_heuristic_astar.py:71–73  ·  view source on GitHub ↗
(p: TPos, goal: TPos)

Source from the content-addressed store, hash-verified

69
70
71def heuristic_1(p: TPos, goal: TPos):
72 # manhattan distance
73 return abs(p[0] - goal[0]) + abs(p[1] - goal[1])
74
75
76def key(start: TPos, i: int, goal: TPos, g_function: dict[TPos, float]):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected