-
-
Save Peilonrayz/acf46dfe7e2bf5745736851efb799abc 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
def calculate_distance(start: Node, end: Node, starts: Set[int]): | |
turns = 0 | |
position = start.end | |
while position < end.start: | |
delta = None | |
for delta in range(6, 0, -1): | |
pos = position + delta | |
if pos not in starts or pos == end.start: | |
break | |
else: | |
return | |
turns += 1 | |
position += delta | |
start.edges.append(Edge(turns, end)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment