diff --git a/day9-2.py b/day9-2.py index 9e05322..23c2140 100644 --- a/day9-2.py +++ b/day9-2.py @@ -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(): 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