Browse Source

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 years ago
parent
commit
d9750988e3
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      14.py

+ 1
- 1
14.py View File

@@ -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…
Cancel
Save