Finding neighbor numbers

This commit is contained in:
FrederikBaerentsen 2023-12-03 15:21:06 +01:00
parent 08ab7201ab
commit f14630b3e4

View File

@ -30,15 +30,25 @@ for idx,i in enumerate(arr):
for jdx,j in enumerate(i): for jdx,j in enumerate(i):
tmp = arr[idx][jdx] tmp = arr[idx][jdx]
if tmp.isdigit() == False and tmp != '.': if tmp.isdigit() == False and tmp != '.':
print(tmp) print(tmp + " (" + str(idx) + "," + str(jdx) + ")")
print(idx,jdx)
n = neighbors(4,2) n = neighbors(1,3)
pprint(n)
for i in n: for i in n:
print(i) if arr[i[0]][i[1]].isdigit():
print(arr[i[0]][i[1]]) print(arr[i[0]][i[1]])
ctmp = 0
print(arr[i[0]][i[1]-ctmp])
while arr[i[0]][i[1]-ctmp].isdigit():
print("First neighbor ",end="")
print(arr[i[0]][i[1]-ctmp])
ctmp = ctmp + 1
#print(arr[i[0]][i[1]-ctmp])
#print(i)
#print(i[0])
#print(i[1]-1)
#print(arr[i[0]][i[1]-1])
print()