day 8 python slight cleanup

main
magical 2022-12-08 22:08:51 -08:00
parent 117d3d58d5
commit a3e4290ccd
1 changed files with 6 additions and 12 deletions

View File

@ -6,36 +6,30 @@ scores = []
for ii in range(len(data)): for ii in range(len(data)):
for jj in range(len(data[ii])): for jj in range(len(data[ii])):
top = data[ii][jj] top = data[ii][jj]
h = -1
a = 0 a = 0
i = ii
for j in range(jj+1, len(data[ii])): for j in range(jj+1, len(data[ii])):
a += 1 a += 1
h = data[ii][j] if data[i][j] >= top:
if h >= top:
break break
b = 0 b = 0
h = -1
for j in reversed(range(0, jj)): for j in reversed(range(0, jj)):
b += 1 b += 1
h = data[ii][j] if data[i][j] >= top:
if h >= top:
break break
j = jj
c = 0 c = 0
h = -1
for i in range(ii+1, len(data)): for i in range(ii+1, len(data)):
c += 1 c += 1
h = data[i][jj] if data[i][j] >= top:
if h >= top:
break break
d = 0 d = 0
h = -1
for i in reversed(range(0, ii)): for i in reversed(range(0, ii)):
d += 1 d += 1
h = data[i][jj] if data[i][j] >= top:
if h >= top:
break break
print(ii,jj,a,b,c,d) print(ii,jj,a,b,c,d)