You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
516 B

lines = open("input.txt", "r").read().splitlines()
drops = set()
for line in lines:
drop = line.split(",")
drop = (int(drop[0]), int(drop[1]), int(drop[2]))
drops.add(drop)
def check_adjacent(drop, drops):
pos = ((0, 0, 1), (0, 1, 0), (1, 0, 0), (0, 0, -1), (0, -1, 0), (-1, 0, 0))
sides = 6
for p in pos:
if (drop[0] + p[0], drop[1] + p[1], drop[2] + p[2]) in drops:
sides -= 1
return sides
s = 0
for drop in drops:
s += check_adjacent(drop, drops)
print(s)