-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
141 lines (133 loc) · 3.19 KB
/
app.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
const prompts = require('prompts')
const readInput = require('./src/lib/readInput').default
const prompt = {
type: 'select',
name: 'input',
message: 'Pick advent day to run',
choices: [
{
title: 'Day 1: Sonar Sweep - Part 1',
value: { day: 1, part: 1 },
selected: true,
},
{
title: 'Day 1: Sonar Sweep - Part 2',
value: { day: 1, part: 2 },
},
{
title: 'Day 2: Dive! - Part 1',
value: { day: 2, part: 1 },
},
{
title: 'Day 2: Dive! - Part 2',
value: { day: 2, part: 2 },
},
{
title: 'Day 3: Binary Diagnostic - Part 1',
value: { day: 3, part: 1 },
},
{
title: 'Day 3: Binary Diagnostic - Part 2',
value: { day: 3, part: 2 },
},
{
title: 'Day 4: Giant Squid - Part 1',
value: { day: 4, part: 1 },
},
{
title: 'Day 4: Giant Squid - Part 2',
value: { day: 4, part: 2 },
},
{
title: 'Day 5: Hydrothermal Venture - Part 1',
value: { day: 5, part: 1 },
},
{
title: 'Day 5: Hydrothermal Venture - Part 2',
value: { day: 5, part: 2 },
},
{
title: 'Day 6: Lanternfish - Part 1',
value: { day: 6, part: 1 },
},
{
title: 'Day 6: Lanternfish - Part 2',
value: { day: 6, part: 2 },
},
{
title: 'Day 7: The Treachery of Whales - Part 1',
value: { day: 7, part: 1 },
},
{
title: 'Day 7: The Treachery of Whales - Part 2',
value: { day: 7, part: 2 },
},
{
title: 'Day 8: Seven Segment Search - Part 1',
value: { day: 8, part: 1 },
},
{
title: 'Day 8: Seven Segment Search - Part 2',
value: { day: 8, part: 2 },
},
{
title: 'Day 9: Smoke Basin - Part 1',
value: { day: 9, part: 1 },
},
{
title: 'Day 9: Smoke Basin - Part 2',
value: { day: 9, part: 2 },
},
{
title: 'Day 10: Syntax Scoring - Part 1',
value: { day: 10, part: 1 },
},
{
title: 'Day 10: Syntax Scoring - Part 2',
value: { day: 10, part: 2 },
},
{
title: 'Day 11: Dumbo Octopus - Part 1',
value: { day: 11, part: 1 },
},
{
title: 'Day 11: Dumbo Octopus - Part 2',
value: { day: 11, part: 2 },
},
{
title: 'Day 12: Passage Pathing - Part 1',
value: { day: 12, part: 1 },
},
{
title: 'Day 12: Passage Pathing - Part 2',
value: { day: 12, part: 2 },
},
{
title: 'Day 13: Transparent Origami - Part 1',
value: { day: 13, part: 1 },
},
{
title: 'Day 13: Transparent Origami - Part 2',
value: { day: 13, part: 2 },
},
{
title: 'Day 14: Extended Polymerization - Part 1',
value: { day: 14, part: 1 },
},
],
}
;(async () => {
const { input } = await prompts(prompt)
processInput(input)
})()
const line = '-'.repeat(process.stdout.columns / 2)
const processInput = ({ day, part }) => {
const input = readInput(`${__dirname}/src/day${day}/input.txt`)
const run = require(`./src/day${day}/part${part}`).default
console.log(line)
console.log('Input:')
console.log(input)
const answer = run(input)
console.log(`Answer: ${answer}`)
console.log(line)
}