-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.js
More file actions
68 lines (45 loc) · 1.34 KB
/
template.js
File metadata and controls
68 lines (45 loc) · 1.34 KB
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
'use strict'
module.exports = ``
const THIS = 'day_'
const rawInput = []
// The actual input
rawInput[0] = require('./data/' + THIS)
// The 1-st example
rawInput[1] = ``
// The 2-nd example
rawInput[2] = ``
const { assert, debug, execute } = require('./execute')
assert.hook(() => {
console.log('--- BREAKPOINT ---') // Yeah, sometimes I have to use this!
})
const shared = {} // Shared namespace for results forwarding.
// --- End of boilerplate ---
const parseInput = s => {
let v = s.replace(/a/g, '0').replace(/b/g, '1')
return Number.parseInt(v, 2)
}
const algorithm1 = () => {
return
}
const algorithm2 = () => {
return
}
const compute = (algorithm, dataSet) => {
let input = rawInput[dataSet].split('\n\n')
shared.data = input.map(v => parseInput(v)).sort((a, b) => a - b) // !!!!!!!!!!
return algorithm(shared)
}
execute('puzzle #1', compute, algorithm1) // + argument defaults (dataset, ...)
execute('puzzle #2', compute, algorithm2)
/*
**PROJECT TITLE:** $project_title
**DESCRIPTION:** $short_desc_here_(max_140_characters)
**SUBMITTED BY:** /u/$your_username{, $submitter2, $submitter3...}
**MEGATHREADS:** [$day1]($link1) [$day2]($link2) [$day3]($link3) [$day4]($link4) [$day5]($link5) {...}
***
**SUBMISSION:**
{$your_text_submission_here}
***
**ADDITIONAL COMMENTS:**
{$include_more_details_if_necessary}
*/