Each day has a folder containing 4 files:
input.txt
: the input datasolution.txt
: the true solutions of part1 (line 1) and part2 (line 2)part1.*
: the script computing the solution to part1part2.*
: the script computing the solution to part2
The scripts return just the solution, no other printout. They are written in a different language for each year. Here is how to run them:
bash part1.sh
gcc -o x part1.c && ./x
g++ -std=c++20 -o x part1.cpp && ./x
vim input.txt -s part1.vim 2>/dev/null
vim --cmd ':source part1.vim | quit'
or from within vim:
:so %
awk -f part1.awk input.txt
part1.cpp
: First, each problem is solved in C++ to confirm that my strategy works:
g++ -std=c++20 -o x part1.cpp && ./x
part1.vim
: Then, as a bonus, I tried so solve some of them entirely in vim. This time I added comments (after TABs) to make them understandable (I'll go back to 2021 at some point to do that there too). To remove the comments and run the vim commands use the following script:
. ../../run_vim_macro.sh part1.vim input.txt
This will make a file part1.vimc
of the macro without the comments and run it.