My solutions for Advent of Code 2022
Here are my solutions to the Advent of Code puzzles for 2022.
I'm using plain JavaScript for my solutions, using Node to run my scripts.
Each day has its own directory. The solutions can be found under index.js
, with a few tests in index.test.js
to verify some of the functions and algorithms created to solve that day's problems.
Hope you enjoy!
Here's my process for solving the problems
input.txt
file. So for Day 1, you put it in src/day-01/input.txt
index.test.js
file.index.js
file.npm
or yarn
to run the test
script found in the package.json
. Do this in a terminal that can run Node.const firstAnswer = someFunction(data)
console.log(firstAnswer)
and then in the terminal, let's say it's for Day 1, I would do:
cd src/day-01
node index.js
and observe the output. Be aware that you might run into infinite loops, and there are definitely problems that will not complete because they're designed to be too memory intensive. You'll probably have to kill a node process or two as you solve these challenges.
It's very rudimentary, but it does the trick.