Advent of Code for 2023 - https://adventofcode.com/2023
Per day, remember to:
export day=day25
cargo new $day
cp day01/Makefile $day/
cp -r template/* $day/
find $day -type f -exec sed -i "s/template/$day/g" {} +
make format
find . -iname "template.day" -delete
git add $day
git commit -m "$day: Added template"
By convention for this repo, so I can ignore it, all programs will be called <foldername>.day
eg day01.day
.
To format code, call:
make format
To make a new lib:
cargo new --lib foo
Then you can refer to that lib in the Cargo.toml:
[dependencies.my_lib]
path = "../my_lib"
And in the code use
extern crate my_lib;
Note: Libs use a slightly different Makefile (no copy)
filelib
- A library for common file operations needed in advent of code. Most notablyload_as_ints
, which is used to load input that is just numbers per line.mathlib
- Math operations and functions I might need later.gridlib
- Represents a grid, a common pattern.
It has been asked to not include inputs, or puzzle texts in this repo. This is the command to clean up this information.
git filter-branch -f —tree-filter 'rm -rf day*/input' HEAD
git filter-branch -f —tree-filter 'rm -rf day*/README.md' HEAD