I have a strange problem, the recommended solution is that we first check if Thor's X position is greater than the light's, if yes we move him West and update his position else if Thor's X position is less than the lights, we move him East and update his position. Same goes with the Y, and at the end we print the direction we got.
My simple question is why this algorithm does not work if we check first if Thor's X position is less than the light's and after that if it's more? Same for the Y. The algorithm should be symmetrical and there should not be any problem if you check if Thor's position is less than the light's.
Does someone have any insight on this because I have been thinking on this all day and cannot figure out why this happens.