Skip to content

Instantly share code, notes, and snippets.

@endrebak
Created February 6, 2020 14:38
Show Gist options
  • Save endrebak/3b5de90facc784c5e3a22b06fb41f40b to your computer and use it in GitHub Desktop.
Save endrebak/3b5de90facc784c5e3a22b06fb41f40b to your computer and use it in GitHub Desktop.
half_window_size = 3
len_haps = 10
# half_window_size += 1
for i in range(0, half_window_size):
for j in range(i):
j1 = i - j
j2 = i + j
if j1 < 0:
break
print(i, j1, j2)
for i in range(half_window_size, len_haps - half_window_size):
for j in range(half_window_size):
j1 = i - j
j2 = i + j
print(i, j1, j2)
for i in range(len_haps - half_window_size, len_haps):
for j in range(i):
j1 = i - j
j2 = i + j
if j2 >= len_haps:
break
print(i, j1, j2)
# 1 1 1
# 2 2 2
# 2 1 3
# 3 3 3
# 3 2 4
# 3 1 5
# 4 4 4
# 4 3 5
# 4 2 6
# 5 5 5
# 5 4 6
# 5 3 7
# 6 6 6
# 6 5 7
# 6 4 8
# 7 7 7
# 7 6 8
# 7 5 9
# 8 8 8
# 8 7 9
# 9 9 9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment