mirror of
https://github.com/Aviortheking/advent-of-code.git
synced 2025-04-22 02:42:14 +00:00
Initial Commit
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
commit
dc39e86744
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
* text=auto eol=lf
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules
|
3
README.md
Normal file
3
README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# 2021 Advent of Code
|
||||||
|
|
||||||
|
https://adventofcode.com/2021
|
2000
d1/input.txt
Normal file
2000
d1/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
12
d1/part1.ts
Normal file
12
d1/part1.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
|
||||||
|
var previous = Infinity
|
||||||
|
console.log("Result: " +
|
||||||
|
input.split('\n').reduce((p, c) => {
|
||||||
|
const tmp = previous
|
||||||
|
previous = parseInt(c)
|
||||||
|
return tmp < previous ? p + 1 : p
|
||||||
|
}, 0)
|
||||||
|
)
|
19
d1/part2.ts
Normal file
19
d1/part2.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
|
||||||
|
const items = input.split('\n')
|
||||||
|
|
||||||
|
var previous = Infinity
|
||||||
|
var count = 0
|
||||||
|
|
||||||
|
for (let i = 0; i < items.length - 3; i++) {
|
||||||
|
const sum = parseInt(items[i]) + parseInt(items[i + 1]) + parseInt(items[i + 2])
|
||||||
|
if (sum > previous) {
|
||||||
|
count++
|
||||||
|
}
|
||||||
|
|
||||||
|
previous = sum
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Result: ${count}`)
|
1000
d2/input.txt
Normal file
1000
d2/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
26
d2/part1.ts
Normal file
26
d2/part1.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
var x = 0
|
||||||
|
var y = 0
|
||||||
|
for (const line of input) {
|
||||||
|
const splitted = line.split(' ')
|
||||||
|
const action = splitted[0]
|
||||||
|
const value = parseInt(splitted[1])
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case 'forward':
|
||||||
|
x += value
|
||||||
|
break
|
||||||
|
case 'up':
|
||||||
|
y -= value
|
||||||
|
break
|
||||||
|
case 'down':
|
||||||
|
y += value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Result: ${x * y}`)
|
28
d2/part2.ts
Normal file
28
d2/part2.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
var positionX = 0
|
||||||
|
var depth = 0
|
||||||
|
var aim = 0
|
||||||
|
for (const line of input) {
|
||||||
|
const splitted = line.split(' ')
|
||||||
|
const action = splitted[0]
|
||||||
|
const value = parseInt(splitted[1])
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case 'forward':
|
||||||
|
positionX += value
|
||||||
|
depth += aim * value
|
||||||
|
break
|
||||||
|
case 'up':
|
||||||
|
aim -= value
|
||||||
|
break
|
||||||
|
case 'down':
|
||||||
|
aim += value
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Result: ${positionX} * ${depth} = ${positionX * depth}`)
|
12
d3/ex.txt
Normal file
12
d3/ex.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
00100
|
||||||
|
11110
|
||||||
|
10110
|
||||||
|
10111
|
||||||
|
10101
|
||||||
|
01111
|
||||||
|
00111
|
||||||
|
11100
|
||||||
|
10000
|
||||||
|
11001
|
||||||
|
00010
|
||||||
|
01010
|
1000
d3/input.txt
Normal file
1000
d3/input.txt
Normal file
File diff suppressed because it is too large
Load Diff
27
d3/part1.ts
Normal file
27
d3/part1.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
const list: Array<{0: number, 1: number}> = []
|
||||||
|
for (const line of input) {
|
||||||
|
const splitted = line.split('')
|
||||||
|
for (let i = 0; i < splitted.length; i++) {
|
||||||
|
const bit = splitted[i];
|
||||||
|
if (!list[i]) {
|
||||||
|
list[i] = {0: 0, 1: 0}
|
||||||
|
}
|
||||||
|
list[i][bit === '0' ? 0 : 1]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let gamma = ''
|
||||||
|
let epsilon = ''
|
||||||
|
for (const item of list) {
|
||||||
|
gamma = gamma + ((item[0] > item[1]) ? '0' : '1')
|
||||||
|
epsilon = epsilon + ((item[0] < item[1]) ? '0' : '1')
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(list)
|
||||||
|
|
||||||
|
console.log(`Result: ${parseInt(gamma, 2) * parseInt(epsilon, 2)}`)
|
38
d3/part2.ts
Normal file
38
d3/part2.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function find(mostUsed = true) {
|
||||||
|
let list = input
|
||||||
|
for (let i = 0; i < list[0].length; i++) {
|
||||||
|
const counts = {'0': 0, '1': 0}
|
||||||
|
for (const line of list) {
|
||||||
|
const bit = line[i] as '0' | '1'
|
||||||
|
counts[bit]++
|
||||||
|
}
|
||||||
|
|
||||||
|
const comparator = counts['0'] > counts['1'] ? '0' : '1'
|
||||||
|
let fn: (item: string) => boolean
|
||||||
|
if (mostUsed) {
|
||||||
|
fn = (line) => line[i] === comparator
|
||||||
|
} else {
|
||||||
|
fn = (line) => line[i] !== comparator
|
||||||
|
}
|
||||||
|
|
||||||
|
list = list.filter(fn)
|
||||||
|
|
||||||
|
if (list.length === 1) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return list[0]
|
||||||
|
}
|
||||||
|
const resORG = find()
|
||||||
|
console.log(`ORG: ${resORG} or ${parseInt(resORG, 2)}`)
|
||||||
|
const resCSR = find(false)
|
||||||
|
console.log(`CSR: ${resCSR} or ${parseInt(resCSR, 2)}`)
|
||||||
|
console.log(`Result: ${parseInt(resORG, 2) * parseInt(resCSR, 2)}`)
|
19
d4/ex.txt
Normal file
19
d4/ex.txt
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
7,4,9,5,11,17,23,2,0,14,21,24,10,16,13,6,15,25,12,22,18,20,8,19,3,26,1
|
||||||
|
|
||||||
|
22 13 17 11 0
|
||||||
|
8 2 23 4 24
|
||||||
|
21 9 14 16 7
|
||||||
|
6 10 3 18 5
|
||||||
|
1 12 20 15 19
|
||||||
|
|
||||||
|
3 15 0 2 22
|
||||||
|
9 18 13 17 5
|
||||||
|
19 8 7 25 23
|
||||||
|
20 11 10 24 4
|
||||||
|
14 21 16 12 6
|
||||||
|
|
||||||
|
14 21 17 24 4
|
||||||
|
10 16 15 9 19
|
||||||
|
18 8 23 26 20
|
||||||
|
22 11 13 6 5
|
||||||
|
2 0 12 3 7
|
601
d4/input.txt
Normal file
601
d4/input.txt
Normal file
@ -0,0 +1,601 @@
|
|||||||
|
83,5,71,61,88,55,95,6,0,97,20,16,27,7,79,25,81,29,22,52,43,21,53,59,99,18,35,96,51,93,14,77,15,3,57,28,58,17,50,32,74,63,76,84,65,9,62,67,48,12,8,68,31,19,36,85,98,30,91,89,66,80,75,47,4,23,60,70,87,90,13,38,56,34,46,24,41,92,37,49,73,10,94,26,42,40,33,54,86,82,72,39,2,45,78,11,1,44,69,64
|
||||||
|
|
||||||
|
97 62 17 5 79
|
||||||
|
1 99 98 80 84
|
||||||
|
44 16 2 40 94
|
||||||
|
68 95 49 32 8
|
||||||
|
38 35 23 89 3
|
||||||
|
|
||||||
|
48 53 59 99 43
|
||||||
|
77 24 62 50 27
|
||||||
|
28 8 10 86 18
|
||||||
|
96 9 92 66 67
|
||||||
|
20 55 87 52 31
|
||||||
|
|
||||||
|
79 51 62 33 5
|
||||||
|
15 39 21 48 90
|
||||||
|
88 29 7 92 98
|
||||||
|
87 49 84 6 14
|
||||||
|
72 85 46 71 26
|
||||||
|
|
||||||
|
3 86 40 61 65
|
||||||
|
4 82 28 46 32
|
||||||
|
31 5 33 96 98
|
||||||
|
30 62 68 75 70
|
||||||
|
9 18 92 19 72
|
||||||
|
|
||||||
|
82 24 95 21 79
|
||||||
|
85 84 38 89 50
|
||||||
|
7 10 5 25 20
|
||||||
|
99 37 48 86 12
|
||||||
|
68 93 6 66 43
|
||||||
|
|
||||||
|
9 95 75 14 1
|
||||||
|
94 90 40 84 24
|
||||||
|
43 72 93 4 87
|
||||||
|
48 50 53 20 6
|
||||||
|
65 11 38 25 46
|
||||||
|
|
||||||
|
41 22 47 34 55
|
||||||
|
74 57 42 85 33
|
||||||
|
40 21 52 78 7
|
||||||
|
51 58 37 4 49
|
||||||
|
53 75 11 48 76
|
||||||
|
|
||||||
|
90 6 98 25 80
|
||||||
|
41 81 30 87 33
|
||||||
|
11 21 79 62 92
|
||||||
|
27 60 46 56 88
|
||||||
|
4 69 70 13 84
|
||||||
|
|
||||||
|
1 22 72 43 58
|
||||||
|
78 97 52 61 62
|
||||||
|
27 48 81 2 63
|
||||||
|
33 37 4 82 18
|
||||||
|
65 28 70 31 59
|
||||||
|
|
||||||
|
78 51 69 47 16
|
||||||
|
48 55 58 70 37
|
||||||
|
7 59 66 5 76
|
||||||
|
94 52 82 22 10
|
||||||
|
13 83 95 24 79
|
||||||
|
|
||||||
|
8 38 40 67 24
|
||||||
|
45 9 21 7 89
|
||||||
|
82 96 72 92 4
|
||||||
|
86 49 80 79 22
|
||||||
|
26 11 84 78 70
|
||||||
|
|
||||||
|
32 73 0 37 86
|
||||||
|
78 42 13 30 53
|
||||||
|
44 99 51 12 96
|
||||||
|
45 57 63 34 58
|
||||||
|
41 91 7 49 52
|
||||||
|
|
||||||
|
1 66 8 6 7
|
||||||
|
47 96 25 77 72
|
||||||
|
23 22 31 42 24
|
||||||
|
52 27 53 51 99
|
||||||
|
21 65 35 84 5
|
||||||
|
|
||||||
|
49 1 79 39 82
|
||||||
|
7 96 13 33 85
|
||||||
|
3 53 32 12 50
|
||||||
|
36 30 27 55 95
|
||||||
|
16 24 2 66 77
|
||||||
|
|
||||||
|
45 75 85 35 72
|
||||||
|
99 25 91 68 28
|
||||||
|
29 52 1 80 98
|
||||||
|
62 46 63 22 44
|
||||||
|
82 86 57 24 58
|
||||||
|
|
||||||
|
70 19 79 7 24
|
||||||
|
35 71 93 42 76
|
||||||
|
17 88 62 25 12
|
||||||
|
54 0 11 32 58
|
||||||
|
38 64 29 75 80
|
||||||
|
|
||||||
|
58 93 63 52 23
|
||||||
|
77 60 1 38 87
|
||||||
|
75 89 85 25 91
|
||||||
|
64 39 96 49 66
|
||||||
|
14 45 84 13 29
|
||||||
|
|
||||||
|
85 10 21 33 80
|
||||||
|
78 86 77 41 36
|
||||||
|
98 58 53 82 72
|
||||||
|
75 20 65 3 46
|
||||||
|
52 16 74 45 99
|
||||||
|
|
||||||
|
45 97 96 23 62
|
||||||
|
79 59 60 87 64
|
||||||
|
75 2 30 47 50
|
||||||
|
85 81 56 11 38
|
||||||
|
17 26 40 7 66
|
||||||
|
|
||||||
|
94 99 67 88 82
|
||||||
|
96 5 21 53 52
|
||||||
|
41 15 49 35 89
|
||||||
|
54 39 66 24 51
|
||||||
|
9 6 62 33 70
|
||||||
|
|
||||||
|
33 89 48 4 20
|
||||||
|
46 66 45 76 7
|
||||||
|
12 77 43 60 15
|
||||||
|
54 58 91 95 69
|
||||||
|
11 8 32 31 18
|
||||||
|
|
||||||
|
63 78 55 7 60
|
||||||
|
95 14 38 10 45
|
||||||
|
3 16 72 53 37
|
||||||
|
1 89 70 75 44
|
||||||
|
5 6 66 13 46
|
||||||
|
|
||||||
|
74 65 27 53 39
|
||||||
|
67 66 76 13 31
|
||||||
|
75 51 11 49 59
|
||||||
|
18 12 71 9 89
|
||||||
|
98 24 73 26 43
|
||||||
|
|
||||||
|
90 21 75 77 97
|
||||||
|
80 29 54 16 10
|
||||||
|
55 98 65 19 7
|
||||||
|
96 76 20 28 88
|
||||||
|
94 83 91 26 86
|
||||||
|
|
||||||
|
60 57 22 95 23
|
||||||
|
81 4 34 36 14
|
||||||
|
77 1 45 24 19
|
||||||
|
33 88 8 28 74
|
||||||
|
2 17 37 32 94
|
||||||
|
|
||||||
|
34 82 45 65 44
|
||||||
|
70 89 95 20 79
|
||||||
|
88 18 62 68 37
|
||||||
|
85 17 54 86 69
|
||||||
|
97 25 13 42 67
|
||||||
|
|
||||||
|
70 30 59 94 86
|
||||||
|
40 87 20 69 25
|
||||||
|
46 44 41 17 79
|
||||||
|
75 99 3 91 8
|
||||||
|
71 39 73 88 37
|
||||||
|
|
||||||
|
90 76 12 80 58
|
||||||
|
60 45 35 10 33
|
||||||
|
79 19 65 54 21
|
||||||
|
63 51 77 15 92
|
||||||
|
34 53 7 59 44
|
||||||
|
|
||||||
|
40 14 68 43 37
|
||||||
|
12 35 29 82 48
|
||||||
|
47 28 97 44 93
|
||||||
|
95 56 33 96 27
|
||||||
|
38 85 88 49 6
|
||||||
|
|
||||||
|
88 36 81 42 10
|
||||||
|
85 99 29 70 86
|
||||||
|
64 15 37 96 61
|
||||||
|
66 76 87 17 62
|
||||||
|
91 16 60 13 65
|
||||||
|
|
||||||
|
45 71 66 80 69
|
||||||
|
53 39 29 92 99
|
||||||
|
23 0 72 36 52
|
||||||
|
75 70 33 2 14
|
||||||
|
22 77 21 26 3
|
||||||
|
|
||||||
|
52 32 14 66 47
|
||||||
|
53 7 9 69 11
|
||||||
|
19 36 57 54 65
|
||||||
|
17 26 76 51 42
|
||||||
|
13 8 44 63 39
|
||||||
|
|
||||||
|
23 84 34 35 19
|
||||||
|
29 71 81 32 92
|
||||||
|
22 49 54 6 56
|
||||||
|
64 94 53 89 2
|
||||||
|
74 68 11 13 47
|
||||||
|
|
||||||
|
34 25 67 59 66
|
||||||
|
68 27 69 91 33
|
||||||
|
4 56 46 99 21
|
||||||
|
51 13 24 41 12
|
||||||
|
90 65 19 26 55
|
||||||
|
|
||||||
|
15 85 8 65 79
|
||||||
|
95 51 39 75 96
|
||||||
|
18 45 68 81 71
|
||||||
|
67 28 21 61 20
|
||||||
|
70 29 92 74 36
|
||||||
|
|
||||||
|
25 75 23 2 38
|
||||||
|
66 52 42 62 16
|
||||||
|
93 63 78 31 65
|
||||||
|
0 91 77 4 14
|
||||||
|
61 59 53 17 10
|
||||||
|
|
||||||
|
16 95 72 67 17
|
||||||
|
71 3 38 90 14
|
||||||
|
34 8 55 49 33
|
||||||
|
54 79 20 27 80
|
||||||
|
96 31 18 70 61
|
||||||
|
|
||||||
|
60 46 4 56 49
|
||||||
|
2 36 8 51 54
|
||||||
|
71 82 97 1 18
|
||||||
|
45 69 37 6 26
|
||||||
|
85 61 27 92 77
|
||||||
|
|
||||||
|
62 90 59 67 25
|
||||||
|
41 45 7 91 17
|
||||||
|
10 29 75 43 82
|
||||||
|
12 78 95 37 32
|
||||||
|
28 66 76 2 49
|
||||||
|
|
||||||
|
26 6 49 44 74
|
||||||
|
94 34 73 70 64
|
||||||
|
14 91 23 88 31
|
||||||
|
90 55 62 75 43
|
||||||
|
4 1 63 57 19
|
||||||
|
|
||||||
|
2 30 11 55 52
|
||||||
|
51 92 73 54 96
|
||||||
|
89 22 67 56 17
|
||||||
|
49 50 9 95 45
|
||||||
|
23 74 13 75 7
|
||||||
|
|
||||||
|
6 31 78 64 89
|
||||||
|
76 13 83 56 34
|
||||||
|
95 29 97 49 37
|
||||||
|
66 77 74 73 90
|
||||||
|
87 41 62 39 85
|
||||||
|
|
||||||
|
51 80 38 15 44
|
||||||
|
53 23 83 61 63
|
||||||
|
27 33 79 40 32
|
||||||
|
84 2 82 20 93
|
||||||
|
72 92 48 39 98
|
||||||
|
|
||||||
|
36 78 46 84 14
|
||||||
|
56 53 51 92 89
|
||||||
|
39 99 77 22 32
|
||||||
|
65 38 42 76 7
|
||||||
|
62 31 1 87 95
|
||||||
|
|
||||||
|
74 99 6 4 20
|
||||||
|
95 81 27 59 88
|
||||||
|
63 69 30 25 87
|
||||||
|
92 96 89 42 18
|
||||||
|
11 77 91 8 46
|
||||||
|
|
||||||
|
29 62 77 3 89
|
||||||
|
54 12 55 44 34
|
||||||
|
66 78 83 98 22
|
||||||
|
17 10 67 82 75
|
||||||
|
43 16 84 41 19
|
||||||
|
|
||||||
|
67 24 9 89 48
|
||||||
|
56 7 44 47 68
|
||||||
|
12 38 35 54 14
|
||||||
|
95 58 78 13 28
|
||||||
|
97 5 37 99 42
|
||||||
|
|
||||||
|
48 64 21 23 92
|
||||||
|
29 99 75 2 53
|
||||||
|
41 97 74 39 89
|
||||||
|
66 63 22 45 73
|
||||||
|
20 68 30 35 78
|
||||||
|
|
||||||
|
76 3 47 40 72
|
||||||
|
41 7 68 5 58
|
||||||
|
12 32 81 62 93
|
||||||
|
91 80 17 78 61
|
||||||
|
22 95 94 38 33
|
||||||
|
|
||||||
|
42 27 70 13 5
|
||||||
|
77 38 50 3 44
|
||||||
|
29 56 36 15 97
|
||||||
|
68 20 94 12 54
|
||||||
|
64 83 25 55 80
|
||||||
|
|
||||||
|
77 63 37 68 73
|
||||||
|
34 30 22 91 10
|
||||||
|
16 80 89 98 45
|
||||||
|
46 36 90 95 83
|
||||||
|
54 52 57 61 55
|
||||||
|
|
||||||
|
55 3 33 66 69
|
||||||
|
51 97 36 57 50
|
||||||
|
56 74 35 84 44
|
||||||
|
45 92 18 42 52
|
||||||
|
85 13 27 70 20
|
||||||
|
|
||||||
|
56 68 71 11 63
|
||||||
|
12 93 57 94 84
|
||||||
|
91 13 29 31 75
|
||||||
|
54 49 51 73 5
|
||||||
|
81 7 60 53 89
|
||||||
|
|
||||||
|
73 55 87 35 84
|
||||||
|
37 63 41 54 39
|
||||||
|
58 42 85 66 68
|
||||||
|
96 24 86 72 27
|
||||||
|
40 28 4 80 33
|
||||||
|
|
||||||
|
29 79 8 76 31
|
||||||
|
30 20 12 0 61
|
||||||
|
14 37 49 45 74
|
||||||
|
64 17 1 91 51
|
||||||
|
87 67 3 77 47
|
||||||
|
|
||||||
|
72 15 46 71 75
|
||||||
|
41 16 68 14 43
|
||||||
|
97 25 78 26 39
|
||||||
|
59 57 88 4 52
|
||||||
|
20 49 3 23 29
|
||||||
|
|
||||||
|
33 78 31 35 6
|
||||||
|
85 43 7 87 18
|
||||||
|
68 93 4 80 96
|
||||||
|
98 13 61 77 23
|
||||||
|
10 29 34 36 5
|
||||||
|
|
||||||
|
0 78 44 49 14
|
||||||
|
72 88 30 31 81
|
||||||
|
34 87 55 27 11
|
||||||
|
58 64 76 40 62
|
||||||
|
47 18 38 35 26
|
||||||
|
|
||||||
|
16 2 67 56 74
|
||||||
|
50 41 86 38 39
|
||||||
|
32 96 59 40 8
|
||||||
|
17 82 49 55 89
|
||||||
|
34 88 81 73 94
|
||||||
|
|
||||||
|
52 18 32 56 61
|
||||||
|
40 5 48 64 62
|
||||||
|
22 57 19 26 91
|
||||||
|
31 3 95 27 87
|
||||||
|
74 83 75 99 73
|
||||||
|
|
||||||
|
6 65 91 22 86
|
||||||
|
82 72 60 41 87
|
||||||
|
2 71 9 12 84
|
||||||
|
51 90 43 49 80
|
||||||
|
15 20 54 66 29
|
||||||
|
|
||||||
|
39 64 35 23 10
|
||||||
|
73 25 1 45 93
|
||||||
|
50 37 95 86 78
|
||||||
|
52 6 2 0 13
|
||||||
|
26 89 27 62 80
|
||||||
|
|
||||||
|
65 67 95 33 60
|
||||||
|
55 49 64 92 7
|
||||||
|
56 75 73 35 99
|
||||||
|
8 72 80 0 46
|
||||||
|
41 25 2 69 4
|
||||||
|
|
||||||
|
26 51 31 44 25
|
||||||
|
21 6 70 12 71
|
||||||
|
67 69 13 63 79
|
||||||
|
81 74 8 89 30
|
||||||
|
16 48 88 72 66
|
||||||
|
|
||||||
|
99 69 61 29 86
|
||||||
|
67 88 5 20 2
|
||||||
|
70 60 27 82 6
|
||||||
|
95 65 30 9 85
|
||||||
|
23 58 59 87 66
|
||||||
|
|
||||||
|
40 90 43 57 26
|
||||||
|
10 52 27 64 72
|
||||||
|
3 83 11 54 42
|
||||||
|
39 20 87 15 81
|
||||||
|
49 28 58 33 29
|
||||||
|
|
||||||
|
11 32 63 96 81
|
||||||
|
77 82 0 30 15
|
||||||
|
88 31 41 46 6
|
||||||
|
17 55 76 42 87
|
||||||
|
24 93 70 66 40
|
||||||
|
|
||||||
|
35 6 28 90 21
|
||||||
|
72 74 78 43 3
|
||||||
|
47 17 13 41 96
|
||||||
|
68 12 76 81 11
|
||||||
|
70 34 33 25 54
|
||||||
|
|
||||||
|
94 9 58 91 38
|
||||||
|
84 7 22 30 63
|
||||||
|
23 26 49 93 48
|
||||||
|
79 75 99 96 67
|
||||||
|
90 19 66 57 47
|
||||||
|
|
||||||
|
35 98 24 31 41
|
||||||
|
79 63 92 70 11
|
||||||
|
36 3 72 50 93
|
||||||
|
90 21 40 38 77
|
||||||
|
0 14 42 99 67
|
||||||
|
|
||||||
|
96 45 75 97 94
|
||||||
|
68 35 9 30 67
|
||||||
|
25 88 40 46 37
|
||||||
|
82 79 90 76 55
|
||||||
|
50 59 58 22 21
|
||||||
|
|
||||||
|
96 73 49 36 56
|
||||||
|
6 45 30 81 76
|
||||||
|
10 95 70 88 98
|
||||||
|
43 47 74 66 84
|
||||||
|
77 83 68 54 28
|
||||||
|
|
||||||
|
96 48 64 89 6
|
||||||
|
76 12 47 8 30
|
||||||
|
39 55 95 11 62
|
||||||
|
68 25 50 63 31
|
||||||
|
59 17 46 52 78
|
||||||
|
|
||||||
|
66 27 61 79 73
|
||||||
|
37 88 47 84 72
|
||||||
|
50 18 99 7 76
|
||||||
|
97 11 53 43 30
|
||||||
|
42 56 98 39 63
|
||||||
|
|
||||||
|
64 13 45 7 72
|
||||||
|
66 35 18 68 86
|
||||||
|
38 30 89 11 29
|
||||||
|
37 76 23 14 67
|
||||||
|
36 61 87 26 46
|
||||||
|
|
||||||
|
20 72 10 30 17
|
||||||
|
25 14 74 71 58
|
||||||
|
34 51 45 43 76
|
||||||
|
38 75 50 98 42
|
||||||
|
2 12 67 66 82
|
||||||
|
|
||||||
|
44 23 73 56 88
|
||||||
|
4 96 90 0 32
|
||||||
|
40 86 47 87 50
|
||||||
|
28 30 42 39 17
|
||||||
|
10 12 16 8 14
|
||||||
|
|
||||||
|
21 33 7 20 78
|
||||||
|
81 46 77 42 79
|
||||||
|
84 28 82 93 68
|
||||||
|
90 63 60 0 34
|
||||||
|
35 70 40 29 54
|
||||||
|
|
||||||
|
93 8 11 2 39
|
||||||
|
74 40 95 69 57
|
||||||
|
86 21 31 88 63
|
||||||
|
52 16 19 20 22
|
||||||
|
72 7 25 90 77
|
||||||
|
|
||||||
|
83 29 90 48 46
|
||||||
|
97 21 2 65 15
|
||||||
|
89 28 60 69 26
|
||||||
|
77 75 9 35 96
|
||||||
|
82 49 66 5 16
|
||||||
|
|
||||||
|
80 57 2 73 46
|
||||||
|
22 50 87 60 89
|
||||||
|
95 74 98 93 62
|
||||||
|
86 61 10 69 9
|
||||||
|
48 31 53 88 84
|
||||||
|
|
||||||
|
46 17 28 56 50
|
||||||
|
64 65 43 73 22
|
||||||
|
32 31 89 20 38
|
||||||
|
13 49 18 55 72
|
||||||
|
83 41 78 94 57
|
||||||
|
|
||||||
|
39 8 68 87 21
|
||||||
|
78 59 27 0 14
|
||||||
|
25 3 96 51 63
|
||||||
|
92 35 19 57 99
|
||||||
|
83 75 69 37 72
|
||||||
|
|
||||||
|
42 36 34 77 69
|
||||||
|
21 55 47 52 89
|
||||||
|
61 90 3 23 41
|
||||||
|
45 80 29 27 99
|
||||||
|
79 86 87 93 74
|
||||||
|
|
||||||
|
59 8 97 48 73
|
||||||
|
40 31 29 49 85
|
||||||
|
41 68 11 9 45
|
||||||
|
87 74 77 75 91
|
||||||
|
67 27 70 90 16
|
||||||
|
|
||||||
|
80 47 53 81 36
|
||||||
|
75 35 87 90 89
|
||||||
|
19 5 56 28 26
|
||||||
|
8 44 77 31 20
|
||||||
|
61 96 27 99 79
|
||||||
|
|
||||||
|
35 16 40 94 65
|
||||||
|
60 28 46 51 61
|
||||||
|
45 53 36 89 80
|
||||||
|
33 93 12 39 42
|
||||||
|
13 68 57 64 26
|
||||||
|
|
||||||
|
39 55 88 78 72
|
||||||
|
6 82 52 1 60
|
||||||
|
41 23 97 44 11
|
||||||
|
3 15 21 93 38
|
||||||
|
24 90 7 80 2
|
||||||
|
|
||||||
|
81 46 31 56 30
|
||||||
|
94 22 58 69 41
|
||||||
|
42 91 20 0 14
|
||||||
|
71 11 17 37 12
|
||||||
|
7 73 79 9 26
|
||||||
|
|
||||||
|
38 32 24 98 79
|
||||||
|
48 49 4 17 90
|
||||||
|
12 20 95 99 10
|
||||||
|
94 23 30 92 97
|
||||||
|
84 18 57 11 53
|
||||||
|
|
||||||
|
75 22 42 59 55
|
||||||
|
23 33 90 2 52
|
||||||
|
94 13 78 0 16
|
||||||
|
39 72 67 45 31
|
||||||
|
11 53 7 83 28
|
||||||
|
|
||||||
|
43 33 52 89 40
|
||||||
|
53 94 87 90 19
|
||||||
|
98 51 64 63 62
|
||||||
|
66 65 57 93 18
|
||||||
|
80 79 59 99 73
|
||||||
|
|
||||||
|
57 63 96 3 27
|
||||||
|
88 74 9 60 99
|
||||||
|
48 30 1 18 15
|
||||||
|
23 77 89 24 55
|
||||||
|
37 58 67 91 10
|
||||||
|
|
||||||
|
36 73 27 72 8
|
||||||
|
75 74 87 55 7
|
||||||
|
2 67 34 84 51
|
||||||
|
94 18 23 62 11
|
||||||
|
65 41 3 29 53
|
||||||
|
|
||||||
|
63 67 73 53 13
|
||||||
|
28 54 19 72 93
|
||||||
|
48 41 55 64 33
|
||||||
|
83 70 65 26 22
|
||||||
|
11 86 35 16 18
|
||||||
|
|
||||||
|
13 50 19 48 58
|
||||||
|
28 42 83 20 29
|
||||||
|
5 96 92 90 3
|
||||||
|
87 93 56 23 78
|
||||||
|
98 57 0 72 62
|
||||||
|
|
||||||
|
95 76 16 5 56
|
||||||
|
55 28 52 88 73
|
||||||
|
6 99 75 90 18
|
||||||
|
12 25 22 44 57
|
||||||
|
62 37 36 30 48
|
||||||
|
|
||||||
|
24 41 73 90 46
|
||||||
|
55 91 63 86 44
|
||||||
|
0 74 72 47 76
|
||||||
|
34 13 33 65 62
|
||||||
|
49 75 10 15 27
|
||||||
|
|
||||||
|
85 63 62 11 38
|
||||||
|
53 29 2 8 13
|
||||||
|
87 64 31 69 58
|
||||||
|
88 84 17 3 26
|
||||||
|
5 32 23 33 39
|
||||||
|
|
||||||
|
25 8 81 29 95
|
||||||
|
65 56 86 34 17
|
||||||
|
38 66 85 43 26
|
||||||
|
39 12 70 32 19
|
||||||
|
49 68 10 4 13
|
30
d4/part1.ts
Normal file
30
d4/part1.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
import { Board, calculateBoardScore, hasBoardWon, parseBoard } from './utils'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
|
||||||
|
const items = input.split('\n')[0].split(',').map((it) => parseInt(it))
|
||||||
|
|
||||||
|
const boards = input.split('\n\n').map((board, index) => {
|
||||||
|
if (index === 0) return undefined
|
||||||
|
return parseBoard(board)
|
||||||
|
}).filter((it) => it) as Array<Board>
|
||||||
|
|
||||||
|
root: for (let i = 1; i <= items.length; i++) {
|
||||||
|
const subList = items.slice(0, i)
|
||||||
|
for (let j = 0; j < boards.length; j++) {
|
||||||
|
const board = boards[j];
|
||||||
|
const won = hasBoardWon(board, subList)
|
||||||
|
if (won) {
|
||||||
|
console.log('Board', j, 'has won!')
|
||||||
|
const score = calculateBoardScore(board, subList)
|
||||||
|
console.log(board)
|
||||||
|
console.log('Score:', score)
|
||||||
|
console.log('items:', subList)
|
||||||
|
console.log('item:', subList[subList.length - 1])
|
||||||
|
console.log('Result:', score * subList[subList.length - 1])
|
||||||
|
break root
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
34
d4/part2.ts
Normal file
34
d4/part2.ts
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
import { Board, calculateBoardScore, hasBoardWon, parseBoard } from './utils'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
|
||||||
|
const items = input.split('\n')[0].split(',').map((it) => parseInt(it))
|
||||||
|
|
||||||
|
const boards = input.split('\n\n').map((board, index) => {
|
||||||
|
if (index === 0) return undefined
|
||||||
|
return parseBoard(board)
|
||||||
|
}).filter((it) => it) as Array<Board>
|
||||||
|
|
||||||
|
root: for (let i = 1; i <= items.length; i++) {
|
||||||
|
const subList = items.slice(0, i)
|
||||||
|
for (let j = 0; j < boards.length; j++) {
|
||||||
|
const board = boards[j];
|
||||||
|
const won = hasBoardWon(board, subList)
|
||||||
|
if (won) {
|
||||||
|
console.log('Board', j, 'has won, removing...')
|
||||||
|
boards.splice(j, 1)
|
||||||
|
j--
|
||||||
|
if (boards.length === 0) {
|
||||||
|
const score = calculateBoardScore(board, subList)
|
||||||
|
console.log('Score:', score)
|
||||||
|
console.log('items:', subList)
|
||||||
|
console.log('item:', subList[subList.length - 1])
|
||||||
|
console.log('Result:', score * subList[subList.length - 1])
|
||||||
|
break root
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
38
d4/utils.ts
Normal file
38
d4/utils.ts
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
export type Board<T = number> = Array<Array<T>>
|
||||||
|
|
||||||
|
export function hasBoardWon(board: Board, values: Array<Number>) {
|
||||||
|
const victoryBoard: Board<boolean> = board.map((line) => line.map((value) => values.includes(value)))
|
||||||
|
let colsHasFalse = Array.from(Array(victoryBoard.length)).map(() => false)
|
||||||
|
for (let lineIndex = 0; lineIndex < victoryBoard.length; lineIndex++) {
|
||||||
|
const line = victoryBoard[lineIndex];
|
||||||
|
let hasFalse = false
|
||||||
|
for (let columnIndex = 0; columnIndex < line.length; columnIndex++) {
|
||||||
|
const item = line[columnIndex];
|
||||||
|
if (!item) {
|
||||||
|
colsHasFalse[columnIndex] = true
|
||||||
|
hasFalse = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasFalse) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return colsHasFalse.includes(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseBoard(board: string): Board {
|
||||||
|
const lines = board.split('\n')
|
||||||
|
const res: Board = []
|
||||||
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
const line = lines[i]
|
||||||
|
res[i] = line.split(/ ?/g).map((v) => parseInt(v)).filter((it) => !isNaN(it))
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
export function calculateBoardScore(board: Board, subList: Array<number>) {
|
||||||
|
return board.reduce((bp, bc) => {
|
||||||
|
return bp + bc.reduce((lp, lc) => subList.includes(lc) ? lp : lp + lc, 0)
|
||||||
|
}, 0)
|
||||||
|
}
|
10
d5/ex.txt
Normal file
10
d5/ex.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
0,9 -> 5,9
|
||||||
|
8,0 -> 0,8
|
||||||
|
9,4 -> 3,4
|
||||||
|
2,2 -> 2,1
|
||||||
|
7,0 -> 7,4
|
||||||
|
6,4 -> 2,0
|
||||||
|
0,9 -> 2,9
|
||||||
|
3,4 -> 1,4
|
||||||
|
0,0 -> 8,8
|
||||||
|
5,5 -> 8,2
|
500
d5/input.txt
Normal file
500
d5/input.txt
Normal file
@ -0,0 +1,500 @@
|
|||||||
|
491,392 -> 34,392
|
||||||
|
337,52 -> 485,52
|
||||||
|
256,605 -> 256,959
|
||||||
|
889,142 -> 153,878
|
||||||
|
189,59 -> 512,382
|
||||||
|
399,193 -> 598,193
|
||||||
|
578,370 -> 795,153
|
||||||
|
79,450 -> 569,450
|
||||||
|
565,444 -> 270,149
|
||||||
|
39,28 -> 39,846
|
||||||
|
114,353 -> 114,383
|
||||||
|
356,61 -> 356,327
|
||||||
|
140,132 -> 515,132
|
||||||
|
361,848 -> 361,527
|
||||||
|
466,257 -> 466,784
|
||||||
|
818,397 -> 818,14
|
||||||
|
693,554 -> 693,984
|
||||||
|
171,290 -> 171,655
|
||||||
|
989,889 -> 170,70
|
||||||
|
527,855 -> 527,549
|
||||||
|
209,355 -> 486,355
|
||||||
|
800,430 -> 291,939
|
||||||
|
980,38 -> 31,987
|
||||||
|
964,559 -> 964,799
|
||||||
|
491,612 -> 930,173
|
||||||
|
57,977 -> 958,76
|
||||||
|
149,465 -> 349,465
|
||||||
|
512,624 -> 629,507
|
||||||
|
460,943 -> 460,441
|
||||||
|
988,29 -> 988,968
|
||||||
|
104,337 -> 441,337
|
||||||
|
939,48 -> 939,546
|
||||||
|
941,904 -> 498,461
|
||||||
|
850,972 -> 649,771
|
||||||
|
840,901 -> 23,84
|
||||||
|
231,790 -> 231,873
|
||||||
|
230,668 -> 840,58
|
||||||
|
410,922 -> 435,897
|
||||||
|
341,337 -> 341,406
|
||||||
|
264,752 -> 258,752
|
||||||
|
457,969 -> 457,757
|
||||||
|
465,42 -> 465,350
|
||||||
|
748,783 -> 502,783
|
||||||
|
461,930 -> 461,142
|
||||||
|
392,265 -> 215,265
|
||||||
|
417,805 -> 417,231
|
||||||
|
825,870 -> 60,105
|
||||||
|
524,167 -> 703,346
|
||||||
|
963,829 -> 308,174
|
||||||
|
730,361 -> 730,252
|
||||||
|
61,373 -> 61,593
|
||||||
|
873,893 -> 132,152
|
||||||
|
820,719 -> 417,719
|
||||||
|
142,238 -> 212,168
|
||||||
|
142,653 -> 676,119
|
||||||
|
392,955 -> 392,453
|
||||||
|
368,385 -> 414,385
|
||||||
|
464,762 -> 592,762
|
||||||
|
542,168 -> 542,789
|
||||||
|
622,693 -> 166,237
|
||||||
|
477,290 -> 792,290
|
||||||
|
731,56 -> 731,677
|
||||||
|
516,77 -> 326,77
|
||||||
|
595,973 -> 779,973
|
||||||
|
68,487 -> 128,487
|
||||||
|
389,738 -> 762,738
|
||||||
|
721,13 -> 827,119
|
||||||
|
797,625 -> 347,625
|
||||||
|
75,67 -> 75,458
|
||||||
|
931,142 -> 219,854
|
||||||
|
422,835 -> 980,835
|
||||||
|
278,565 -> 753,565
|
||||||
|
225,970 -> 806,389
|
||||||
|
791,725 -> 691,725
|
||||||
|
924,975 -> 18,69
|
||||||
|
326,763 -> 969,120
|
||||||
|
663,895 -> 663,559
|
||||||
|
940,965 -> 142,167
|
||||||
|
146,425 -> 791,425
|
||||||
|
832,968 -> 272,408
|
||||||
|
494,804 -> 694,804
|
||||||
|
23,25 -> 900,902
|
||||||
|
621,163 -> 894,163
|
||||||
|
587,605 -> 587,716
|
||||||
|
41,931 -> 383,589
|
||||||
|
888,530 -> 341,530
|
||||||
|
292,801 -> 292,567
|
||||||
|
537,213 -> 245,213
|
||||||
|
513,84 -> 527,84
|
||||||
|
623,516 -> 623,128
|
||||||
|
549,729 -> 509,729
|
||||||
|
576,232 -> 869,232
|
||||||
|
513,847 -> 433,847
|
||||||
|
536,612 -> 434,612
|
||||||
|
608,377 -> 33,952
|
||||||
|
137,762 -> 424,475
|
||||||
|
329,286 -> 584,541
|
||||||
|
493,296 -> 493,316
|
||||||
|
160,343 -> 189,343
|
||||||
|
477,929 -> 976,430
|
||||||
|
695,607 -> 557,607
|
||||||
|
745,322 -> 28,322
|
||||||
|
777,73 -> 76,774
|
||||||
|
163,723 -> 163,816
|
||||||
|
30,549 -> 63,516
|
||||||
|
163,914 -> 898,179
|
||||||
|
603,823 -> 603,78
|
||||||
|
498,616 -> 886,228
|
||||||
|
229,591 -> 341,591
|
||||||
|
742,841 -> 343,841
|
||||||
|
720,808 -> 934,808
|
||||||
|
985,48 -> 48,985
|
||||||
|
368,859 -> 178,859
|
||||||
|
506,30 -> 144,30
|
||||||
|
19,110 -> 19,750
|
||||||
|
293,689 -> 293,294
|
||||||
|
13,462 -> 980,462
|
||||||
|
536,963 -> 346,773
|
||||||
|
836,471 -> 462,471
|
||||||
|
506,952 -> 489,952
|
||||||
|
830,15 -> 461,15
|
||||||
|
392,378 -> 237,378
|
||||||
|
295,48 -> 295,825
|
||||||
|
264,679 -> 264,602
|
||||||
|
487,582 -> 487,116
|
||||||
|
832,677 -> 788,677
|
||||||
|
469,770 -> 211,512
|
||||||
|
400,773 -> 394,773
|
||||||
|
262,836 -> 262,454
|
||||||
|
51,17 -> 969,935
|
||||||
|
483,525 -> 838,880
|
||||||
|
71,124 -> 164,31
|
||||||
|
103,226 -> 912,226
|
||||||
|
785,169 -> 785,454
|
||||||
|
858,825 -> 176,143
|
||||||
|
248,960 -> 427,781
|
||||||
|
255,37 -> 767,37
|
||||||
|
832,149 -> 506,149
|
||||||
|
256,246 -> 86,246
|
||||||
|
447,448 -> 765,448
|
||||||
|
654,159 -> 654,158
|
||||||
|
120,500 -> 120,341
|
||||||
|
200,19 -> 839,658
|
||||||
|
451,251 -> 763,563
|
||||||
|
931,75 -> 931,312
|
||||||
|
69,404 -> 311,646
|
||||||
|
31,678 -> 31,231
|
||||||
|
410,307 -> 410,236
|
||||||
|
988,976 -> 387,375
|
||||||
|
654,402 -> 738,486
|
||||||
|
30,942 -> 942,30
|
||||||
|
115,652 -> 98,669
|
||||||
|
405,764 -> 375,734
|
||||||
|
88,759 -> 125,759
|
||||||
|
636,835 -> 722,835
|
||||||
|
300,60 -> 126,60
|
||||||
|
159,225 -> 159,319
|
||||||
|
934,188 -> 934,74
|
||||||
|
46,822 -> 708,160
|
||||||
|
605,612 -> 605,463
|
||||||
|
200,281 -> 536,617
|
||||||
|
392,11 -> 79,324
|
||||||
|
917,126 -> 258,785
|
||||||
|
803,143 -> 803,180
|
||||||
|
116,556 -> 651,556
|
||||||
|
922,222 -> 468,676
|
||||||
|
266,782 -> 896,782
|
||||||
|
733,448 -> 764,448
|
||||||
|
915,75 -> 305,685
|
||||||
|
150,243 -> 842,243
|
||||||
|
485,641 -> 963,641
|
||||||
|
965,206 -> 965,275
|
||||||
|
78,868 -> 748,198
|
||||||
|
37,947 -> 859,947
|
||||||
|
429,289 -> 429,48
|
||||||
|
378,261 -> 378,624
|
||||||
|
768,494 -> 768,782
|
||||||
|
702,566 -> 113,566
|
||||||
|
290,148 -> 913,771
|
||||||
|
806,931 -> 849,931
|
||||||
|
725,970 -> 299,970
|
||||||
|
38,565 -> 740,565
|
||||||
|
262,730 -> 973,730
|
||||||
|
826,376 -> 826,97
|
||||||
|
318,576 -> 318,227
|
||||||
|
159,868 -> 448,868
|
||||||
|
344,256 -> 344,615
|
||||||
|
824,188 -> 588,424
|
||||||
|
505,843 -> 897,843
|
||||||
|
293,348 -> 293,488
|
||||||
|
433,833 -> 165,565
|
||||||
|
56,471 -> 169,471
|
||||||
|
77,896 -> 914,59
|
||||||
|
405,904 -> 405,174
|
||||||
|
274,364 -> 274,88
|
||||||
|
785,704 -> 538,704
|
||||||
|
877,389 -> 681,389
|
||||||
|
790,936 -> 327,936
|
||||||
|
89,143 -> 755,809
|
||||||
|
721,450 -> 721,406
|
||||||
|
253,664 -> 811,664
|
||||||
|
881,143 -> 97,927
|
||||||
|
205,738 -> 645,738
|
||||||
|
869,951 -> 282,364
|
||||||
|
374,697 -> 374,592
|
||||||
|
251,989 -> 251,977
|
||||||
|
521,187 -> 885,187
|
||||||
|
536,401 -> 536,38
|
||||||
|
636,840 -> 636,873
|
||||||
|
695,333 -> 52,976
|
||||||
|
790,757 -> 790,358
|
||||||
|
314,765 -> 882,765
|
||||||
|
880,439 -> 127,439
|
||||||
|
266,848 -> 810,304
|
||||||
|
802,419 -> 802,936
|
||||||
|
554,67 -> 554,956
|
||||||
|
311,379 -> 685,753
|
||||||
|
183,544 -> 305,544
|
||||||
|
857,341 -> 407,791
|
||||||
|
306,559 -> 727,980
|
||||||
|
184,477 -> 509,152
|
||||||
|
934,174 -> 934,154
|
||||||
|
28,12 -> 28,968
|
||||||
|
418,984 -> 112,678
|
||||||
|
788,89 -> 837,89
|
||||||
|
229,425 -> 192,462
|
||||||
|
714,701 -> 424,411
|
||||||
|
198,313 -> 156,355
|
||||||
|
142,742 -> 215,742
|
||||||
|
15,639 -> 15,787
|
||||||
|
573,396 -> 462,396
|
||||||
|
954,977 -> 76,99
|
||||||
|
645,448 -> 652,448
|
||||||
|
958,822 -> 376,240
|
||||||
|
47,359 -> 212,194
|
||||||
|
524,366 -> 524,916
|
||||||
|
100,977 -> 501,576
|
||||||
|
932,148 -> 115,965
|
||||||
|
854,120 -> 421,553
|
||||||
|
318,630 -> 318,964
|
||||||
|
196,31 -> 874,709
|
||||||
|
812,826 -> 812,679
|
||||||
|
111,890 -> 897,104
|
||||||
|
46,35 -> 972,35
|
||||||
|
40,842 -> 40,835
|
||||||
|
390,510 -> 98,510
|
||||||
|
832,57 -> 124,765
|
||||||
|
422,331 -> 422,44
|
||||||
|
696,837 -> 696,555
|
||||||
|
849,571 -> 849,679
|
||||||
|
598,143 -> 598,261
|
||||||
|
670,745 -> 670,757
|
||||||
|
660,390 -> 660,912
|
||||||
|
960,578 -> 960,253
|
||||||
|
123,343 -> 123,28
|
||||||
|
643,199 -> 969,199
|
||||||
|
66,642 -> 669,39
|
||||||
|
776,30 -> 776,173
|
||||||
|
595,951 -> 84,951
|
||||||
|
908,183 -> 724,367
|
||||||
|
330,332 -> 330,455
|
||||||
|
954,955 -> 188,955
|
||||||
|
981,269 -> 90,269
|
||||||
|
235,579 -> 513,579
|
||||||
|
217,25 -> 217,990
|
||||||
|
811,810 -> 811,405
|
||||||
|
245,255 -> 367,255
|
||||||
|
860,225 -> 860,100
|
||||||
|
753,626 -> 697,626
|
||||||
|
755,404 -> 836,404
|
||||||
|
733,476 -> 336,476
|
||||||
|
562,172 -> 964,172
|
||||||
|
339,989 -> 749,989
|
||||||
|
167,581 -> 167,611
|
||||||
|
217,475 -> 217,747
|
||||||
|
103,598 -> 431,270
|
||||||
|
11,989 -> 989,11
|
||||||
|
925,90 -> 46,969
|
||||||
|
26,963 -> 935,54
|
||||||
|
40,925 -> 40,816
|
||||||
|
67,942 -> 984,25
|
||||||
|
933,652 -> 933,242
|
||||||
|
942,292 -> 942,138
|
||||||
|
889,909 -> 180,200
|
||||||
|
604,770 -> 237,770
|
||||||
|
30,627 -> 973,627
|
||||||
|
750,777 -> 750,645
|
||||||
|
254,797 -> 254,169
|
||||||
|
939,167 -> 347,759
|
||||||
|
889,682 -> 394,682
|
||||||
|
788,338 -> 388,338
|
||||||
|
757,252 -> 169,252
|
||||||
|
806,131 -> 699,131
|
||||||
|
562,270 -> 562,481
|
||||||
|
950,349 -> 459,840
|
||||||
|
219,915 -> 932,202
|
||||||
|
977,505 -> 977,708
|
||||||
|
915,559 -> 915,125
|
||||||
|
366,397 -> 366,717
|
||||||
|
54,723 -> 433,723
|
||||||
|
570,842 -> 236,508
|
||||||
|
513,365 -> 513,80
|
||||||
|
569,523 -> 569,266
|
||||||
|
278,764 -> 278,178
|
||||||
|
136,136 -> 84,84
|
||||||
|
787,108 -> 787,809
|
||||||
|
461,388 -> 855,782
|
||||||
|
64,898 -> 848,114
|
||||||
|
628,71 -> 178,521
|
||||||
|
842,66 -> 842,699
|
||||||
|
293,68 -> 742,68
|
||||||
|
960,102 -> 358,704
|
||||||
|
834,669 -> 27,669
|
||||||
|
11,43 -> 374,406
|
||||||
|
399,803 -> 340,803
|
||||||
|
564,211 -> 20,755
|
||||||
|
370,841 -> 370,321
|
||||||
|
518,590 -> 518,255
|
||||||
|
470,150 -> 470,850
|
||||||
|
769,182 -> 234,717
|
||||||
|
97,787 -> 97,382
|
||||||
|
36,31 -> 982,977
|
||||||
|
831,467 -> 471,827
|
||||||
|
253,836 -> 547,836
|
||||||
|
957,681 -> 957,919
|
||||||
|
768,831 -> 768,275
|
||||||
|
98,36 -> 955,893
|
||||||
|
283,413 -> 840,413
|
||||||
|
21,870 -> 20,870
|
||||||
|
979,507 -> 979,37
|
||||||
|
339,757 -> 210,757
|
||||||
|
388,594 -> 801,594
|
||||||
|
867,939 -> 91,163
|
||||||
|
755,864 -> 755,501
|
||||||
|
856,177 -> 736,57
|
||||||
|
74,365 -> 376,63
|
||||||
|
386,451 -> 815,22
|
||||||
|
389,883 -> 679,593
|
||||||
|
116,216 -> 157,175
|
||||||
|
693,960 -> 693,454
|
||||||
|
704,962 -> 306,962
|
||||||
|
613,442 -> 867,442
|
||||||
|
578,13 -> 578,855
|
||||||
|
417,683 -> 118,683
|
||||||
|
127,161 -> 742,161
|
||||||
|
646,979 -> 646,270
|
||||||
|
14,842 -> 14,802
|
||||||
|
496,902 -> 506,912
|
||||||
|
468,354 -> 468,875
|
||||||
|
714,431 -> 714,172
|
||||||
|
554,297 -> 554,790
|
||||||
|
717,664 -> 883,664
|
||||||
|
551,182 -> 980,611
|
||||||
|
794,932 -> 499,637
|
||||||
|
384,499 -> 507,499
|
||||||
|
32,368 -> 257,368
|
||||||
|
984,131 -> 904,131
|
||||||
|
973,16 -> 10,979
|
||||||
|
189,178 -> 189,752
|
||||||
|
492,404 -> 492,593
|
||||||
|
11,515 -> 117,515
|
||||||
|
230,182 -> 230,954
|
||||||
|
652,16 -> 663,16
|
||||||
|
698,693 -> 490,693
|
||||||
|
252,942 -> 587,942
|
||||||
|
551,901 -> 428,778
|
||||||
|
899,320 -> 903,316
|
||||||
|
14,577 -> 313,278
|
||||||
|
409,576 -> 409,475
|
||||||
|
466,883 -> 819,883
|
||||||
|
221,472 -> 609,472
|
||||||
|
686,828 -> 686,720
|
||||||
|
988,989 -> 13,14
|
||||||
|
514,171 -> 227,171
|
||||||
|
868,842 -> 632,842
|
||||||
|
279,824 -> 697,406
|
||||||
|
678,464 -> 678,687
|
||||||
|
736,358 -> 736,259
|
||||||
|
933,66 -> 24,975
|
||||||
|
679,470 -> 679,689
|
||||||
|
979,953 -> 45,19
|
||||||
|
98,826 -> 737,187
|
||||||
|
612,732 -> 612,681
|
||||||
|
985,23 -> 23,985
|
||||||
|
787,732 -> 332,277
|
||||||
|
660,211 -> 660,61
|
||||||
|
395,19 -> 246,19
|
||||||
|
129,876 -> 955,50
|
||||||
|
676,246 -> 821,246
|
||||||
|
980,26 -> 18,988
|
||||||
|
142,945 -> 142,218
|
||||||
|
165,240 -> 540,240
|
||||||
|
941,522 -> 941,129
|
||||||
|
876,274 -> 876,340
|
||||||
|
627,782 -> 905,782
|
||||||
|
928,235 -> 246,235
|
||||||
|
336,449 -> 92,205
|
||||||
|
748,62 -> 748,787
|
||||||
|
804,725 -> 356,277
|
||||||
|
910,89 -> 19,980
|
||||||
|
391,99 -> 155,335
|
||||||
|
608,127 -> 516,219
|
||||||
|
337,255 -> 337,649
|
||||||
|
818,831 -> 818,859
|
||||||
|
146,204 -> 301,359
|
||||||
|
629,646 -> 906,923
|
||||||
|
87,860 -> 824,123
|
||||||
|
613,867 -> 613,946
|
||||||
|
286,339 -> 286,626
|
||||||
|
942,120 -> 595,467
|
||||||
|
35,207 -> 187,207
|
||||||
|
684,559 -> 283,158
|
||||||
|
48,768 -> 48,349
|
||||||
|
656,965 -> 656,27
|
||||||
|
865,341 -> 865,576
|
||||||
|
218,786 -> 152,786
|
||||||
|
697,69 -> 583,69
|
||||||
|
790,79 -> 552,79
|
||||||
|
310,547 -> 846,11
|
||||||
|
428,809 -> 428,940
|
||||||
|
664,829 -> 664,455
|
||||||
|
265,775 -> 749,775
|
||||||
|
362,221 -> 309,168
|
||||||
|
437,253 -> 437,597
|
||||||
|
601,324 -> 245,680
|
||||||
|
24,69 -> 24,476
|
||||||
|
420,344 -> 420,525
|
||||||
|
215,866 -> 635,866
|
||||||
|
926,770 -> 315,770
|
||||||
|
413,650 -> 413,624
|
||||||
|
751,765 -> 475,489
|
||||||
|
673,709 -> 39,75
|
||||||
|
230,689 -> 805,689
|
||||||
|
31,209 -> 789,967
|
||||||
|
698,255 -> 909,255
|
||||||
|
641,752 -> 866,527
|
||||||
|
346,780 -> 391,825
|
||||||
|
328,905 -> 328,130
|
||||||
|
628,674 -> 628,354
|
||||||
|
666,110 -> 98,678
|
||||||
|
846,651 -> 846,371
|
||||||
|
28,946 -> 28,482
|
||||||
|
289,844 -> 458,675
|
||||||
|
605,602 -> 605,297
|
||||||
|
355,217 -> 239,217
|
||||||
|
453,96 -> 195,354
|
||||||
|
988,90 -> 145,933
|
||||||
|
801,194 -> 801,109
|
||||||
|
894,708 -> 894,212
|
||||||
|
177,447 -> 607,877
|
||||||
|
824,391 -> 788,391
|
||||||
|
386,940 -> 471,855
|
||||||
|
703,425 -> 583,425
|
||||||
|
848,110 -> 36,922
|
||||||
|
603,596 -> 685,678
|
||||||
|
584,458 -> 584,482
|
||||||
|
464,903 -> 343,903
|
||||||
|
888,413 -> 405,413
|
||||||
|
320,185 -> 103,185
|
||||||
|
475,458 -> 55,878
|
||||||
|
371,843 -> 371,466
|
||||||
|
785,507 -> 785,570
|
||||||
|
904,553 -> 904,983
|
||||||
|
872,600 -> 872,848
|
||||||
|
296,693 -> 751,238
|
||||||
|
490,488 -> 322,488
|
||||||
|
37,371 -> 185,223
|
||||||
|
238,618 -> 238,883
|
||||||
|
232,89 -> 123,89
|
||||||
|
20,14 -> 961,955
|
||||||
|
794,318 -> 914,318
|
||||||
|
407,499 -> 246,338
|
||||||
|
641,514 -> 227,514
|
||||||
|
284,210 -> 562,488
|
||||||
|
164,566 -> 498,900
|
||||||
|
20,825 -> 150,955
|
||||||
|
235,384 -> 537,686
|
||||||
|
151,116 -> 979,944
|
||||||
|
697,133 -> 59,771
|
||||||
|
212,226 -> 38,226
|
||||||
|
523,527 -> 523,497
|
||||||
|
119,493 -> 352,726
|
||||||
|
927,157 -> 154,930
|
||||||
|
336,149 -> 581,394
|
||||||
|
103,580 -> 354,580
|
||||||
|
891,494 -> 532,853
|
||||||
|
22,272 -> 538,788
|
||||||
|
544,296 -> 519,271
|
||||||
|
821,382 -> 821,155
|
||||||
|
501,807 -> 501,202
|
||||||
|
588,76 -> 708,76
|
||||||
|
773,681 -> 184,681
|
||||||
|
754,936 -> 86,268
|
||||||
|
582,972 -> 40,972
|
||||||
|
530,458 -> 530,329
|
||||||
|
109,433 -> 649,433
|
||||||
|
411,215 -> 411,311
|
||||||
|
433,568 -> 433,585
|
||||||
|
232,504 -> 799,504
|
||||||
|
72,442 -> 38,442
|
52
d5/part1.ts
Normal file
52
d5/part1.ts
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
function parseLine(line: string): Array<`${number}:${number}`> {
|
||||||
|
const splitted = line.split(' -> ')
|
||||||
|
const xy1 = splitted[0].split(',').map((it) => parseInt(it))
|
||||||
|
const xy2 = splitted[1].split(',').map((it) => parseInt(it))
|
||||||
|
const xMin = Math.min(xy1[0], xy2[0])
|
||||||
|
const xMax = Math.max(xy1[0], xy2[0])
|
||||||
|
const yMin = Math.min(xy1[1], xy2[1])
|
||||||
|
const yMax = Math.max(xy1[1], xy2[1])
|
||||||
|
|
||||||
|
if (xMin !== xMax && yMin !== yMax) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(xy1, xy2)
|
||||||
|
// console.log(xMin, xMax, yMin, yMax)
|
||||||
|
|
||||||
|
const res: Array<`${number}:${number}`> = []
|
||||||
|
|
||||||
|
for (let x = xMin; x <= xMax; x++) {
|
||||||
|
for (let y = yMin; y <= yMax; y++) {
|
||||||
|
res.push(`${x}:${y}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
const cellCount: Record<`${number}:${number}`, number> = {}
|
||||||
|
|
||||||
|
for (let i = 0; i < input.length; i++) {
|
||||||
|
const line = input[i];
|
||||||
|
const vents = parseLine(line)
|
||||||
|
for (const vent of vents) {
|
||||||
|
if (!(vent in cellCount)) {
|
||||||
|
cellCount[vent] = 0
|
||||||
|
}
|
||||||
|
cellCount[vent]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(cellCount)
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"Result:",
|
||||||
|
Object.values(cellCount).reduce((p, it) => it >= 2 ? p+1 : p, 0)
|
||||||
|
)
|
67
d5/part2.ts
Normal file
67
d5/part2.ts
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
function parseLine(line: string): Array<`${number}:${number}`> {
|
||||||
|
const splitted = line.split(' -> ')
|
||||||
|
const xy1 = splitted[0].split(',').map((it) => parseInt(it))
|
||||||
|
const xy2 = splitted[1].split(',').map((it) => parseInt(it))
|
||||||
|
const xMin = Math.min(xy1[0], xy2[0])
|
||||||
|
const xMax = Math.max(xy1[0], xy2[0])
|
||||||
|
const yMin = Math.min(xy1[1], xy2[1])
|
||||||
|
const yMax = Math.max(xy1[1], xy2[1])
|
||||||
|
|
||||||
|
|
||||||
|
// console.log(xy1, xy2)
|
||||||
|
// console.log(xMin, xMax, yMin, yMax)
|
||||||
|
|
||||||
|
const isDiagonal = xMin !== xMax && yMin !== yMax
|
||||||
|
const res: Array<`${number}:${number}`> = []
|
||||||
|
|
||||||
|
if (isDiagonal) {
|
||||||
|
const xChange = xy1[0] > xy2[0] ? -1 : 1
|
||||||
|
const yChange = xy1[1] > xy2[1] ? -1 : 1
|
||||||
|
let x = xy1[0]
|
||||||
|
let y = xy1[1]
|
||||||
|
for (let i = 0; i <= (xMax - xMin); i++) {
|
||||||
|
const tmp = `${x}:${y}` as `${number}:${number}`
|
||||||
|
// console.log(line, tmp)
|
||||||
|
res.push(tmp)
|
||||||
|
x += xChange
|
||||||
|
y += yChange
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (let x = xMin; x <= xMax; x++) {
|
||||||
|
for (let y = yMin; y <= yMax; y++) {
|
||||||
|
const tmp = `${x}:${y}` as `${number}:${number}`
|
||||||
|
// console.log(line, tmp)
|
||||||
|
res.push(tmp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return res
|
||||||
|
}
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split('\n')
|
||||||
|
|
||||||
|
const cellCount: Record<`${number}:${number}`, number> = {}
|
||||||
|
|
||||||
|
for (let i = 0; i < input.length; i++) {
|
||||||
|
const line = input[i];
|
||||||
|
const vents = parseLine(line)
|
||||||
|
for (const vent of vents) {
|
||||||
|
if (!(vent in cellCount)) {
|
||||||
|
cellCount[vent] = 0
|
||||||
|
}
|
||||||
|
cellCount[vent]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(cellCount)
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"Result:",
|
||||||
|
Object.values(cellCount).reduce((p, it) => it >= 2 ? p+1 : p, 0)
|
||||||
|
)
|
1
d6/input.txt
Normal file
1
d6/input.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
5,4,3,5,1,1,2,1,2,1,3,2,3,4,5,1,2,4,3,2,5,1,4,2,1,1,2,5,4,4,4,1,5,4,5,2,1,2,5,5,4,1,3,1,4,2,4,2,5,1,3,5,3,2,3,1,1,4,5,2,4,3,1,5,5,1,3,1,3,2,2,4,1,3,4,3,3,4,1,3,4,3,4,5,2,1,1,1,4,5,5,1,1,3,2,4,1,2,2,2,4,1,2,5,5,1,4,5,2,4,2,1,5,4,1,3,4,1,2,3,1,5,1,3,4,5,4,1,4,3,3,3,5,5,1,1,5,1,5,5,1,5,2,1,5,1,2,3,5,5,1,3,3,1,5,3,4,3,4,3,2,5,2,1,2,5,1,1,1,1,5,1,1,4,3,3,5,1,1,1,4,4,1,3,3,5,5,4,3,2,1,2,2,3,4,1,5,4,3,1,1,5,1,4,2,3,2,2,3,4,1,3,4,1,4,3,4,3,1,3,3,1,1,4,1,1,1,4,5,3,1,1,2,5,2,5,1,5,3,3,1,3,5,5,1,5,4,3,1,5,1,1,5,5,1,1,2,5,5,5,1,1,3,2,2,3,4,5,5,2,5,4,2,1,5,1,4,4,5,4,4,1,2,1,1,2,3,5,5,1,3,1,4,2,3,3,1,4,1,1
|
28
d6/part1.ts
Normal file
28
d6/part1.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split(',').map((it) => parseInt(it))
|
||||||
|
|
||||||
|
const numberOfDays = 80
|
||||||
|
const LOG = false
|
||||||
|
|
||||||
|
if (LOG) console.log("Initial state:", input)
|
||||||
|
|
||||||
|
for (let i = 1; i <= numberOfDays; i++) {
|
||||||
|
const len = input.length
|
||||||
|
for (let j = 0; j < len; j++) {
|
||||||
|
if (input[j] === 0) {
|
||||||
|
input[j] = 6
|
||||||
|
input.push(8)
|
||||||
|
} else {
|
||||||
|
input[j]--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOG) console.log("After", i, "days:", input)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"Result:", input.length
|
||||||
|
)
|
43
d6/part2.ts
Normal file
43
d6/part2.ts
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
const input = fs.readFileSync(__dirname + '/input.txt').toString()
|
||||||
|
.split(',').map((it) => parseInt(it))
|
||||||
|
|
||||||
|
const numberOfDays = 256
|
||||||
|
const LOG = false
|
||||||
|
|
||||||
|
|
||||||
|
const list: Record<number, number> = {}
|
||||||
|
|
||||||
|
for (const fishy of input) {
|
||||||
|
if (!(fishy in list)) {
|
||||||
|
list[fishy] = 0
|
||||||
|
}
|
||||||
|
list[fishy]++
|
||||||
|
}
|
||||||
|
|
||||||
|
if (LOG) console.log("Initial state:", list, Object.values(list).reduce((p, c) => p + c, 0))
|
||||||
|
|
||||||
|
for (let i = 1; i <= numberOfDays; i++) {
|
||||||
|
let newBorns = 0
|
||||||
|
for (let v = 0; v <= 8; v++) {
|
||||||
|
if (!(v in list)) {
|
||||||
|
list[v] = 0
|
||||||
|
}
|
||||||
|
if (v === 0) {
|
||||||
|
newBorns = list[v] ?? 0
|
||||||
|
} else {
|
||||||
|
list[v - 1] = list[v]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list[8] = newBorns
|
||||||
|
list[6] = newBorns + (list[6] ?? 0)
|
||||||
|
|
||||||
|
|
||||||
|
if (LOG) console.log("After", i, "days:", list, Object.values(list).reduce((p, c) => p + c, 0))
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"Result:", Object.values(list).reduce((p, c) => p + c, 0)
|
||||||
|
)
|
261
package-lock.json
generated
Normal file
261
package-lock.json
generated
Normal file
@ -0,0 +1,261 @@
|
|||||||
|
{
|
||||||
|
"name": "2021",
|
||||||
|
"lockfileVersion": 2,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"dependencies": {
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typescript": "^4.5.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.11.11"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cspotcode/source-map-consumer": {
|
||||||
|
"version": "0.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
|
||||||
|
"integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@cspotcode/source-map-support": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
|
||||||
|
"integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-consumer": "0.8.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node10": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node12": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node14": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg=="
|
||||||
|
},
|
||||||
|
"node_modules/@tsconfig/node16": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||||
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "16.11.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz",
|
||||||
|
"integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw=="
|
||||||
|
},
|
||||||
|
"node_modules/acorn": {
|
||||||
|
"version": "8.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz",
|
||||||
|
"integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==",
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/acorn-walk": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||||
|
},
|
||||||
|
"node_modules/create-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||||
|
},
|
||||||
|
"node_modules/diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||||
|
},
|
||||||
|
"node_modules/ts-node": {
|
||||||
|
"version": "10.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
|
||||||
|
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
|
"@tsconfig/node10": "^1.0.7",
|
||||||
|
"@tsconfig/node12": "^1.0.7",
|
||||||
|
"@tsconfig/node14": "^1.0.0",
|
||||||
|
"@tsconfig/node16": "^1.0.2",
|
||||||
|
"acorn": "^8.4.1",
|
||||||
|
"acorn-walk": "^8.1.1",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"create-require": "^1.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"ts-node": "dist/bin.js",
|
||||||
|
"ts-node-cwd": "dist/bin-cwd.js",
|
||||||
|
"ts-node-script": "dist/bin-script.js",
|
||||||
|
"ts-node-transpile-only": "dist/bin-transpile.js",
|
||||||
|
"ts-script": "dist/bin-script-deprecated.js"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"@swc/core": ">=1.2.50",
|
||||||
|
"@swc/wasm": ">=1.2.50",
|
||||||
|
"@types/node": "*",
|
||||||
|
"typescript": ">=2.7"
|
||||||
|
},
|
||||||
|
"peerDependenciesMeta": {
|
||||||
|
"@swc/core": {
|
||||||
|
"optional": true
|
||||||
|
},
|
||||||
|
"@swc/wasm": {
|
||||||
|
"optional": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "4.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||||
|
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw==",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4.2.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@cspotcode/source-map-consumer": {
|
||||||
|
"version": "0.8.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz",
|
||||||
|
"integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg=="
|
||||||
|
},
|
||||||
|
"@cspotcode/source-map-support": {
|
||||||
|
"version": "0.7.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz",
|
||||||
|
"integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==",
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-consumer": "0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@tsconfig/node10": {
|
||||||
|
"version": "1.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz",
|
||||||
|
"integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node12": {
|
||||||
|
"version": "1.0.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz",
|
||||||
|
"integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node14": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg=="
|
||||||
|
},
|
||||||
|
"@tsconfig/node16": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA=="
|
||||||
|
},
|
||||||
|
"@types/node": {
|
||||||
|
"version": "16.11.11",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz",
|
||||||
|
"integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw=="
|
||||||
|
},
|
||||||
|
"acorn": {
|
||||||
|
"version": "8.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz",
|
||||||
|
"integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw=="
|
||||||
|
},
|
||||||
|
"acorn-walk": {
|
||||||
|
"version": "8.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
|
||||||
|
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA=="
|
||||||
|
},
|
||||||
|
"arg": {
|
||||||
|
"version": "4.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz",
|
||||||
|
"integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA=="
|
||||||
|
},
|
||||||
|
"create-require": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ=="
|
||||||
|
},
|
||||||
|
"diff": {
|
||||||
|
"version": "4.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz",
|
||||||
|
"integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A=="
|
||||||
|
},
|
||||||
|
"make-error": {
|
||||||
|
"version": "1.3.6",
|
||||||
|
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
|
||||||
|
"integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw=="
|
||||||
|
},
|
||||||
|
"ts-node": {
|
||||||
|
"version": "10.4.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.4.0.tgz",
|
||||||
|
"integrity": "sha512-g0FlPvvCXSIO1JDF6S232P5jPYqBkRL9qly81ZgAOSU7rwI0stphCgd2kLiCrU9DjQCrJMWEqcNSjQL02s6d8A==",
|
||||||
|
"requires": {
|
||||||
|
"@cspotcode/source-map-support": "0.7.0",
|
||||||
|
"@tsconfig/node10": "^1.0.7",
|
||||||
|
"@tsconfig/node12": "^1.0.7",
|
||||||
|
"@tsconfig/node14": "^1.0.0",
|
||||||
|
"@tsconfig/node16": "^1.0.2",
|
||||||
|
"acorn": "^8.4.1",
|
||||||
|
"acorn-walk": "^8.1.1",
|
||||||
|
"arg": "^4.1.0",
|
||||||
|
"create-require": "^1.1.0",
|
||||||
|
"diff": "^4.0.1",
|
||||||
|
"make-error": "^1.1.1",
|
||||||
|
"yn": "3.1.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "4.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.2.tgz",
|
||||||
|
"integrity": "sha512-5BlMof9H1yGt0P8/WF+wPNw6GfctgGjXp5hkblpyT+8rkASSmkUKMXrxR0Xg8ThVCi/JnHQiKXeBaEwCeQwMFw=="
|
||||||
|
},
|
||||||
|
"yn": {
|
||||||
|
"version": "3.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",
|
||||||
|
"integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q=="
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
package.json
Normal file
9
package.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^16.11.11"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ts-node": "^10.4.0",
|
||||||
|
"typescript": "^4.5.2"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user