Update day 5 solution
This commit is contained in:
@@ -35,12 +35,8 @@ def part_2(input):
|
||||
for y in range(min(y1,y2), max(y1,y2) + 1):
|
||||
field[x][y] += 1
|
||||
elif abs(x1 - x2) == abs(y1 - y2):
|
||||
dx = 1
|
||||
if x1 > x2:
|
||||
dx = -1
|
||||
dy = 1
|
||||
if y1 > y2:
|
||||
dy = -1
|
||||
dx = 1 if x1 < x2 else -1
|
||||
dy = 1 if y1 < y2 else -1
|
||||
for n in range(abs(x1 - x2) + 1):
|
||||
field[x1 + (dx * n)][y1 + (dy * n)] += 1
|
||||
for x in range(1000):
|
||||
|
||||
Reference in New Issue
Block a user