Created
September 1, 2019 22:10
-
-
Save fakemonk1/ec34e94e24ee68d2189b1557d98bd853 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_manhattan_heuristic(node, goal): | |
i, j = divmod(int(node), 8) | |
i_goal, j_goal = divmod(int(goal), 8) | |
i_delta = abs(i - i_goal) | |
j_delta = abs(j - j_goal) | |
manhattan_dist = i_delta + j_delta | |
return manhattan_dist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment