Giter VIP home page Giter VIP logo

aoc-2022-ts's Introduction

Advent of code solutions in typescript

This repo contains my solutions to advent of code 2022 and a wrapper to make it as easy as possible to fetch input, write solutions and submit the answers

The script to submit/run the results is pretty spaghettiy and badly written, but should work.

Features:

  • CLI
  • Fetches and caches input data automatically
  • Ability to provide checks for the code before submission
  • Allows you to submit your result easily if all checks passes from within the cli
  • TypeScript

Usage:

CLI/use the existing code

  1. Clone the repo
  2. Run yarn in the repo
  3. Create .env-file with content
    YEAR=2022
    SESSION=<your-session-cookie>
    which can be found in the storage tab when on https://adventofcode.com
  4. Run yarn start -d <day-to-solve>

    You can also see more options for the script with yarn start -h

solutions/-folder

Create files called 0<day>.ts which exports functions called part1 and part2, or a default export which returns an array of both answers ([part1, part2]). The functions will get the input data provided from the first argument as a string

You can import lodash etc. in the scripts to use those functions.

If you want to use this for yourself, remove all content in the solutions-folder and you should be able to use it for your own solutions :)

tests/-folder

This folder contains the same 0<day>.ts files but exports objects part1 and part2 with the structure of { in: <test-input>, out: <test-output> } and will automatically run after to check if you should be able to submit the result to aoc.

You can also export arrays of these objects to run multiple checks on each part.

aoc-2022-ts's People

Contributors

alvesvaren avatar

Watchers

 avatar

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.