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):
tmp = arr[idx][jdx]
if tmp.isdigit() == False and tmp != '.':
print(tmp)
print(idx,jdx)
print(tmp + " (" + str(idx) + "," + str(jdx) + ")")
n = neighbors(4,2)
pprint(n)
n = neighbors(1,3)
for i in n:
print(i)
print(arr[i[0]][i[1]])
if arr[i[0]][i[1]].isdigit():
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()