day17: if velX == 0 and posX < minX, you'll never reach the target

This commit is contained in:
Stefan Harmuth 2021-12-17 07:14:52 +01:00
parent 0a0c829454
commit c2f01add9f

View File

@ -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:
if velX > 0:
velX -= 1
elif posX < minX:
break
velY -= 1
posX += velX