File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,10 @@ describe('it should solve part 1 and part 2', () => {
34
34
expect ( rotations [ 0 ] ( { waypoint : { x : 1 , y : 3 } } ) ) . toEqual ( { waypoint : { x : 1 , y : 3 } } ) ;
35
35
expect ( rotations [ 1 ] ( { waypoint : { x : 1 , y : 3 } } ) ) . toEqual ( { waypoint : { x : 3 , y : - 1 } } ) ;
36
36
expect ( rotations [ 2 ] ( { waypoint : { x : 1 , y : 3 } } ) ) . toEqual ( { waypoint : { x : - 1 , y : - 3 } } ) ;
37
- expect ( rotations [ 3 ] ( { waypoint : { x : 1 , y : 3 } } ) ) . toEqual ( { waypoint : { x : 3 , y : 1 } } ) ;
37
+ expect ( rotations [ 3 ] ( { waypoint : { x : 1 , y : 3 } } ) ) . toEqual ( { waypoint : { x : - 3 , y : 1 } } ) ;
38
38
expect ( rotations [ 1 ] ( { waypoint : { x : 10 , y : 4 } } ) ) . toEqual ( { waypoint : { x : 4 , y : - 10 } } ) ;
39
39
expect ( rotations [ 2 ] ( { waypoint : { x : 10 , y : 4 } } ) ) . toEqual ( { waypoint : { x : - 10 , y : - 4 } } ) ;
40
- expect ( rotations [ 3 ] ( { waypoint : { x : 10 , y : 4 } } ) ) . toEqual ( { waypoint : { x : 4 , y : 10 } } ) ;
40
+ expect ( rotations [ 3 ] ( { waypoint : { x : 10 , y : 4 } } ) ) . toEqual ( { waypoint : { x : - 4 , y : 10 } } ) ;
41
41
} ) ;
42
42
test ( 'it should solve example 1' , ( ) => {
43
43
expect ( util1 ( input1 ) ) . toEqual ( 25 ) ;
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ const rotations = {
58
58
} ,
59
59
3 : ( { ship, waypoint } ) => {
60
60
const { x, y } = waypoint ;
61
- waypoint . x = y ;
61
+ waypoint . x = - y ;
62
62
waypoint . y = x ;
63
63
return { ship, waypoint } ;
64
64
} ,
@@ -115,7 +115,6 @@ const util2 = (input) => {
115
115
const { ship, waypoint } = input . reduce (
116
116
( { ship, waypoint } , instruction ) => {
117
117
const [ , letter , number ] = instruction . match ( / ( [ N S E W L R F ] ) ( \d + ) / ) || [ ] ;
118
- console . log ( letter , number , ship , waypoint ) ;
119
118
return instructions2 [ letter ] ( Number ( number ) , { ship, waypoint } ) ;
120
119
} ,
121
120
{
@@ -129,7 +128,6 @@ const util2 = (input) => {
129
128
} ,
130
129
} ,
131
130
) ;
132
- console . log ( { ship, waypoint } ) ;
133
131
return manhattanDistance ( ship ) ;
134
132
} ;
135
133
You can’t perform that action at this time.
0 commit comments