From 91abfe0796dbe8f61e54743d392bf3ec2d78c487 Mon Sep 17 00:00:00 2001 From: Luna Lailatova Date: Fri, 9 Dec 2022 22:59:41 +0100 Subject: [PATCH] sligth change to day9 --- day9-2.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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