Added matrix for part1 and neighbor function

This commit is contained in:
FrederikBaerentsen 2023-12-03 07:56:29 +01:00
parent b7b359d3f8
commit 08ab7201ab

View File

@ -25,5 +25,20 @@ neighbors = lambda x, y : [(x2, y2) for x2 in range(x-1, x+2)
(x != x2 or y != y2) and (x != x2 or y != y2) and
(0 <= x2 <= X) and (0 <= x2 <= X) and
(0 <= y2 <= Y))] (0 <= y2 <= Y))]
pprint(neighbors(4,2))
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)
n = neighbors(4,2)
pprint(n)
for i in n:
print(i)
print(arr[i[0]][i[1]])