Skip to content

Commit

Permalink
Year 2016: Day 20
Browse files Browse the repository at this point in the history
  • Loading branch information
joshleaves committed Mar 21, 2024
1 parent 05ab0f5 commit 9d1d441
Show file tree
Hide file tree
Showing 8 changed files with 1,276 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ 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)

## [2016.20.1]
### Added
- Solved [exercice for 2016, day 20](src/year_2016/20.rs).

## [2016.19.1]
### Added
- Solved [exercice for 2016, day 19](src/year_2016/19.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 = "2016.19.1"
version = "2016.20.1"
edition = "2021"
authors = ["Arnaud 'red' Rouyer"]
readme = "README.md"
Expand Down
4 changes: 4 additions & 0 deletions NOTES_2016.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,7 @@ Easy come, easy go.
## Day 19: An Elephant Named Joseph

As easy in Rust as it was in Ruby.

## Day 20: Firewall Rules

One of Rust's biggest pleasure is code that compiles on the first try.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,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, up to day 19](NOTES_2016.md)
- [2016, up to day 20](NOTES_2016.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
16 changes: 15 additions & 1 deletion benches/year_2016.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use advent_rs::year_2016::day_16;
use advent_rs::year_2016::day_17;
use advent_rs::year_2016::day_18;
use advent_rs::year_2016::day_19;
use advent_rs::year_2016::day_20;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

pub fn year_2016_day_01(c: &mut Criterion) {
Expand Down Expand Up @@ -247,6 +248,18 @@ pub fn year_2016_day_19(c: &mut Criterion) {
g2016_day_19.finish();
}

pub fn year_2016_day_20(c: &mut Criterion) {
let mut g2016_day_20 = c.benchmark_group("year_2016::day_20");
let input_year_2016_day_20 = include_str!("../inputs/year_2016/day_20_input");
g2016_day_20.bench_function("year_2016::day_20_v1", |b| {
b.iter(|| day_20::day_20_v1(black_box(input_year_2016_day_20)))
});
g2016_day_20.bench_function("year_2016::day_20_v2", |b| {
b.iter(|| day_20::day_20_v2(black_box(input_year_2016_day_20)))
});
g2016_day_20.finish();
}

criterion_group!(
benches,
year_2016_day_01,
Expand All @@ -267,6 +280,7 @@ criterion_group!(
year_2016_day_16,
year_2016_day_17,
year_2016_day_18,
year_2016_day_19
year_2016_day_19,
year_2016_day_20
);
criterion_main!(benches);
Loading

0 comments on commit 9d1d441

Please sign in to comment.