@@ -5,26 +5,26 @@ class PlanarMap
5
5
def self . forwards ( location , direction = location . direction )
6
6
case direction
7
7
when 'N'
8
- Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y + 1 ) , direction : direction )
8
+ Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y + 1 ) , direction : location . direction )
9
9
when 'E'
10
- Location . new ( coordinates : Coordinates . new ( x : ( location . x + 1 ) % 36 , y : location . y ) , direction : direction )
10
+ Location . new ( coordinates : Coordinates . new ( x : ( location . x + 1 ) % 36 , y : location . y ) , direction : location . direction )
11
11
when 'S'
12
- Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y - 1 ) , direction : direction )
12
+ Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y - 1 ) , direction : location . direction )
13
13
when 'W'
14
- Location . new ( coordinates : Coordinates . new ( x : ( location . x - 1 ) % 36 , y : location . y ) , direction : direction )
14
+ Location . new ( coordinates : Coordinates . new ( x : ( location . x - 1 ) % 36 , y : location . y ) , direction : location . direction )
15
15
end
16
16
end
17
17
18
18
def self . backwards ( location , direction = location . direction )
19
19
case direction
20
20
when 'N'
21
- Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y - 1 ) , direction : direction )
21
+ Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y - 1 ) , direction : location . direction )
22
22
when 'E'
23
- Location . new ( coordinates : Coordinates . new ( x : ( location . x - 1 ) % 36 , y : location . y ) , direction : direction )
23
+ Location . new ( coordinates : Coordinates . new ( x : ( location . x - 1 ) % 36 , y : location . y ) , direction : location . direction )
24
24
when 'S'
25
- Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y + 1 ) , direction : direction )
25
+ Location . new ( coordinates : Coordinates . new ( x : location . x , y : location . y + 1 ) , direction : location . direction )
26
26
when 'W'
27
- Location . new ( coordinates : Coordinates . new ( x : ( location . x + 1 ) % 36 , y : location . y ) , direction : direction )
27
+ Location . new ( coordinates : Coordinates . new ( x : ( location . x + 1 ) % 36 , y : location . y ) , direction : location . direction )
28
28
end
29
29
end
30
30
0 commit comments