Giter Site home page Giter Site logo

andrewmackrodt / advent-of-code Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 469 KB

TypeScript solutions for Advent of Code

Home Page: https://andrewmackrodt.github.io/advent-of-code/

Shell 1.00% HTML 10.09% TypeScript 88.91%
advent-of-code-2022 advent-of-code-2021 typescript advent-of-code advent-of-code-2023

advent-of-code's Introduction

๐ŸŽ…๐Ÿฝ ๐Ÿง๐Ÿปโ€โ™€๏ธ Advent of Code ๐Ÿง๐Ÿปโ€โ™€๏ธ ๐ŸŽ…๐Ÿฝ

TypeScript solutions for Advent of Code. Supports web browsers and Node.js.

Demo: https://andrewmackrodt.github.io/advent-of-code/

advent-of-code-js-repl.webm

Project Structure

Solutions are located in ./src/year/day/:

  • README.md: puzzle description
  • input.txt: my puzzle input
  • index.ts: solution
  • index.test.ts: jest tests

Usage

Solve

To run a solution for a specific day of the current year, run npm run solve <day>, replacing <day> with the particular puzzle you want to run, e.g. npm run solve 10. To run a solution for a previous year, use <year>/<day>, e.g. npm run solve 2021/10.

Update

To use the update command, retrieve the value of your session cookie from https://adventofcode.com and enter it in .env under the SESSION_ID= key. The command will fetch any missing descriptions or inputs for the current year. If either README.md or input.txt exists for a specific day, those files will be skipped. External requests are throttled to one request every 2 seconds.

Description HTML responses are cached to ./cache/<year>-<day>.html. To force it to be retrieved again, e.g. to fetch the description for part 2, the file must be deleted manually.

Other Commands

Command Description
npm run solve 10 Print day 10 solution for the current year
npm run solve 2021/10 Print day 10 solution for 2021
npm run test Run all tests for all years
npm run test 2022 Run all tests for 2022
npm run test 10 Run day 10 tests for the current year
npm run test 2021/10 Run day 10 tests for 2021
npm run update Download puzzle descriptions and puzzle inputs for the current year
npm run update 2021 Download puzzle descriptions and puzzle inputs for 2021
npm run build Compile JS files to ./out
npm run lint Run eslint
npm run lint:fix Run eslint --fix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.