Solutions to each day, in the following format:
1 # day
├── eg.txt # example input
├── input.txt # actual puzzle input
├── solution.js # contains the puzzle solution
└── todo.txt # puzzle preamble and premise
-
Run
$ npm i
to installdotenv
. -
Run
$ npm start
, you will be prompted for your AoC session token (cookie) to fetch your puzzle inputs. You can also manually write it to the.env
file with the keyAUTH_TOKEN=2343223432...
-
Run
$ npm run fetch <days>
to fetch the desired days, you can fetch many days at once with brace expansion, eg:$ npm run fetch {1..5}
will translate to$ npm run fetch 1 2 3 4 5
-
Run puzzles with
$ node <day>/solution.js
if the coresponding folder existis
$ npm run fetch <days>
or input which days you want to fetch$ npm run delete <days>
or input which days you want to delete, confirm with y
- Transfer scripts to bash scripts (run with
sh
) - Fetch and delete need to check if there is an
$1
input before prompting user - put days in separate folder? nah
- Maybe only allow dev to fetch and use the token, the already solved solutions should keep the input? No, in theory each input is user based
- Make the fs.readFile api work from different working directories -> require.resolve('path/')
- Get help in refactoring bash scripts
- After first install (
$ npm start
) creates the.env
file and prompt with the tokenprompt | cat > .env
- Create
util/
folder, movetemplate.js
andfetchInput.js
to it - Script that creates the next puzzle folder, fetches
input.txt
, and createssolution.js
template - Making requests to the aoc servers should be throttled, once every 15 minutes (900s)
- Make
newDay
script also fetchtodo.md
, coverting to md will be a challenge, maybe html first - Catch auth error from fetchInput when the cookie is outdated
- Add flag to fetch command that loops through existing day folders
- Create util that given a
async path => fs.readFile(require.resolve(path))
something like that with try catch - Fix bash semicolon usage, either ; or no
My solutions are released under the MIT License. Puzzles and inputs belong to Advent of Code