Skip to content

Commit

Permalink
partial solution y2023 ex13
Browse files Browse the repository at this point in the history
  • Loading branch information
lmammino committed Dec 14, 2023
1 parent 056282e commit 6e5a989
Show file tree
Hide file tree
Showing 9 changed files with 11,389 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ members = [
"y2023/ex10",
"y2023/ex11",
"y2023/ex12",
"y2023/ex13",
]

[profile.bench]
Expand Down
15 changes: 15 additions & 0 deletions y2023/ex13/Cargo.toml
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"
15 changes: 15 additions & 0 deletions y2023/ex13/README.md
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: )
11 changes: 11 additions & 0 deletions y2023/ex13/benches/bench_y2023ex13.rs
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);
30 changes: 30 additions & 0 deletions y2023/ex13/debug.py
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())))
9,634 changes: 9,634 additions & 0 deletions y2023/ex13/debug.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 6e5a989

Please sign in to comment.