From a3e4290ccd2923a201d1347bc13bbe92ab4f4a21 Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Thu, 8 Dec 2022 22:08:51 -0800 Subject: [PATCH] day 8 python slight cleanup --- day08/sol2.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/day08/sol2.py b/day08/sol2.py index f741a18..c539562 100644 --- a/day08/sol2.py +++ b/day08/sol2.py @@ -6,36 +6,30 @@ scores = [] for ii in range(len(data)): for jj in range(len(data[ii])): top = data[ii][jj] - h = -1 a = 0 + i = ii for j in range(jj+1, len(data[ii])): a += 1 - h = data[ii][j] - if h >= top: + if data[i][j] >= top: break b = 0 - h = -1 for j in reversed(range(0, jj)): b += 1 - h = data[ii][j] - if h >= top: + if data[i][j] >= top: break + j = jj c = 0 - h = -1 for i in range(ii+1, len(data)): c += 1 - h = data[i][jj] - if h >= top: + if data[i][j] >= top: break d = 0 - h = -1 for i in reversed(range(0, ii)): d += 1 - h = data[i][jj] - if h >= top: + if data[i][j] >= top: break print(ii,jj,a,b,c,d)