2015 day 6 refactored a bit

This commit is contained in:
2024-12-15 21:32:54 +01:00
parent a346958b29
commit 1c3cb46e40

View File

@@ -21,10 +21,7 @@ for line in lines:
if instruction == "turn on":
lights[(i, j)] += 1
elif instruction == "turn off":
if lights[(i, j)] == 0:
continue
else:
lights[(i, j)] -= 1
lights[(i, j)] = max(0, lights[(i, j)] - 1)
else:
lights[(i, j)] += 2