소스 검색

Simplify mod operation.

master
Chris Smith 7 년 전
부모
커밋
359efc30b3
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1
    1
      01.py

+ 1
- 1
01.py 파일 보기

@@ -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…
취소
저장