Solutions for Advent of Code in Rust, using the repository template by Felix Spöttel.
| Day | Part 1 | Part 2 |
|---|---|---|
| Day 1 | ⭐ | ⭐ |
| Day 2 | ⭐ | ⭐ |
| Day 3 | ⭐ | ⭐ |
| Day 4 | ⭐ | ⭐ |
| Day 5 | ⭐ | ⭐ |
| Day 6 | ⭐ | ⭐ |
| Day 7 | ⭐ | ⭐ |
| Day 8 | ⭐ | ⭐ |
| Day 9 | ⭐ | ⭐ |
| Day 10 | ⭐ | ⭐ |
| Day 11 | ⭐ | ⭐ |
| Day | Part 1 | Part 2 |
|---|---|---|
| Day 1 | 48.5µs |
548.2µs |
| Day 2 | 38.4µs |
37.6µs |
| Day 3 | 431.1µs |
424.0µs |
| Day 4 | 192.8µs |
185.4µs |
| Day 5 | 18.0µs |
48.1µs |
| Day 6 | 289.0ns |
12.4ms |
| Day 7 | 3.0ms |
2.8ms |
| Day 8 | 364.6µs |
2.5ms |
| Day 9 | 131.4µs |
128.6µs |
| Day 10 | 544.3µs |
6.1ms |
| Day 11 | 358.5µs |
328.4µs |
Total: 30.63ms
# example: `cargo scaffold 1`
cargo scaffold <day>Individual solutions live in the ./src/bin/ directory as separate binaries.
Inputs and examples live in the the ./data directory.
# example: `cargo download 1`
cargo download <day># example: `cargo solve 01`
cargo solve <day>The solve command runs your solution against real puzzle inputs. To run an
optimized build of your code, append the --release flag as with any other rust
program.
By default, solve executes your code once and shows the execution time. If you
append the --time flag to the command, the runner will run your code between
10 and 10.000 times (depending on execution time of first execution) and
print the average execution time.
For example, running a benchmarked, optimized execution of day 1 would look like
cargo solve 1 --release --time. Displayed timings show the raw execution
time of your solution without overhead like file reads.
In order to submit part of a solution for checking, append the --submit <part>
option to the solve command.
cargo allThis runs all solutions sequentially and prints output to the command-line. Same
as for the solve command, the --release flag runs an optimized build.
The template can output a table with solution times to your readme. In order to
generate a benchmarking table, run cargo all --release --time. If everything
goes well, the command will output "Successfully updated README with
benchmarks." after the execution finishes and the readme will be updated.
Please note that these are not "scientific" benchmarks, understand them as a fun approximation. 😉 Timings, especially in the microseconds range, might change a bit between invocations.
cargo testTo run tests for a specific day, append --bin <day>, e.g. cargo test --bin 01. You can further scope it down to a specific part, e.g. cargo test --bin 01 part_one.
# example: `cargo read 1`
cargo read <day>