Advent of code: https://adventofcode.com/
Each day from first to 25th of December has a new problem to solve, with an additional part 2 problem as a bonus. Every problem has example data, but the problem should be solved with a personal set of data. The output will typically be a number or a sequence of numbers/characters.
YEAR | 🌟 |
---|---|
2015 | 4 |
2016 | 4 |
2017 | 4 |
2018 | 4 |
2019 | 4 |
2020 | 4 |
2021 | 20 |
2022 | 16 |
2023 | 36 |
2024 | 22 |
- Sign in on advent of code.
- Find where the browser stores your session cookie. a. In Chrome: press F12 -> Application -> Cookies -> session -> find a value of 128 hexadecimals
- Create a file named
cookie
in the project root dir and put your session cookie from the site
$ echo your_session_cookie_token > cookie
The two scripts in this project creates a new solver for the new task and runs the task solver with the proper input.
This script will create a folder and a solver with template code for the given year and date.
$ yarn init-solver 2022 1
> https://adventofcode.com/2022/day/9
> ✨ Done in 1.19s.
The script will use your session cookie and fetch your personal input data for the given year and day.
Run in a terminal yarn solve [year] [day]
or add a +
sign in the end for part two.
$ yarn solve 2022 1
> The answer is 7746
$ yarn solve 2022 1+
> The answer is 2604
Was inspired by @atme's advent-of-code repo for fetching the input data.