Created
October 20, 2019 19:58
-
-
Save daaray/cb87368d11771ae093fe1ac366848563 to your computer and use it in GitHub Desktop.
This file contains 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
for x in range(1 - end): | |
choices = [] | |
for y in [y-1, y, y+1]: | |
choices.append({ | |
'x': x, 'y': y, 'delta': abs(elevation - self.matrix[y][x]) | |
}) | |
min_delta = min([choice['delta'] for choice in choices]) | |
next_step = next((item for item in choices if item['delta'] == min_delta), None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment