-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
11,389 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ members = [ | |
"y2023/ex10", | ||
"y2023/ex11", | ||
"y2023/ex12", | ||
"y2023/ex13", | ||
] | ||
|
||
[profile.bench] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "y2023ex13" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
|
||
[[bench]] | ||
name = "bench_y2023ex13" | ||
harness = false | ||
|
||
[dev-dependencies] | ||
criterion = "0.5.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Day 13: TODO: ADD TITLE HERE | ||
|
||
[Check it out on adventofcode.com](https://adventofcode.com/2023/day/13) | ||
|
||
## Part One | ||
|
||
TODO: ADD DESCRIPTION HERE | ||
|
||
Your puzzle answer was `?`. (TODO: ) | ||
|
||
## Part Two | ||
|
||
TODO: ADD DESCRIPTION HERE | ||
|
||
Your puzzle answer was `?`. (TODO: ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use criterion::{black_box, criterion_group, criterion_main, Criterion}; | ||
use y2023ex13::{part1, part2}; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
let input = include_str!("../input.txt"); | ||
c.bench_function("y2023ex13::part1", |b| b.iter(|| part1(black_box(input)))); | ||
c.bench_function("y2023ex13::part2", |b| b.iter(|| part2(black_box(input)))); | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
grid = """#.###.#.. | ||
#.###.#.. | ||
..##.#.## | ||
#.####.#. | ||
#####...# | ||
#.##.##.. | ||
..##.#... | ||
##...###. | ||
.#....#.# | ||
#..#...## | ||
#..#.#.##""" | ||
|
||
def find_mirror(grid): | ||
for r in range(1, len(grid)): | ||
above = grid[:r][::-1] | ||
below = grid[r:] | ||
|
||
above = above[:len(below)] | ||
below = above[:len(above)] | ||
|
||
print(above) | ||
print("---") | ||
print(below) | ||
|
||
if above == below: | ||
return r | ||
|
||
return 0 | ||
|
||
print(find_mirror(list(grid.splitlines()))) |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.