소스 검색

Optimise day 14.

No point checking for connected nodes in +x or +y directions,
as we haven't processed them yet.
master
Chris Smith 6 년 전
부모
커밋
d9750988e3
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    1
      14.py

+ 1
- 1
14.py 파일 보기

@@ -9,5 +9,5 @@ with open('data/14.txt', 'r') as file:
9 9
     for y, row in enumerate(grid):
10 10
         for x, cell in enumerate(row):
11 11
             if cell == '1':
12
-                add_connected_components(regions, [(x-1, y), (x, y-1), (x+1, y), (x, y+1)], {(x, y)})
12
+                add_connected_components(regions, [(x-1, y), (x, y-1)], {(x, y)})
13 13
     print(f'Part two: {len(regions)}')

Loading…
취소
저장