day17: if velX == 0 and posX < minX, you'll never reach the target
This commit is contained in:
parent
0a0c829454
commit
c2f01add9f
2
day17.py
2
day17.py
@ -7,6 +7,8 @@ def fire(velX: int, velY: int, minX: int, maxX: int, minY: int, maxY: int) -> (b
|
|||||||
while not posX > maxX and not posY < minY:
|
while not posX > maxX and not posY < minY:
|
||||||
if velX > 0:
|
if velX > 0:
|
||||||
velX -= 1
|
velX -= 1
|
||||||
|
elif posX < minX:
|
||||||
|
break
|
||||||
velY -= 1
|
velY -= 1
|
||||||
|
|
||||||
posX += velX
|
posX += velX
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user