Skip to content

Commit 36ad2f6

Browse files
style(2019-day-02): javascript linting
1 parent 4714173 commit 36ad2f6

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

2019/day-02/solution.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ fs.readFile(filePath, { encoding: 'utf8' }, (err, initData) => {
2323
return data[0]
2424
}
2525

26-
const part2 = ({target, maxNoun, maxVerb}) => {
27-
26+
const part2 = ({ target, maxNoun, maxVerb }) => {
2827
// Helper for running the program with specified noun and verb inputs
2928
const tryProgram = ({
3029
noun,
@@ -40,26 +39,25 @@ fs.readFile(filePath, { encoding: 'utf8' }, (err, initData) => {
4039

4140
// Manipulate and loop through attempts for Part 2
4241
let noun = -1
43-
while ( noun <= maxNoun) {
42+
while (noun <= maxNoun) {
4443
let verb = -1
4544
noun++
4645
while (verb <= maxVerb) {
4746
verb++
48-
output = tryProgram({
47+
const output = tryProgram({
4948
noun,
5049
verb
5150
})
5251
// Break the search loop on success
53-
if(output === target) {
52+
if (output === target) {
5453
return 100 * noun + verb
5554
}
5655
}
5756
}
5857
}
5958

60-
6159
const answer1 = part1()
62-
const answer2 = part2({ target:19690720, maxNoun: 99, maxVerb: 99})
60+
const answer2 = part2({ target: 19690720, maxNoun: 99, maxVerb: 99 })
6361

6462
console.log('-- Part 1 --')
6563
console.log(`Answer: ${answer1}`)

0 commit comments

Comments
 (0)