CodinGame, update your parser!
I was using PHP to solve this, and had the math for direction calculation run through two Switch statements (one each for X and Y of Light). My code passed test cases 1, 2, and 4. On 3, Thor would always go East instead of West.
I double and triple-checked my code, read through this entire forum, then checked my code again.
For the heck of it, I changed my elegant switch statements over to a group of ugly IF statements, and voila! It passed all test cases and I even got a 100% score after submitting.
So to reiterate, please update your PHP parsers, because I had to DUMB DOWN MY CODE to pass this test.