mirror of
https://github.com/ershisan99/advent-of-code.git
synced 2025-12-16 12:32:49 +00:00
2015 day 6 refactored a bit
This commit is contained in:
@@ -21,10 +21,7 @@ for line in lines:
|
|||||||
if instruction == "turn on":
|
if instruction == "turn on":
|
||||||
lights[(i, j)] += 1
|
lights[(i, j)] += 1
|
||||||
elif instruction == "turn off":
|
elif instruction == "turn off":
|
||||||
if lights[(i, j)] == 0:
|
lights[(i, j)] = max(0, lights[(i, j)] - 1)
|
||||||
continue
|
|
||||||
else:
|
|
||||||
lights[(i, j)] -= 1
|
|
||||||
else:
|
else:
|
||||||
lights[(i, j)] += 2
|
lights[(i, j)] += 2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user