Browse Source

sligth change to day9

main
Luna Lailatova 1 year ago
parent
commit
91abfe0796
  1. 9
      day9-2.py

9
day9-2.py

@ -66,7 +66,6 @@ def checkDist(): @@ -66,7 +66,6 @@ def checkDist():
two = posTail[z]
tempa = one[1] - two[1]
tempb = one[0] - two[0]
tempc = tempa + tempb
tempd = tempa * tempb
if one[0] == two[0]:
if not(tempa == 1 or tempa == -1):
@ -80,16 +79,16 @@ def checkDist(): @@ -80,16 +79,16 @@ def checkDist():
posTail[z][0] += 1
elif tempb < 0:
posTail[z][0] -= 1
elif (tempc in [-1, 0, 1]) and tempb < 0 and tempd != -1:
elif (tempd in [-2, -4]) and tempb < 0:
posTail[z][0] -= 1
posTail[z][1] += 1
elif tempc in [3, 4]:
elif (tempd in [2, 4]) and tempb > 0:
posTail[z][0] += 1
posTail[z][1] += 1
elif (tempc in [-1, 0, 1]) and tempb > 0 and tempd != -1:
elif (tempd in [-2, -4]) and tempb > 0:
posTail[z][0] += 1
posTail[z][1] -= 1
elif tempc in [-4, -3]:
elif (tempd in [2, 4]) and tempb < 0:
posTail[z][0] -= 1
posTail[z][1] -= 1

Loading…
Cancel
Save