Browse Source

Simplify mod operation.

master
Chris Smith 7 years ago
parent
commit
359efc30b3
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      01.py

+ 1
- 1
01.py View File

@@ -19,7 +19,7 @@ moves = [(movement_lookup[move[0]], int(move[1:])) for move in input.split(', ')
19 19
 heading = 0
20 20
 history = [(0, 0)]
21 21
 for move in moves:
22
-    heading = (heading + move[0] + 4) % 4
22
+    heading = (heading + move[0]) % 4
23 23
     delta = map(operator.mul, direction_lookup[heading], (move[1], move[1]))
24 24
     delta_mag = max(abs(delta[0]), abs(delta[1]))
25 25
     history += zip(steps(history[-1][0], delta[0], delta_mag),

Loading…
Cancel
Save