better variable names

This commit is contained in:
a 2020-12-17 13:12:54 -06:00
parent 12e4a4b1c7
commit da2f849986

View file

@ -12,9 +12,9 @@ def main(d):
neighboring = [()] # list contains empty tuple which will be iterated over
for _ in range(d):
neighboring = [
t + (x,)
for x in [-1, 0, 1]
for t in neighboring
_tuple + (offset,)
for offset in [-1, 0, 1]
for _tuple in neighboring
]
neighboring.remove(d * (0,)) # this is the center cell
@ -22,13 +22,13 @@ def main(d):
from collections import Counter
for _ in range(6):
active = set(
t
for t, count in Counter( # unpack the tuple and its count of neighboring active cells
tuple(map(sum, zip(t, n))) # add neighbors kernel to each active cell
for t in active
for n in neighboring
_tuple
for _tuple, count in Counter( # unpack the tuple and its count of neighboring active cells
tuple(map(sum, zip(_tuple, offset))) # add neighbors kernel to each active cell
for _tuple in active
for offset in neighboring
).items()
if count == 3 or t in active and count == 2
if count == 3 or _tuple in active and count == 2
)
return len(active)