Skip to content

honmanyau/advent-of-code

Repository files navigation

Advent of Code

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.

Table of Contents

Installation

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

Running and Testing

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.

Running a Single File

npm run ts-node -- "$(pwd)/path-to-file/filename.ts"
yarn run ts-node -- "$(pwd)/path-to-file/filename.ts"

Getting Solutions from a File

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"

Testing a Single File

npm run test -- "$(pwd)/path-to-file/test.ts"
yarn run test -- "$(pwd)/path-to-file/test.ts"

Testing by Year

npm run test:2020
yarn test:2020

Solutions

Advent of Code 2020

About

Solutions for Advent of Code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published