This repository contains my personal solutions to Advent of Code 2022.
All solutions are written in TypeScript. Get started with:
$ npm install
$ npm test
$ npx ts-node src/01_calories/elfCalories.ts
Max calories: 71502
Top three calories total: 208191
Added utilities for handling puzzle input:
- π arrays.ts, arrays.test.ts
- π strings.ts, strings.test.ts
- π src/02_rock-paper-scissors/index.ts
- π src/02_rock-paper-scissors/rockPaperScissors.ts
- π src/02_rock-paper-scissors/rockPaperScissors.test.ts
$ npx ts-node src/02_rock-paper-scissors
Total score for part 1: 12855
Total score for part 2: 13726
Used enums and quite many switch-case structures.
Added Circle class for circular lists.
- π Circle.ts, Circle.test.ts
- π src/03_rucksack/index.ts
- π src/03_rucksack/rucksack.ts
- π src/03_rucksack/rucksack.test.ts
$ npx ts-node src/03_rucksack
Part 1: sum of priorities is 7831
Part 2: sum of badge group priorities is 2683
Until day 3, working in VS Code dev container was extremely slow due to WSL2 and NTFS issues: microsoft/WSL#4197 / microsoft/WSL#4515. I fixed the issue temporarily by moving node_modules
outside of the NTFS volume and adding a symbolic link.
$ npx ts-node src/04_camp-cleanup
Pairs where one fully contains the other: 534
Pairs that overlap at all: 841
$ npx ts-node src/05_supply-stacks
Part 1: ZRLJGSCTR
Part 2: PRTTGRFPB
$ npx ts-node src/06_tuning-trouble
Part 1, end of message: 1766
Part 2, start of message: 2383
$ npx ts-node src/07_no-space-left-on-device
Part 1: the total size of small directories is 1743217
Part 2: the smallest directory to free up enough space has size 8319096
$ npx ts-node src/08_treetop-tree-house
Part 1: the number of visible trees is 1845
Part 2: highest scenic score possible is 230112
- π src/09_rope-bridge/index.ts
- π src/09_rope-bridge/Position.ts
- π src/09_rope-bridge/Position.test.ts
$ npx ts-node src/09_rope-bridge
Part 1: 6269
Part 2: 2557
$ npx ts-node src/10_cathode-ray-tube
The sum of these signal strengths is: 17840
Text on CRT screen:
####..##..#.....##..#..#.#....###...##..
#....#..#.#....#..#.#..#.#....#..#.#..#.
###..#..#.#....#....#..#.#....#..#.#....
#....####.#....#.##.#..#.#....###..#.##.
#....#..#.#....#..#.#..#.#....#....#..#.
####.#..#.####..###..##..####.#.....###.
$ npx ts-node ./src/11_monkey-in-the-middle
Part 1: monkey business level after 20 rounds: 66124
Part 2: monkey business level after 10 000 rounds: 19309892877
$ npx ts-node src/12_hill-climbing-algorithm
Part 1: the distance is 352
Part 2: the minimum distance is 345
$ npx ts-node src/13_distress_signal
Part 1: Sum of indices that are in the right order is 6272
Part 2: The decoder key is 22288
$ npx ts-node src/14_regolith_reservoir
Part 1: there are 825 grains of sand.
Part 2: there are 26729 grains of sand.
$ npx ts-node src/15_beacon-exclusion-zone
Part 1: the number of positions that cannot contain a beacon is 4502208
Part 2: the distress signal is coming from 3446137,3204480
Part 2: the distress signal frequency is 13784551204480
$ npx ts-node src/16_proboscidea-volcanium
Part 1: you can release 2253 pressure in 30 minutes
Part 2: you and π can release 2838 pressure in 26 minutes
$ npx ts-node src/17-pyroclastic-flow/
Part 1: height is 3219
Part 2: height is 1582758620701
$ npx ts-node src/18_boiling_boulders
Part 1: 4192
Part 2: 2520
$ npx ts-node src/19_not-enough-minerals
Part 1: the sum of quality levels is 978
Part 2: largest geodes multiplied together are 15939
- π src/20_grove-positioning-system/index.ts
- π src/20_grove-positioning-system/mixer.ts
- π src/20_grove-positioning-system/mixer.test.ts
$ npx ts-node src/20_grove-positioning-system
Part 1: the sum of coordinates is 13522
Part 2: the sum of coordinates is 17113168880158
$ npx ts-node src/21_monkey-math
Part 1: the monkey named root will yell 82225382988628
Part 2: the number to yell to pass root's equality test is 3429411069028
$ npx ts-node src/22_monkey-map/part1.ts
Part 1: the password is 165094
$ npx ts-node src/22_monkey-map/part2.ts
Part 2: the password is 95316
$ npx ts-node src/23_unstable-diffusion
Part 1: empty tiles in the rectangle: 3864
Part 2: elves stop moving after 946 rounds
$ npx ts-node src/24_blizzard-basin
Part 1: the fewest number of minutes required is 292.
Part 2: the fewest number of minutes required is 816.
$ npx ts-node src/25_full-of-hot-air
The sum of numbers in decimal is 28115957264952
The sum of numbers in SNAFU is 122-12==0-01=00-0=02