This repository contains my solutions for Advent of Code. The solutions are here just to satisify my inner collectionist, satiate my need for writing documentation, and so that I can come back years later to remind myself of the terrible algorithms that I used to write when I'm suffering from an episode of imposter syndrome.
The solutions are written in TypeScript under a Node.js environment. Once the repository is cloned, installation can be done using either the NPM or Yarn package manager.
# Clone the repoisotry
git clone https://github.com/honmanyau/advent-of-code
# Change to the cloned directory
cd advent-of-code
# Install the required dependencies with NPM
npm install
# Install the required dependencies with Yarn
yarn install
The Mocha test framework is used to write the tests in this repository. A few primitive shell scripts are set up in package.json
for excuting tests.
npm run ts-node -- "$(pwd)/path-to-file/filename.ts"
yarn run ts-node -- "$(pwd)/path-to-file/filename.ts"
The code that outpus the solutions contained in each challenge's index.ts
file only runs when the SOLVE
environment variable is set to true
. The environment variable can be specified when running the ts-node
script:
SOLVE=true npm run ts-node -- "$(pwd)/path-to-file/index.ts"
SOLVE=true yarn run ts-node -- "$(pwd)/path-to-file/index.ts"
Alternatively, one can also use the solve
script:
npm run solve -- "$(pwd)/path-to-file/index.ts"
yarn run solve -- "$(pwd)/path-to-file/index.ts"
npm run test -- "$(pwd)/path-to-file/test.ts"
yarn run test -- "$(pwd)/path-to-file/test.ts"
npm run test:2020
yarn test:2020