From f667e05c91a4ec56f6001ade8729e7c6276f7071 Mon Sep 17 00:00:00 2001 From: Ishan Jain Date: Wed, 13 Dec 2023 18:22:04 +0530 Subject: [PATCH] day13: added --- src/day13/1.rs | 87 ++- src/day13/2.rs | 132 ++++- src/day13/input.txt | 1349 ++++++++++++++++++++++++++++++++++++++++++ src/day13/sample.txt | 15 + 4 files changed, 1581 insertions(+), 2 deletions(-) create mode 100644 src/day13/input.txt create mode 100644 src/day13/sample.txt diff --git a/src/day13/1.rs b/src/day13/1.rs index b51073e..1fa4f25 100644 --- a/src/day13/1.rs +++ b/src/day13/1.rs @@ -1 +1,86 @@ -const INPUTS: [&'static str; 2] = [include_str!("./sample.txt"), include_str!("./input.txt")]; +#![feature(iter_intersperse)] +#![feature(test)] + +extern crate test; + +const INPUTS: [&str; 2] = [include_str!("./sample.txt"), include_str!("./input.txt")]; + +fn process(data: &str) -> usize { + let mut answer = 0; + + for line in data.split("\n\n") { + let mut horiz_set = vec![]; + + for line in line.lines() { + let line_mask = line.chars().rev().enumerate().fold(0, |mut a, (i, x)| { + if let '#' = x { + a |= 1 << (i) + } + a + }); + + horiz_set.push(line_mask); + } + + let mut vert_set = vec![]; + + for (i, line) in line.lines().rev().enumerate() { + for (j, c) in line.chars().enumerate() { + if vert_set.len() <= j { + vert_set.push(0); + } + + if c == '#' { + vert_set[j] |= 1 << i; + } + } + } + + let horiz_max = (0..horiz_set.len()) + .rev() + .map(|j| { + let (a, b) = horiz_set.split_at(j); + + if a.iter().rev().zip(b.iter()).any(|(a, b)| a != b) { + return 0; + } + + j + }) + .max() + .unwrap_or_default(); + + let vertical_max = (0..vert_set.len()) + .rev() + .map(|i| { + let (a, b) = vert_set.split_at(i); + + if a.iter().rev().zip(b.iter()).any(|(a, b)| a != b) { + return 0; + } + + i + }) + .max() + .unwrap_or_default(); + + answer += 100 * horiz_max; + answer += vertical_max; + } + + answer +} + +fn main() { + for input in INPUTS.iter() { + println!("total = {}", process(input)); + } +} + +#[bench] +fn part1(b: &mut test::Bencher) { + b.iter(|| { + let v = process(INPUTS[INPUTS.len() - 1]); + test::black_box(v); + }); +} diff --git a/src/day13/2.rs b/src/day13/2.rs index b51073e..4778307 100644 --- a/src/day13/2.rs +++ b/src/day13/2.rs @@ -1 +1,131 @@ -const INPUTS: [&'static str; 2] = [include_str!("./sample.txt"), include_str!("./input.txt")]; +#![feature(iter_intersperse)] +#![feature(test)] + +extern crate test; + +const INPUTS: [&str; 2] = [include_str!("./sample.txt"), include_str!("./input.txt")]; + +fn process(data: &str) -> usize { + let mut answer = 0; + + for line in data.split("\n\n") { + let mut horiz_set = vec![]; + + for line in line.lines() { + let line_mask = line.chars().rev().enumerate().fold(0, |mut a, (i, x)| { + if let '#' = x { + a |= 1 << (i) + } + a + }); + + horiz_set.push(line_mask); + } + + let mut vert_set = vec![]; + + for (i, line) in line.lines().rev().enumerate() { + for (j, c) in line.chars().enumerate() { + if vert_set.len() <= j { + vert_set.push(0); + } + + if c == '#' { + vert_set[j] |= 1 << i; + } + } + } + + let horiz_max = (0..horiz_set.len()) + .rev() + .map(|j| { + let (a, b) = horiz_set.split_at(j); + let mut error_count = 0; + for (a, b) in a.iter().rev().zip(b.iter()) { + for x in 0..31 { + let a = a & (1 << x); + let b = b & (1 << x); + + if a != b { + error_count += 1; + } + } + + if error_count > 1 { + return 0; + } + } + + if error_count == 1 { + j + } else { + 0 + } + }) + .max() + .unwrap_or_default(); + + let vertical_max = (0..vert_set.len()) + .rev() + .map(|i| { + let (a, b) = vert_set.split_at(i); + let mut error_count = 0; + for (a, b) in a.iter().rev().zip(b.iter()) { + for x in 0..31 { + let a = a & (1 << x); + let b = b & (1 << x); + + if a != b { + error_count += 1; + } + } + + if error_count > 1 { + return 0; + } + } + + if error_count == 1 { + i + } else { + 0 + } + }) + .max() + .unwrap_or_default(); + + answer += 100 * horiz_max; + answer += vertical_max; + } + + answer +} + +fn fmt(x: i32, length: usize) -> String { + let mut out = String::new(); + + for c in (0..length).rev() { + let c = x & (1 << c); + if c >= 1 { + out.push('#'); + } else { + out.push('.'); + } + } + + out +} + +fn main() { + for input in INPUTS.iter() { + println!("total = {}", process(input)); + } +} + +#[bench] +fn part1(b: &mut test::Bencher) { + b.iter(|| { + let v = process(INPUTS[INPUTS.len() - 1]); + test::black_box(v); + }); +} diff --git a/src/day13/input.txt b/src/day13/input.txt new file mode 100644 index 0000000..0babec7 --- /dev/null +++ b/src/day13/input.txt @@ -0,0 +1,1349 @@ +##.#..###.##### +###.#.##.#..##. +###.####.#..##. +##.#..###.##### +####......##### +#.#..##.#...... +##.#.....#.#### +......#........ +.##..#..####..# +#...####.##.... +.#.###..#...... +##.#.#.#.#.#..# +..##.##..##.##. + +#...###.#..#... +#....#...###..# +#.##.###..###.. +#########.#.##. +.#..#.##.###... +.#..#.##.###... +#########.#.##. + +#....#..#....##.. +#..###..###..##.. +.###..##..###..## +###..#..#..###### +##....##....####. +.#.#..##..#.#..#. +..###.##.###....# +#..#..##.##..##.. +####.#..#.####### +.####.##.####..## +####......####### + +.##.##.## +...#..#.. +.#.#..#.# +#..#..#.. +#.#....#. +##.#..#.# +..##..##. +..######. +.#.#..#.# +##.#..#.# +###.#..## +#.#.##.#. +.#.####.# +..#.##.#. +..#.##.#. +.#.####.# +#.#.##.#. + +..###.##. +..##.##.. +...#..... +##.#.###. +..##.#.## +..##..... +..#...### +###...#.# +###...#.# +..#...### +..##..#.. + +.....## +.#..#.. +..##... +..##... +.#..#.. +##..### +..##... + +.########.. +###.##.#### +#.#....#.## +###....#### +.#..##..#.. +##.#..#.### +..######... +#..#..#..#. +.#.####.#.. + +..##....##..### +.#.##..##.#...# +.#.##..##.#...# +..##....##..#.# +##..#..#..####. +.#.##..##.#..#. +#####..#####.#. +..###..###..##. +...#.##.#....#. +#..#.##.#..#... +#..##..##..#### + +.#..#...##.#.#.## +#..##..##.....##. +.#.#.#.####.##.## +..##.###.....#### +..##.###.....#### +.#.#.#.####.##.## +#..##..##.....##. +.#..#...##.#.#.## +##..#####...##### +#.##...##..#...## +#..####.#.#.###.. +#..####.#.#.###.. +#.##...##..#...## +##..#####...##### +.#..#..###.#.#.## + +.#.#.#.##..##.# +.###.#.##..##.# +..###..#....#.. +#.......####... +.#......####... +.....##.####.## +.#..#.###..###. +#####..######.. +##..###..##..## + +.#..####..#...... +#.#######..##..## +.##.####.##...... +#..##..##..#....# +.#..####..#.####. +..##.##.##....... +#..##..##..#....# + +..#...###..## +..##....##... +#.#.#....#### +##.###.#.##.# +##.###.#.##.# +#.#.#....#### +.###....##... +..#...###..## +..#...###..## +.###....##... +#.#.#....#### + +#....#. +....#.# +...#... +...#... +....#.# +#....#. +##.#.#. +#.#.### +#.####. +#.#.#.. +#.#.#.. +#.####. +#.#.##. +##.#.#. +#....#. +....#.# +...#... + +#.##..##.##.##. +.########..#### +.#..##..#..#..# +.#..##..#..#..# +...#..#......#. +###.##.######.# +#.##..##.##.##. +#.##..##.##.##. +.###..###..###. +.########..#### +.##....##..##.. +####..########. +##.#.##.####.## + +###..## +##.##.# +###.##. +.#.##.# +..##.#. +##.#..# +...#.#. +##.#... +###.... +##..#.. +#####.# +..#.#.# +..#.#.# + +.##..#.## +.#..#.### +####.#.#. +#..###... +####.#... +....#.#.. +.##.##.## +......##. +#####...# +.....#..# +.##.....# +.##...#.. +#..###... +....#.##. +....#.##. +#..###... +.##...#.. + +####..#...# +###..#.##.. +##.####..#. +...##.##... +##.#..##.#. +....##..##. +##..#...... +..###.###.. +..#.#####.. +..#.##.##.. +..###.###.. +##..#...... +....##..##. +##.#..##.#. +...##.##... +##.####..#. +###..#.##.. + +#.#.###..###.#.## +######....####### +.####.#..#.####.. +#..###....###..## +#.#..........#.## +#.##.#.##.#.##.## +..##...##...##... +..####....####... +..#.##.##.##.#... +.#.##..##..##.#.. +.#..#.####.#..#.# + +...###....##.## +###.......##..# +##.#....##..#.. +.#.####.#.##.## +#.##..##.....## +##.###....#.#.# +#..###....#.#.# +#.##..##.....## +.#.####.#.##.## +##.#....##..#.. +###.......##..# +...###....##.## +.#.##..#....##. +#......##...##. +###..###...#### +###..###...#### +#......##...##. + +..#..#... +#.####.## +.##..##.. +#......## +#.#..#.## +##.##..## +..####... + +.#..#..###.####.# +.#..#.##..#.##... +.####...#.#....#. +#....#...#..##..# +..##..##......... +##..#####........ +#######..###..### + +.##.#.#.. +.##.###.. +.......## +##.##.#.. +.###.##.. +#####..## +#.#..#... +##.###### +.#.##.### + +#.##.##.##.##.##. +..#.#..#.#....#.# +#..#....#..##..#. +#..##..##..##..## +####....########. +.####..####..#### +..#.#..###....### + +.#.##.#...... +########..##. +.#.##.#.##..# +.######.##..# +##....##..... +.#.##.#..#..# +.######.##..# +#.#..#.#.#### +#......#..... +...##...#.... +.#....#...... +..#..#...#### +###..####.##. +.######.#.... +..#.##..#.... +.#.##.#.#.##. +#.#..#.###..# + +#.#..#####.##.# +#.#.###.####### +...####...####. +...##.##..####. +#...#.#.#.#..#. +##..#...#.#..#. +##..#...#.#..#. +#...#.#.#.#..#. +...##.##..####. +...####...####. +#.#.###.####### +###..#####.##.# +####.##.##....# + +#..#..# +.##.##. +..#.##. +###.... +..##### +..##### +###.... +..#.##. +.##.##. +#.##..# +.#..... +....##. +.#..... +####..# +.##.... +.#..... +#.#.##. + +###.####. +###.####. +#........ +.###...#. +.######.. +..#.#...# +..#.#...# +.######.. +..##...#. + +...#... +...##.. +.#.#.## +....### +....##. +.....#. +.....#. +....##. +....### +.#.#.## +...##.. +...#... +#.#.#.. +#..##.# +.##.##. + +....##.####.. +.#..##.####.. +..###.###..## +..##...###.## +#.##.#.#.#.## +.##...####... +..#.#...#...# +..#.#...#...# +.##...####... + +#..##.. +#..##.. +##...## +..#...# +..#.##. +..#.##. +..#...# +##.#.## +#..##.. + +.....#.##.#.... +.#.#...##...#.# +###.#.#..#.#.## +#.###......###. +.###...##...### +####.######.### +##..#..##..#..# +.#..#..##..#..# +#.#..######..#. +#.##..####..##. +###.#......#.## +##...######...# +.#...######...# +###.#......#.## +#.##..####..##. + +###........ +.####.##.## +.##...##... +.##...##... +.####.##.## +###........ +.#......#.. +..#..####.. +..#.##..##. +#.##......# +.#####..### +..###.##.## +###.##..##. +..#...##... +#.###....## + +##.....##.....# +####........### +..############. +..##...##...##. +..##.#....#.### +..#.#..##..#.#. +..##...##...##. +###.##....##.## +....##....##... +..#.###..###.#. +##.##..##..##.# +..#.##.##.##.#. +###..######..## +##.#.##..##.#.# +##.##########.# +####.#....#.### +#######..###### + +#.#.#...#.. +#.#.#...#.. +..###.#..#. +#.#.####... +##.###..### +.#.#.#.##.# +.##..#...#. +###.....#.# +##..#..##.. +.#####...## +....#...#.# +....#...#.# +.#####..### + +....#.#..#..#.. +....####..##..# +....#...######. +####....#....#. +##..#..######## +......#.#.##.#. +..##.###.#..#.# +..#.....#....#. +##..#.##....#.# + +#......#... +##.##.###.# +..........# +###..#####. +########.#. +.#.##.##..# +..#..#....# +.##..##...# +#.####.#.## +#.####.#.## +.##..##...# + +###.###.#.... +..#####.##... +###..#.#.#..# +..#....#....# +..##...#....# +###..#.#.#..# +..#####.##... +###.###.#.... +...##...#.... +...#..#...##. +....##.....## +...#..#..#..# +###..###.#.#. +###.####..##. +##.#.#.#.###. + +.##..#..##..#.# +..##....#.#..#. +..##....#.#..#. +.....#...#..#.. +.##..##.###.### +.##..##.###.### +.....#...#..#.. +..##....#.#..#. +..##....#.#..## +.##..#..##..#.# +#.#.#.######### +...#.#.#.#...## +...#.#.#.#...## + +#.#...#..#. +..#.#..##.. +##..#.####. +.####.####. +.##..#.##.# +###..#.##.# +.####.####. +##..#.####. +..#.#..##.. +#.#...#..#. +###.##....# +##.#.#.##.# +.#.###....# +.#.##.####. +..#####..## +.#..##.##.# +.....##..## + +##......#.#....#. +##.#...#.#..#.##. +...##.##.#.#.##.# +..#.####..###.... +##.#....#.###.#.# +##.#..####..#.#.. +####...##.##.#### +##....#..#.....## +##....#..#.....## +####...#..##.#### +##.#..####..#.#.. +##.#....#.###.#.# +..#.####..###.... +...##.##.#.#.##.# +##.#...#.#..#.##. + +#..##.#......#.## +#####.#.####.#.## +#..###..###...### +.##..#.#.##.#.#.. +#######.####.#### +####.##......##.# +.........##...... +....###..##..###. +.##.#.##.##.##.#. +......##....##... +#..##.########.## +.....#........#.. +#######......#### +....#.#......#.#. +#..##....##....## + +###.##.## +###...##. +###...##. +###.##.## +...###### +.##.###.. +##...##.# +..##..... +##.####.# + +######..... +..###..#..# +#.#........ +####....... +#.##.#..#.# +..#####.#.. +###...#...# +..#.##..##. +..#...#...# +..#.#.##... +##.#.#.##.. +#.#.#.##### +#...#.##### +..#..#.##.# +..#..#.##.# +#...#.##### +#.#.#.##### + +##.#.###.##...#.# +..#.#.###.....#.# +..#.#.###.....#.# +##.#.###.##.....# +##..##.#..#..#... +..#.##..##.#.#.## +##......##.#...## +##.###.....#...## +####.####..#..... +...###.#.##...#.. +..#.#.#.#..#.##.# +...##..#....#.### +....#.#..#.#####. + +#..#..#...### +.##..#.#.##.. +.#.##.#####.# +#.##.##.##.## +#....#..##... +#....#..##... +#.##.##.##.## + +#.##.##...#.# +#..#......### +#..#......### +#.##.##...#.# +#.#..#....#.. +.##.#.####.## +.#.#.....###. +..#...#.##..# +####...##...# +.#..##.##..#. +.####.##...#. +.####.##...#. +.#..##.##..#. +####...##...# +..#...#.##..# +##.#.....###. +.##.#.####.## + +..####. +#..#### +..#.... +..#.... +#..#### +..####. +.##...# +..####. +..####. +.##...# +..##### +#..#### +..#.... + +##....##.##.... +#.#.#.##....#.# +#.#.#.##....#.# +#.....##.##.... +.#.####..##.#.# +####.###..#.#.. +####.#...#.#### +##.....##...### +.#..#.##....### +.#..#.##....### +##.....##...### + +#######.##.## +##...#......# +..#.##.####.# +...#....##... +#####..###... +....##.#..#.# +...####....## +######......# +##.#.#..##..# +..##...#..#.. +..#...##..##. + +#####..## +##.#....# +...###### +....#..#. +###.#..#. +#....##.. +..#.####. +..#.#..#. +##.##..## +..###..## +.....##.. + +##....##..#.### +..#.##......##. +...##...##.#..# +.######..###.#. +.#....#..#.#... +.#....#..#.#... +.######..###.#. + +##.#... +####... +..#.### +##.##.# +####... +..##.#. +###..#. +....#.# +####.#. +##.#.#. +##..### + +.###..#######.### +....##.##.###.... +#...#.##.###..... +#.#.###.....##### +...###..##.#.##.. +......#...#..##.. +......#...#..##.. +...###..##.#.##.. +#.#.###....###### +#...#.##.###..... +....##.##.###.... + +#.##.#.##...# +..##.....###. +..##.....###. +#.##.#.##...# +...###...#..# +##.##.#.##### +.##.###...##. +###.####.###. +###.####.#.#. +.##.###...##. +##.##.#.##### + +....#......#..### +..#.##....##.##.# +#..#..#.##....#.. +.##..#.#..##.#... +#..#..#.#...#.... +....#...#####.#.. +####.#.##.#.####. +####.#.##.#.####. +....#...#####.#.. + +.#.##.###..##.. +#####..######## +##.##..#..##### +##.##..#..##### +######.######## +.#.##.###..##.. +...#.##.#.###.. +.##...#......## +#..##....#.##.. + +######...#.#. +######...#.#. +##..##..##.#. +.###.#.##...# +.##.....##.#. +#..###..###.# +..#.###.#..#. +..#.###..#### +..#.###.##### + +.#...#.##.#.... +.##..#.##.#.... +##...#..####.#. +.#..#...######. +.......####..## +...#......##### +#...##.######.. +###.###..#.#..# +####.##.###.#.# +.##.###.#..#..# +#.#.#...##....# +##.....##.####. +##.....##.####. +#.#.#...##....# +.##.###.#..#..# +####.##.###.#.# +###.###..#.#..# + +..##.## +##..### +##.#.#. +...###. +..#.##. +..#.### +###.... +##.#### +....### +..##..# +..##..# +....### +##..### +###.... +..#.### + +..##### +##.##.. +..##... +..##... +##.##.. +..##### +#.#..#. +#.#..#. +..##### +##.##.. +..##.#. + +....#.. +#..##.# +.##.#.. +.##..#. +####... +#..###. +#..##.. +##.#... +.##..#. +.##.### +#####.. +#####.# +####... +.##..## +.##..## +####... +#####.# + +.####..#. +#...#.##. +##.#####. +##.#####. +#...#.##. +.####..#. +####.#... +...####.. +.#...##.. +.##...#.# +#......## +###..#### +#..##.... +##.#....# +##......# + +....##....##. +#..#.#.##.#.# +#####.####.## +....#..##..#. +#..#........# +#..##.......# +....##.##.##. +....########. +#..#..#..#..# +#..#.#.##.#.# +#..####..#### +....##....##. +....#.#..#.#. +#..########## +.##.########. +####..#..#..# +.##..######.. + +....##..#.#.### +.#.##.####.#.## +.##.##..##.##.# +####.####.#..#. +####.#.#.#.#.#. +.#.....####.##. +.#.....####.##. +####...#.#.#.#. +####.####.#..#. +.##.##..##.##.# +.#.##.####.#.## +....##..#.#.### +....##..#.#.### + +#........## +.#.#..#.#.. +###.....##. +#..####..## +#...##...#. +..##..##... +..##..##... + +###..##...#..##.# +###..##.#.#..##.# +###..##.#.#..##.# +###..##...#..##.# +##.##.##..##.#..# +#.##.##..#####.#. +..#..#.##...#...# +#...##..##.#....# +#......###.#.#### + +.#...#..##..### +.#...#..##..### +#...##..#...##. +.#..#...#...... +..###.##..#.#.. +#########..##.. +##....#...##.## +.#....#.######. +.##..#..#.#.... +.##.....#.#.... +.#....#.######. +##....#...##.## +#########..##.. + +.###.###... +####.###... +.##...###.# +.######.#.# +.#..#..##.. +###.##.###. +.#....##.#. +##.#.#....# +#.#..#..##. +.#.#..##..# +.#.#.#.##.# +###.#..##.# +###.#..##.# +.#.#.#.##.# +.#.#..##..# +#.#..#..##. +##.#.#....# + +.#.##.... +.##.##... +.###.#... +.##...### +......### +..#...### +.##...### +.###.#... +.##.##... +.#.##.... +.######## +##.#..### +##...#### + +#.###.. +#....#. +.....#. +.#.#.## +.#.#.## +.....#. +#....#. + +...##.#.#..#.## +....#..#..####. +#.#.##...##.... +##.##.......##. +.##.#..#..##..# +.##.#..#..##..# +##.##.......##. +#.#.##...##.... +.......#..####. +...##.#.#..#.## +...##.#.#..#.## + +######..... +##..##.#..# +##..##.##.. +#######.#.# +......##..# +######..### +..##..#.##. +.#..#.#...# +......####. +##..##.#### +#....#..### +#....#...## +##..##.#### + +##.#..#.. +#.....##. +#.#.#.##. +.####.##. +...#..... +..##.#### +..##.#### +...#..... +.####.##. +#.#.#.##. +#.....##. + +#.##### +####... +#.##### +#.#.### +..###.. +.###.## +#.#..## +.##.... +.###.## +.##.### +#..#... +#...##. +##..### +...#.## +...#.## + +...#..##.#.##.# +#..#.#..#...... +.#.##.##.##..## +##..##.#.##..## +#.#.#..#..####. +.#.#..####..#.# +#.#...#.#.#..#. +.#.....###....# +.##.##.###....# +.##.#.....#..#. +.#.#.#####....# +####.#...#.##.# +..##.......##.. +...#.######..## +...#.######..## + +.##.###.####. +.....###..... +....#..##.##. +....#..##.##. +.....###..... +.##.###.####. +#.##..##.#..# + +#..##......##.. +######......... +#######........ +#..##......##.. +#..##.###.....# +####....###...# +.##.##.####.... +....#####...##. +....#...###.... +#..##.#...##... +######...#.##.# + +##.##......#. +..#.##.....#. +###.#..###### +..##.###.#.#. +...######..## +...######..## +...#.###.#.#. +###.#..###### +..#.##.....#. +##.##......#. +..#.......#.. +##....#...... +##.#.#.#..... +####.###..### +..###..#.###. + +#####.. +..###.. +.#.##.. +#...### +####... +.##.#.. +####.## +#...### +.....## +.##.### +#...### +###.#.. +.#..### +.#..### +##..#.. + +....########..... +#..##..##..##..## +#...###..###...## +#..#........#..## +##.##.####.##.### +..##.#....#.##... +#.#.###..###.#.## +#..###....###..## +#.###.#..#.###### +#####......###### +.......##........ +#..#.#....#.#..## +##..#.#..#.#..### +###.##.##.##.#### +.#..#.####.#..#.. + +....##. +.#.#..# +...#..# +##.#..# +....##. +...#..# +..#.... +#..#### +#..#### +.##.... +...#..# +....##. +##.#..# + +.....#..#.... +####..####..# +.##.######### +#..#.#..#...# +.....###.#### +.##...#...##. +#####.#.#.##. +.##.##.##.##. +####..#...... +####.#.##.... +......#..#..# +....#.#.##### +........#.##. + +.##.###.....###.. +.##.###.....###.. +#..##.#.#.#.##.#. +####.##.#.#..#.#. +.##....#..#####.. +#..#..#.######.#. +....#.##..###..#. +####..#.#.......# +####.#.##..#.##.. +.###.####...#.... +.##....####...... +.....###..#.##.## +.##.#.#..#.#####. +#..#..#.##...#.## +#..#.#...##.###.# +.##.#..##..#.##.. +#..###...##.###.# + +##......##..#.. +.#...#..##.##.. +#.##...#####... +#.##...#####... +.#...#..##.##.. +##......##..#.. +.#.###.#..#.#.# +#.#...#...#.##. +#.#...#...#.##. +.#.###.#..#.#.# +##......##..... + +..#.####.#..#.. +###.#.##...#### +##.#...#...#.## +#...#.####..... +#...#.###...... +##.#...#...#.## +###.#.##...#### +####..###...### +##.####..##..#. +##.####..##..#. +####..###...### +###.#.##...#### +##.#...#...#.## +#...#.###...... +#...#.####..... +##.#...#...#.## +###.#.##...#### + +.##.#.##..#.### +.##.#..#.#####. +#..##....#..##. +####..#...##... +.##...#.###.##. +#..#.####.#..#. +#..##..##.#.##. +#..##..##.#.##. +#..#.####.#..#. +.##...#.#.#.##. +####..#...##... + +..#...#..##.. +####..#.####. +..##.#....... +#######.#..#. +#...#..##..## +#.##.####..## +##.#..#..##.. +##.#..#..##.. +#.##.####..## +#...#..##..## +###.###.#..#. + +.#.#.##.# +.#.#.##.. +##..#.... +#.#..#..# +.###....# +.##..##.. +####.#..# +#....##.. +##..###.. +#....#.## +####.##.. +....#.### +#.#..#### +#..#..... +#..#..... + +...#....#.#.# +...#....#.#.# +..#.#.#..##.. +###.#.....##. +###...#.#..#. +###..##.###.. +##.###.##...# +##.####..##.. +...#.###.###. +..#.#.####... +.#.####.#.... +..#..###.#... +...#####..... + +######...## +###.##.###. +##.##..#.#. +##.##..#.#. +###.##.###. +####.#...## +.....###... + +..##.#...## +..#..##..#. +#..#####... +..#..#.#.#. +#...#.###.. +.#....#.##. +##..#.##### +...#.#...#. +...#.#..... +##..#.##### +.#....#.##. +#...#.###.. +..#..#.#.#. +#..#####... +..#..##..#. +..##.#...## +..##.#...## + +....### +..##.## +##...## +##.#.#. +....#.. +..####. +..##.#. +....#.. +##.#.#. +##...## +..##.## +....### +....##. +.#....# +.##.##. +.##.##. +.#....# + +....########... +##..#..##..#..# +#####......#### +..##.#.##.#.##. +..#.#..##..#.#. +###.########.## +##..#.######..# +##..#......#..# +..##........##. +##.####..####.# +###.###..###.## +####.#.##.#.### +###..........## +####..#..#..### +##.###.##.###.# + +..##..##. +####..### +###....## +...####.. +########. +....##... +...#..#.. +....##... +###.##.## +##.####.# +..#.##.#. +...####.. +....##... +..######. +..#....#. + +....##.## +....##.## +.####.... +#..#.##.. +##.##...# +#####.#.. +..####..# +..#....## +........# +........# +..#....#. + +....##.......## +###.##...#.#.#. +###.#..#..####. +####..#.......# +###.##..#..#.#. +###..#.##.#.### +..#.#..##.###.. +##.#####..##### +###.###...#.#.# +..###.##...##.# +..#....###..##. +#####.#....#..# +##.#...######.. +##.#...######.. +#####.#..#.#..# + +.#..#.##.## +#.#......#. +...#.###.## +...#.###.## +#.#......#. +.#..#.##.## +#####.##.## +....#####.. +###...#..## +#.#..##..#. +.#.######.# +##.##.####. +#.#####..## +##.####.### +##..#.#.##. +##....#.##. +##.####.### + +..####..#.. +###..####.. +##....##.## +.##..##.### +#.#..#.#### +###.####### +#......##.. +#.####.#### +##.##.##... +##....##... +#.####.#### + +##..#.######..##. +.###..##...#.#..# +#.#..#..##.#..#.# +####.#..###..##.. +......##.######## +......##.###.#### +####.#..###..##.. +#.#..#..##.#..#.# +.###..##...#.#..# +##..#.######..##. +##..#.######..##. + +#....####.##.#### +.##.###...##...## +#..#....######... +#####..#.####.#.. +.##.#..#.#..#.#.. +#..###.##....##.# +#..##...#.##.#... +#..#...###..###.. +.##.#..#.#..#.#.. +.##.##....##....# +#..##.###....###. diff --git a/src/day13/sample.txt b/src/day13/sample.txt new file mode 100644 index 0000000..f226414 --- /dev/null +++ b/src/day13/sample.txt @@ -0,0 +1,15 @@ +#.##..##. +..#.##.#. +##......# +##......# +..#.##.#. +..##..##. +#.#.##.#. + +#...##..# +#....#..# +..##..### +#####.##. +#####.##. +..##..### +#....#..# \ No newline at end of file