Skip to content

Commit

Permalink
Year 2017: Day 20
Browse files Browse the repository at this point in the history
  • Loading branch information
joshleaves committed Apr 1, 2024
1 parent fdea728 commit 9a30b28
Show file tree
Hide file tree
Showing 7 changed files with 1,166 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ Of note:
- The changelog 2015.5.2 has been rewritten from each commit content.
- This file may be amended entirely in the future to adhere to the [GNU Changelog style](https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html#Style-of-Change-Logs)

## [2017.20.1]
### Added
- Solved [exercice for 2017, day 20](src/year_2017/20.rs).

## [2017.19.1]
### Added
- Solved [exercice for 2017, day 19](src/year_2017/19.rs).


## [2017.18.1]
### Added
- Solved [exercice for 2017, day 18](src/year_2017/18.rs).
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "advent-rs"
version = "2017.19.1"
version = "2017.20.1"
edition = "2021"
authors = ["Arnaud 'red' Rouyer"]
readme = "README.md"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ As I said, [Consistency is hard](https://github.com/joshleaves/advent-rb), and I
I'm also adding notes that may be useful if you're (like me) discovering Rust:
- [2015, complete!](NOTES_2015.md)
- [2016, complete!](NOTES_2016.md)
- [2017, up to day 19](NOTES_2017.md)
- [2017, up to day 20](NOTES_2017.md)

# Regarding style rules
I'm gonna use a mix of what `cargo fmt` does, with some stuff that feels more natural to me.
Expand Down
19 changes: 18 additions & 1 deletion benches/year_2017.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use advent_rs::year_2017::day_16;
use advent_rs::year_2017::day_17;
use advent_rs::year_2017::day_18;
use advent_rs::year_2017::day_19;
use advent_rs::year_2017::day_20;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn year_2017_day_01(c: &mut Criterion) {
Expand Down Expand Up @@ -304,6 +305,21 @@ fn year_2017_day_19(c: &mut Criterion) {
g2017_day_19.finish();
}

fn year_2017_day_20(c: &mut Criterion) {
let input = include_str!("../inputs/year_2017/day_20_input");
assert_eq!(day_20::day_20_v1(input), 157);
assert_eq!(day_20::day_20_v2(input), 499);

let mut g2017_day_20 = c.benchmark_group("year_2017::day_20");
g2017_day_20.bench_function("year_2017::day_20_v1", |b| {
b.iter(|| day_20::day_20_v1(black_box(input)))
});
g2017_day_20.bench_function("year_2017::day_20_v2", |b| {
b.iter(|| day_20::day_20_v2(black_box(input)))
});
g2017_day_20.finish();
}

criterion_group!(
benches,
year_2017_day_01,
Expand All @@ -324,6 +340,7 @@ criterion_group!(
year_2017_day_16,
year_2017_day_17,
year_2017_day_18,
year_2017_day_19
year_2017_day_19,
year_2017_day_20
);
criterion_main!(benches);
Loading

0 comments on commit 9a30b28

Please sign in to comment.