This is the third year in a row I (plan to) use rust to solve Advent of Code. But I must warn you: I haven't programmed a lot over the past year, so I am likely not in the best shape (School has been rough - I need a break) - expect the worst.
Just like last year, I am lazy and currently setting this project up in a hurry (In class, actually) just so I have the basic framework once the event starts. So this project is literally a cleaned-up copy of my solutions for the previous year, which in term are a cleaned up version of my Advent of Code 2021 solutions.
The Following therefore still contains screenshots of the 2021 binary. The usage is the same, but the name is aoc23
instead of aoc21
Later on, maybe even before AoC starts, I'll clean this up more, maybe create a crate out of the framework so I don't have to copy each year over and over again.
There are multiple ways to run my solutions, the easiest and most comfortable one is the auto
command:
It automatically downloads your input. For this it requires you to provide your Advent of Code session id, which you can find in the websites cookies after logging in.
Simply provide the session token by setting the AOC_SESSION
environment variable or using the -s argument:
AOC_SESSION=XXXMYSESSION ./aoc23 [DAY] auto
or ./aoc23 [DAY] auto -s XXXMYSESSION
.
In this example, the environment variable for the AoC session is set using export AOC_SESSION=XXXMYSESSION
, so I can run the command without specifying the session token again:
If you don't want to automatically download the input, you can also use the run
command, which uses a locally stored file or the stdin input:
./aoc23 [DAY] run -f my_input.txt
:
If you just want to run the day's example, simply use the test
command, as this project already includes the examples:
./aoc23 [DAY] test
:
This project uses Cargo
, so compiling is pretty easy:
cargo build --release
The resulting binary can be found at ./targets/release/aoc22
. You can also directly run the project using cargo run --release [arguments for aoc23]
the --release
option is not required, but it results in better performance.
Repository | Language |
---|---|
Trojaner's AdventofCode2023 | TypeScript (Bun) (+ Rust) |
Niklas' Advent-of-Code-2023 | Kotlin |
noeppi_noeppi's aoc | Multiple |
Seralius' AOC2023 | JavaScript |
Daan Breur's AdventofCode | Rust |
Hax's advent-of-code | TypeScript |