Crates.io | aoc-bud |
lib.rs | aoc-bud |
version | 0.0.4 |
source | src |
created_at | 2022-12-08 17:03:24.474713 |
updated_at | 2023-12-04 12:38:20.4644 |
description | A advent of code rust helper |
homepage | |
repository | https://github.com/no0bie/aoc-bud |
max_upload_size | |
id | 732700 |
size | 15,970 |
Module that aims to help during advent of code puzzles.
cargo add aoc-bud
or add the following line to your Cargo.toml
[dependencies]
aoc-bud = "0.0.4"
You must have a .env file on your project directory with your advent of code session cookie
echo AOC_SESSION={yoursessionhere} > .env
The library exports Regex aswell.
use aoc_bud::Aoc;
// If you want to use Regex you can just import it
use aoc_bud::Regex;
fn main() {
// Create a Aoc instance for the date you choose
let aoc = Aoc::new(1, 2023);
// Get puzzle input
let input: String = aoc.input();
// ...
// Solution code part 1
// ...
// Send your solution for the first part
aoc.solve1(solution).unwrap();
// ...
// Solution code part 2
// ...
// Send your solution for the first part
aoc.solve2(solution).unwrap();
}
By enabling the time feature, instead of setting the date yourself the program will get the current date. NOTE This only works when advent of code is ongoing, otherwise you will only get errors.
use aoc_bud::Aoc;
fn main() {
// Create a Aoc instance for the date today
let aoc = Aoc::today();
// Get puzzle input
let input: String = aoc.input();
// ...
// Solution code part 1
// ...
// Send your solution for the first part
aoc.solve1(solution).unwrap();
// ...
// Solution code part 2
// ...
// Send your solution for the first part
aoc.solve2(solution).unwrap();
}