| Crates.io | aoc-rs-1npo |
| lib.rs | aoc-rs-1npo |
| version | 0.5.1 |
| created_at | 2024-12-02 00:10:39.02561+00 |
| updated_at | 2024-12-03 02:59:11.632635+00 |
| description | My attempt at using Rust to solve Advent of Code puzzles |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1467988 |
| size | 61,765 |
This is my attempt at using Rust to build an Advent of Code puzzle solver. It's also my attempt to learn Rust!
cargo install aoc-rs-1npo
aoc-rs <COMMAND> <YEAR> <DAY> <PART>
The first three arguments are required, PART defaults to 1 if absent.
There are 2 commands: solve and submit.
Use the solve command to print the solution to the screen.
For example:
aoc-rs solve 2024 1 1
[2024-12-03T01:29:14Z INFO aoc_rs_1npo::web] Got puzzle input from cached file
[2024-12-03T01:29:14Z INFO aoc_rs_1npo::puzzles] Got puzzle input for year 2024 day 1
[2024-12-03T01:29:14Z INFO aoc_rs_1npo::puzzles] Solution for part 1 = "1651298"
Use the submit command to submit the solution as an answer to adventofcode.com.
For example:
aoc-rs submit 2024 1 2
[2024-12-03T01:35:46Z INFO aoc_rs_1npo::web] Got puzzle input from cached file
[2024-12-03T01:35:46Z INFO aoc_rs_1npo::puzzles] Got puzzle input for year 2024 day 1
[2024-12-03T01:35:46Z INFO aoc_rs_1npo::puzzles] Solution for part 2 = "21306195"
[2024-12-03T01:35:46Z INFO aoc_rs_1npo::puzzles] Puzzle solved! Great job!
Replace DAY, PART, YYYY, and N with the appropriate values
src/puzzles/yearYYYY/dayN.rspub mod dayN; to src/puzzles/yearYYYY/mod.rssolutions.insert((2024, DAY, PART), Box::new(yearYYYY::dayN::partN)); to get_puzzle_solution() in src/puzzles/mod.rsyearYYYY::dayN::parse()yearYYYY::dayN::part1() and yearYYYY::dayN::part2() respectivelysrc/puzzles/yearYYYYsrc/puzzles/yearYYYY/mod.rsdayN.rs files for the yearThanks to Nir for his dayN.rs template and his file caching code :)