Skip to content

Commit

Permalink
Year 2018: Day 01
Browse files Browse the repository at this point in the history
  • Loading branch information
joshleaves committed Apr 15, 2024
1 parent 6fe501b commit 20a4938
Show file tree
Hide file tree
Showing 10 changed files with 1,142 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ 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)

## [2018.1.1]
### Added
- Solved [exercice for 2018, day 01](src/year_2018/01.rs).


## [2017.25.1]
### Added
- Solved [exercice for 2017, day 23](src/year_2017/23.rs).
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "advent-rs"
version = "2017.25.1"
version = "2018.1.1"
edition = "2021"
authors = ["Arnaud 'red' Rouyer"]
readme = "README.md"
Expand Down Expand Up @@ -68,3 +68,7 @@ harness = false
# [[bench]]
# name = "year_2017_day_13"
# harness = false

[[bench]]
name = "year_2018"
harness = false
2 changes: 1 addition & 1 deletion NOTES_2016.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Notes for solving 2016
## Day 1: No Time for a Taxicab
## Day 01: No Time for a Taxicab

Nice to get back into it!

Expand Down
4 changes: 4 additions & 0 deletions NOTES_2018.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Notes for solving 2018
## Day 01: Chronal Calibration

Again, first day is nothing to write home about: just iterate and sum, nothing too complicated.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ 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, complete!](NOTES_2017.md)
- [2018, up to day 01!](NOTES_2018.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
20 changes: 20 additions & 0 deletions benches/year_2018.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use advent_rs::year_2018::day_01;
use criterion::{black_box, criterion_group, criterion_main, Criterion};

fn year_2018_day_01(c: &mut Criterion) {
let input = include_str!("../inputs/year_2018/day_01_input");
assert_eq!(day_01::day_01_v1(input), 484);
assert_eq!(day_01::day_01_v2(input), 367);

let mut g2018_day_01 = c.benchmark_group("year_2018::day_01");
g2018_day_01.bench_function("year_2018::day_01_v1", |b| {
b.iter(|| day_01::day_01_v1(black_box(input)))
});
g2018_day_01.bench_function("year_2018::day_01_v2", |b| {
b.iter(|| day_01::day_01_v2(black_box(input)))
});
g2018_day_01.finish();
}

criterion_group!(benches, year_2018_day_01);
criterion_main!(benches);
Loading

0 comments on commit 20a4938

Please sign in to comment.