From 9c01ca2bcd39deedbd1c2e53dfa5ad09128a02b6 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Fri, 16 Dec 2022 00:57:21 +1030 Subject: [PATCH] sort sensors by iteration axis --- 2022/day15.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/2022/day15.py b/2022/day15.py index f5d4d1b..e1abaf5 100644 --- a/2022/day15.py +++ b/2022/day15.py @@ -46,11 +46,10 @@ def do_sensors_2(lines: list[str], search_space: int): continue distance = abs(x-nx) + abs(y-ny) sensors.append((x, y, distance)) + sensors.sort(key=lambda x: x[0]) # print(sensors) for x in range(0, search_space+1): - # if x % 100_000 == 0: - # print(f'Processed {x} rows') y = 0 while y <= search_space: y_skip = in_range_of_sensors(sensors, x, y)