We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c9de97 commit 7572b10Copy full SHA for 7572b10
2020/day_24.py
@@ -36,13 +36,18 @@
36
37
for _ in range(100):
38
new_tiles = {}
39
+ checked = set()
40
for coords in tiles:
41
y, x, z = coords
42
black_adjacent = 0
43
for next_to in directions.values():
44
next_to_coords = (next_to[0] + y, next_to[1] + x, next_to[2] + z)
45
if next_to_coords in tiles:
46
black_adjacent += 1
47
+
48
+ elif next_to_coords in checked:
49
+ pass
50
51
else:
52
double_black_adjacent = 0
53
for double_next_to in directions.values():
@@ -58,9 +63,13 @@
58
63
if double_black_adjacent == 2:
59
64
new_tiles[next_to_coords] = 1
60
65
66
+ checked.add(next_to_coords)
67
61
68
if black_adjacent in (1, 2):
62
69
new_tiles[coords] = 1
70
71
+ checked.add(coords)
72
73
tiles = new_tiles
74
75
# Answer Two
0 commit comments