-
Notifications
You must be signed in to change notification settings - Fork 0
/
11.js
71 lines (57 loc) · 23.3 KB
/
11.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
let calcSteps = (input) => {
let pos = input.split(',')
.map(instr => instr)
.reduce((av, cv) => {
let dir;
switch(cv) {
case 'nw': dir = [-1,-1]; break;
case 'n': dir = [0,-2]; break;
case 'ne': dir = [1,-1]; break;
case 'sw': dir = [-1,1]; break;
case 's': dir = [0,2]; break;
case 'se': dir = [1,1]; break;
default:
throw new Error('unhandled instr: ' + cv);
}
av.x = av.x + dir[0];
av.y = av.y + dir[1];
return av;
}, { x: 0, y: 0 });
let getDirection = (pos) => {
let best;
let bestDist = -1;
for (let x = -1; x < 2; x++) {
for (let y = -1; y < 2; y++) {
let disallowed = (x === -1 && y === 0) || (x === 1 && y === 0);
if (disallowed)
continue;
let p = { ...pos };
if (x === 0 && y === -1)
p.y--;
if (x === 0 && y === 1)
p.y++;
p.x += x;
p.y += y;
let dist = Math.sqrt(p.x*p.x + p.y*p.y);
if (dist < bestDist || bestDist === -1) {
bestDist = dist;
best = { x: p.x, y: p.y };
}
}
}
return best;
};
let steps = 0;
while (pos.x !== 0 || pos.y !== 0) {
let nextPos = getDirection(pos);
pos = nextPos;
steps++;
}
return steps;
};
// console.log(calcSteps(`ne,ne,ne`));
// console.log(calcSteps(`ne,ne,sw,sw`));
// console.log(calcSteps(`ne,ne,s,s`));
// console.log(calcSteps(`se,sw,se,sw,sw`));
let r = calcSteps(`s,ne,ne,ne,se,se,se,s,s,s,s,s,s,s,sw,s,s,sw,sw,sw,sw,sw,sw,sw,n,s,ne,nw,nw,nw,nw,nw,se,nw,nw,nw,nw,ne,n,n,nw,nw,n,nw,n,n,nw,n,ne,nw,nw,n,n,n,n,n,s,n,n,n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se,se,se,ne,sw,sw,se,se,ne,ne,se,se,se,se,se,nw,se,se,se,se,sw,se,s,se,sw,se,se,se,se,n,se,ne,s,se,ne,se,se,se,se,se,ne,ne,se,ne,ne,n,se,se,sw,se,se,nw,se,ne,n,se,n,se,sw,se,sw,se,se,se,nw,se,se,se,se,s,nw,sw,nw,se,se,se,ne,se,n,ne,se,se,se,se,se,se,se,se,se,se,nw,se,ne,se,se,se,nw,se,se,se,se,se,se,s,se,se,se,s,se,sw,nw,se,se,sw,se,se,se,se,se,n,se,se,se,se,ne,sw,se,se,sw,se,nw,n,ne,se,s,s,n,s,s,nw,se,ne,se,se,s,se,se,se,se,sw,se,se,se,se,s,se,se,se,se,se,se,se,se,se,se,se,se,s,se,n,n,se,se,se,se,ne,se,se,se,s,se,se,se,se,se,se,se,se,se,se,se,se,s,nw,se,se,s,se,s,se,s,se,se,se,s,se,se,se,se,se,se,n,ne,se,n,s,se,se,sw,nw,nw,se,se,se,se,se,s,se,ne,se,s,se,se,n,s,se,s,se,s,se,s,se,se,s,s,s,se,se,se,s,se,se,s,se,nw,ne,s,s,se,se,se,ne,se,se,s,se,se,se,se,se,nw,se,se,se,ne,se,s,se,se,se,se,se,se,s,s,se,s,nw,s,n,se,s,se,se,se,se,nw,s,se,s,s,se,se,se,ne,s,s,se,s,s,s,se,se,sw,s,se,se,sw,nw,s,s,se,se,se,se,se,ne,s,s,se,s,s,se,s,sw,sw,s,se,s,se,se,s,se,s,n,s,s,nw,nw,s,s,se,s,s,se,se,se,s,s,ne,se,se,n,ne,se,s,nw,s,se,s,s,n,se,se,ne,ne,se,s,s,se,se,se,se,se,se,se,s,se,s,se,s,se,se,s,sw,s,se,sw,se,s,s,n,s,s,s,s,nw,n,s,s,s,se,s,s,s,s,s,se,nw,s,se,s,s,nw,s,se,s,s,s,se,se,s,s,se,se,se,s,s,se,s,s,sw,se,se,se,s,se,se,n,s,s,s,se,s,s,nw,s,ne,nw,se,s,s,se,nw,se,ne,se,se,se,s,s,se,se,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nw,s,s,s,se,s,n,ne,nw,se,ne,s,s,s,n,s,nw,s,s,s,sw,sw,ne,s,se,se,s,s,s,sw,s,s,se,s,s,s,ne,s,s,se,s,s,s,se,n,s,s,s,s,s,ne,s,s,s,s,s,s,s,s,n,s,s,s,s,s,s,s,se,s,s,s,se,s,s,s,s,se,se,s,sw,nw,s,nw,s,s,se,s,n,s,se,n,sw,s,sw,sw,se,s,se,s,s,s,s,s,s,s,s,s,s,se,s,se,sw,s,s,se,s,s,s,s,se,s,s,nw,s,s,n,n,s,s,se,se,se,s,se,nw,s,s,se,s,se,se,s,s,s,nw,nw,se,n,se,n,se,se,s,s,n,s,sw,s,s,s,s,s,se,n,s,se,ne,s,s,s,sw,se,n,s,s,s,s,s,s,s,n,se,s,s,s,s,s,s,s,s,s,se,s,sw,s,se,ne,sw,nw,s,s,nw,s,s,s,se,s,s,sw,se,s,s,s,ne,se,s,s,s,s,s,s,sw,se,nw,se,se,s,sw,s,ne,se,s,se,se,se,s,se,se,se,n,se,sw,s,s,s,se,s,s,se,s,s,s,s,s,se,se,se,s,se,se,se,s,se,se,s,s,s,se,s,s,s,s,se,se,s,s,s,se,se,s,s,n,se,s,s,nw,se,se,se,se,nw,se,s,se,s,s,se,se,n,s,sw,nw,s,s,se,se,se,s,se,n,s,se,s,se,n,se,se,se,se,s,se,nw,s,se,s,n,s,se,se,s,se,se,ne,s,ne,se,se,se,s,nw,se,nw,s,se,s,s,se,se,nw,s,se,s,se,se,sw,se,s,s,se,se,se,ne,se,s,se,s,se,se,se,se,se,se,se,s,se,s,se,se,s,se,s,nw,ne,se,nw,se,se,s,se,se,s,ne,se,se,se,s,se,se,se,se,s,se,se,se,se,s,se,se,se,se,se,se,se,se,s,se,se,se,nw,s,se,s,n,s,se,se,se,se,s,s,se,se,nw,se,n,ne,se,nw,se,s,s,se,se,n,sw,ne,s,se,se,sw,s,s,se,n,se,se,s,ne,s,se,se,se,se,se,sw,se,se,se,se,se,ne,s,ne,se,s,sw,se,se,se,se,se,se,s,se,s,s,se,sw,se,se,se,se,nw,se,se,nw,se,ne,s,se,sw,se,se,se,s,se,sw,se,se,se,se,sw,se,se,sw,se,se,se,se,se,nw,ne,sw,ne,se,s,se,sw,se,se,se,se,se,se,ne,se,sw,se,se,se,se,se,sw,se,se,se,se,se,se,se,se,se,ne,se,se,n,se,n,s,se,se,se,se,se,se,se,nw,se,se,se,sw,se,se,se,se,ne,se,se,se,se,se,se,s,se,se,ne,s,ne,se,s,se,se,nw,se,se,sw,se,se,se,se,se,se,se,se,se,se,nw,ne,se,se,ne,se,se,se,se,se,se,n,se,se,se,se,ne,sw,se,se,ne,se,ne,se,nw,se,se,se,n,se,se,sw,se,s,se,se,se,se,se,se,se,se,ne,se,se,se,s,se,se,se,ne,se,nw,n,se,se,nw,ne,se,se,se,se,se,se,ne,ne,nw,se,se,se,ne,se,se,ne,n,se,se,se,se,ne,se,ne,ne,se,n,nw,se,se,s,ne,se,se,se,ne,se,se,se,se,se,s,ne,se,se,nw,se,se,se,sw,se,n,se,se,se,s,ne,se,se,se,se,se,n,n,se,se,se,se,ne,nw,se,se,ne,n,se,ne,se,se,ne,ne,se,ne,n,s,ne,se,se,se,se,ne,s,s,se,se,se,se,se,ne,se,ne,ne,ne,se,sw,s,se,s,ne,se,ne,ne,se,ne,se,se,se,se,ne,se,se,se,ne,sw,nw,se,se,s,se,nw,se,se,nw,s,se,se,se,se,se,se,nw,se,se,se,nw,ne,ne,se,se,n,se,se,se,nw,se,s,nw,ne,ne,ne,se,ne,se,se,se,ne,se,se,ne,ne,ne,nw,se,se,nw,ne,se,ne,n,se,ne,ne,ne,ne,ne,se,sw,ne,se,s,sw,se,nw,ne,se,se,se,se,se,sw,se,se,s,ne,se,se,ne,se,se,ne,se,nw,ne,se,se,se,se,se,ne,ne,se,se,se,ne,se,se,ne,ne,se,se,n,ne,ne,se,ne,se,se,ne,ne,n,ne,se,ne,se,ne,s,se,ne,se,sw,ne,ne,s,ne,n,ne,se,se,ne,ne,ne,se,se,se,se,sw,se,s,ne,nw,ne,ne,ne,se,se,se,ne,ne,nw,se,se,ne,se,nw,se,nw,se,se,nw,se,se,ne,ne,se,se,se,se,ne,ne,ne,ne,sw,se,ne,ne,se,ne,se,ne,se,se,ne,ne,ne,ne,ne,se,se,se,se,se,sw,ne,se,n,se,n,nw,se,se,sw,se,ne,se,ne,ne,ne,ne,nw,ne,se,se,ne,ne,se,ne,ne,se,ne,ne,ne,ne,se,ne,sw,se,se,n,ne,se,ne,ne,sw,ne,ne,ne,se,se,se,se,se,ne,ne,se,n,se,n,sw,se,se,se,se,ne,se,se,se,se,ne,se,se,se,ne,n,n,ne,se,se,ne,ne,ne,nw,ne,se,ne,se,ne,n,se,ne,nw,ne,se,ne,s,ne,ne,ne,se,ne,sw,ne,se,se,se,ne,ne,ne,se,s,se,ne,n,n,ne,se,se,ne,ne,ne,se,ne,n,ne,s,ne,ne,s,ne,se,ne,se,ne,ne,nw,se,ne,ne,se,nw,ne,ne,se,sw,ne,se,ne,ne,s,se,ne,ne,ne,ne,se,se,ne,n,s,se,ne,s,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,nw,n,ne,ne,n,se,ne,ne,ne,ne,ne,n,ne,se,ne,ne,se,ne,ne,nw,ne,se,ne,se,s,se,ne,ne,ne,ne,ne,ne,ne,s,ne,ne,ne,ne,ne,ne,se,ne,ne,ne,nw,ne,se,ne,ne,ne,ne,ne,nw,ne,nw,ne,ne,s,se,n,ne,ne,ne,se,ne,ne,ne,ne,ne,ne,nw,ne,s,sw,ne,ne,ne,ne,ne,ne,ne,se,se,se,ne,n,ne,ne,ne,ne,ne,n,ne,ne,ne,ne,ne,ne,ne,s,ne,ne,ne,ne,ne,ne,ne,ne,ne,ne,se,ne,se,ne,n,ne,se,ne,ne,ne,se,n,ne,ne,ne,ne,se,ne,ne,ne,ne,se,sw,ne,ne,se,se,ne,ne,n,nw,ne,se,ne,ne,ne,ne,ne,ne,nw,ne,ne,ne,ne,ne,ne,ne,ne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