Awesome
Advent of Code solutions in Rust by TBali
- AoC website
- My AoC username:
tbali0524
- Puzzle list with topics and my completion status (in Rust)
- Link to this repo on GitHub
This repo contains the partial rewrite of my complete (450 ⭐) AoC solutions in PHP to Rust
, plus a simple CLI runner.
Usage
# -- setup
# install Rust: https://www.rust-lang.org/tools/install
rustup update stable
cargo version
# -- lint
cargo fmt
cargo clippy
# -- doc
cargo doc --no-deps --open
# -- test
cargo test
cargo test 2023
cargo test 2023day02
cargo test cli
# in Powershell:
$env:RUST_BACKTRACE=1 ; cargo test
cargo run
cargo run -- 2023
cargo run -- 2023 2
# -- run
cargo build --release
target/release/aoc.exe
target/release/aoc.exe 2023
target/release/aoc.exe 2023 2
# -- shortcut run
./aoc.bat
./aoc.bat 2023
./aoc.bat 2023 2
./aoc.bat --help
# -- shortcut qa
./qa.bat
# -- cleanup
cargo clean
Adding a new solution
- add puzzle input in
input/year/AocXXXXDayXX.txt
and example inputs in...exX.txt
- add and edit source in
src/year/aocXXXXdayXX.rs
, using the template insrc/2024/aoc2024day00.rs
- update
pub fn metadata()
, writesolve()
, add unit tests as needed
- update
- edit
src/aocXXXX.rs
:- uncomment the
pub mod aocXXXXdayXX;
line - update the
PUZZLES
list: replaceNone
withSome(...)
- uncomment the
- for a completely new season:
- edit
src/lib.rs
: add apub mod aocXXXX;
line - edit
src/aoc.rs
: increaseMAX_SEASONS
and add aSome(...)
item toPUZZLES
- add and update
src/aocXXXX.rs
using the template insrc/aoc2024.rs
- edit