diff --git a/src/main.rs b/src/main.rs index b17644a..fab1029 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,6 +47,9 @@ fn prepare_year(year: &str) -> Result<(), std::io::Error> { fn prepare_day(year: &str, day: &str) -> Result<(), std::io::Error> { let root = env!("CARGO_MANIFEST_DIR"); + if Path::new(&format!("{root}/y{year}/src/bin/d{day}.rs")).exists() { + panic!("Day y{year}d{day} already exists") + } let bin = fs::read_to_string(format!("{root}/template/bin/d.rs.tmpl"))? .replace("{{YEAR}}", year) .replace("{{DAY}}", day); diff --git a/y2015/resources/18_input.txt b/y2015/resources/18_input.txt new file mode 100644 index 0000000..83f3cb2 --- /dev/null +++ b/y2015/resources/18_input.txt @@ -0,0 +1,100 @@ +#..####.##..#...#..#...#...###.#.#.#..#....#.##..#...##...#..#.....##..#####....#.##..##....##.#.... +.#..#..#..#.###...##..#.##.....#...#..##....#####.##............####.#..######..#.#.##.#...#..#...## +#.....##.##.##.#..##.#..###...#.#.#..##..###.####.####.#.####.#...##.#..###.........#.###...#....### +#.###..#######..##..#.....##.#.#.###.#.##..#.##..##.##.#.##...###.#...#.#####.#.##..#.#####..#.##### +#.##.##.###.##..###.#.##.##...##.#.#..##..###.########.#.####..####...#####...#..#...##....##.##.##. +..#.#.#.#..#.#.###....###...#...#.##..####.###.....#.####.###.###.#......#.#.###..#..#.#....#.#####. +...#.###.#....#.###...#.#.#...#...#.#####....#....#...#####..#..#.#..######..#.##.#.##.#..###.#...## +.###...#...#.#..#.#.####.#...#.....##...###.#....#..##.###....#.##....###..#.#####...###.#.##.####.. +#.#....##.#.....#####.#.##..#######.#.####..###.##.#####.##.#...###...#.#...###..#...#.#.###.###.### +...##.##.....##..#.##...#.#...#...#.#####.#...#.#.#.#####.##.#...#.#..##.##..#...#....####..###.###. +#..#....######...#...###.#....#####....#.#.#....#....#.#######.#####..#....#....#.##..#.##.###..#... +#####.#.######.#.#####.#..##..##..####..#....#...#######....##..##.#..###..###.###..###...#...###### +#...##..##...###....##..##.##..#.#.#.#....##.#.......###..###..###...###..##.##.##.#.#.#..#.#..#..#. +..###....##.###..#.#..########...###...##..#######....##..###..#####.##.#....###..##.##.##.#...##.#. +###..#.#..#.#.##.##...##.....#..###.#..##.##.#....##.#.######..##..#.#.##.###...#..####...#.#..#.### +.######....#..##..#.####.##..#.#..#.#..#....#..##.#..#.#...####..#....#.####.#.###.#...####.#...#.#. +#.######.##..###.###..#..###.#...#..#...#...###.##....#.#......#...#.##.#.###..#.#####.#.#..###..#.# +...#..#...####..###.########.....###.###.#..##.##....######..#..#.....#.##.##.#..##..#..##...#..#..# +#..#..##..#.#.########.##.#.####..#.#####.#.###.##....###..##..#.#.###..#.##..##.##.####...######.## +.######.###....#...##...#..#....##..#.#...###.######.##...#....##.##.#.#.##..#...###.###.#....#..##. +####.#.##..##.##.###...#.###.##..##....###..####.##..#.#.##..###.#..##...####...#..####.#.#..##...#. +.#.#..#.....##...#..#...#.#...#.#.##..#....#..#......#####.#######....#.#..#..###..##.#.########..## +.##.#..#..##..#..####.#...####...#...#..##.#..###.#..######..#.#...###.##...#..#####..##.#..##.#.##. +.###..##.##.##....###.###..#.#...##.#.#...#.#######.####..#..###.#######.#...#.#...#.##...#..####..# +##.########..#..#....#.###..##.##.#.##.#..#......####..##.##.#..####..#####..#.....#####.###..#.#.#. +.#..####..##.#.#..#####.##..#..#.#....#.#####.#####...######........##.##..##.#.#.###..#.#.#.#..##.# +.##..##..#.######..###....#.#.###.#........#..###..#.########.....#.##...#.....#..#...##...#..#.###. +##.##.#..####....####.#######.....#.#.#...#.######.#.....####.####...###..####.##.##....###..#..#... +#.#..####...#......#...###...##....##.#######..#.###.#...###.##.##...####..#.####..#......##..#####. +.#.#...##...#....#.####.##.....#....#.#.#######..###.#.....#.....####...##...#.#.##.####..##.###.#.# +####.#.#.####...#...####.#.....#.#######.#.......####......###..###.#...######..#.##.#.##..#..##..## +..##.###..#..####..####.......######.##..#.....##.##...##.##......#.###..###...#.##.#####.#.######.# +.###..####.###..#..#.......#.##...##...##.######.....#..####.#......#.#...#...#...###...#.#.##..#### +.####....##.##.#.....##.###.####.#.......#.......#.#..#.#.#.....###.#.#####.#..#.#.#####.#####.###.# +.##.#.###.#####..#..#....###.#.#.#..#..###..##..####..##.###....#..####.####.#..###.#..######.###### +####.#.....##..###....#.....#.##.#.##..##..########.#####..###.####....##.....######.#.#.##.......#. +#.#.##.....#.....##.###.#..#.##.##....#..##....##.#.###.##.#..#..##.##.###.#..##.###...##..###.##### +#.###.#.#.#.#.#.#.#...#..#.###..####.##...#..####.###....#..#..##.#....####..##.##....#.#.##.##....# +...######....#..####...#.#..#.#.#..#.##.#.#.......#..#......##..#...#..#..##...##.#...#.#.#...##.##. +.#####..#...####....#..###..##....#####..###.#.#...###..###.###..##...#......#...#...#.#.#...#.##..# +......#####.#...#.#.#.##..#.###..##..#.#...###..###....##..#####..#######.#..#.###....###...##.#..#. +..##.########.##..#....##.#...##.##.#.#..#.##..#.#.#.##....#.#.#.#.##....##....#....#####.##..#.##.# +####...#....##.#.###......##.##.#..##...#..#####..#.#....##..#####...#.#.##...#.####.####..##.###### +.##.###.##.#...#.#....###.#######...##...##..#..##.###.#.####..#..###......#.#.##.#.#....#..##...#.. +.#.###.#.###.###.#.##.#..#......####.##...#..##.#..####.....#...#.###.##.##.#..#.##..#.###......#..# +...##.####......#.#.#..###..#....###....#.##.#####..#..#..#...#.#.###...#.#.#.##....###.####..###.#. +##..#.#.#.#....####...#.##.###..####....#..#####.######..#.##.##..#####.#.....#.#...##.#.##.##.#.#.. +#..##.#.#.#.###.#.#.###...#.#...##..#..#.#.#.##..###...#..##.#..#.#.#..#.....#.######.#.###..###.#.. +....#.#.##.###.##...#.##.#....#..##.#..##...#...#.##.####...##..####.#.........#..##..#...#...##.#.. +.##.......##...###.##.#.##.###.##.#..#..#..####...#...#....#####...###..##..#..#..##...#....#..##### +..####..#...#...#..###....##.#.#####..#..#.....#......#...#.......##....####...##....##.##.#.#####.# +##.#.#.#..##..##..#.####.##.##.###.#...###.#....#.....#.###...#######..###.####.###.####.##...##.#.. +..#.#...##.#....#..#..##.####.....#.#.#...#..#..###.#..###.#####.#.#####.#.#.#.#.###.##.###..#....## +.###.#...#....###..#...####....####..#.##..#..##.###..#.#.#.#..#...###.#.#...#......#...#.##.##.#... +..####.####.##.#.##....#...##....#..#....#..###..#...#..###.#####.....#####..##.#.#.#.#.#.##.####... +...##.#.##.####..##.###..#.#.#.#.#.#.#..###...#.##..#.####.##...#.#.##......###..#...###....#.#.###. +##...##..#.#.##..#.#.#....#.####.......#.#.#######.#..#....#.###.#...###.##....###.#.#..#.#.##.####. +...##.......######.....##....#...#..#.##.###.#..#.##.###.#.###.#.#.#...#.#...##.##.##..#.##########. +###..#....#.#.....#....###.#...##.......##.#.#..#.#...########......###..##.#..#..####.##..####...#. +......##.###.#.###.....#..#...#.#......##....#....#........#..#...##.##.....#...##.##.........##.... +.##.##.#.#...#....######..##....##..##.#.#.##.#.##..##...#..###......##......#.#....#.#.#.......###. +.......#.##..##.#...#.##..#..#####.#..#.######.........###.#####.####.#...##...........##...##..#### +#......#.#..#...#...##..#.#.###.##.##.#.#..#.###.##.#..###..#.###..#...###.##..###..#...#..###...#.. +####.##..#####..####.#...#..#..###..##.#.#...#...#...#.##.####.##.###....###...#.#.#..####.######.## +.....#..####...#.#.#.####..####..##.###......#.....########.#...#.#..#..#...#.###..##.#####..###.### +.#######.#.##..###.#...###.#####............##.###...#.##.#.##..##.#.#..#.######..######..#..#..#### +...##..#.####...#..#.#.##.#....#.####..#..###.###..#.#...#....##.##.#......##..##..#.#.#.###..#..#.. +........#...#.##.#.#..#....####....#.##...###..####...###.#.#..######..###..##.#####.###.###.#.#...# +##......##.#..###.####.##.#.###.#.......#.##..####..#.###.##..##..##...##...#.###...#.#..#..#.#####. +##..#.#.....##.####.#..##.#.##.#.#...#...#.#...####.#.#.##...##....##.###..###.####.#...#.###..##### +.#####.####.####.####.#.##.##......###....###.####...###...#...#..#.##.#.#####.###..##.#..###...##.. +.#...#..##...##...#....#.#.#..##..#.##..#.###.#.###..###.#.#.###.#....#######.####.##..#..#...####.. +..##.##..#.##..#.#.###..#.##.########...####.#.###.##..#..###.###...##..##.#..#.######.##.#....###.# +##.#####.###.##.#.##.##.##.###..##..##..#.#.#.#.####..#......#.#.#.#.#.#.##...#####.####...#.#...#.# +.#..###..##.#####.#.##.#..##...##..##...#####.#.####..#...##.....######.#.#...##.#..#######.###.###. +#.#..##.#.#####.#.#.....###.###.#..##.#####....#.###.##.##.#.#..##..#.#....#######.###.#.#.....#.### +....###...#.###.####....###.....##....#####.##.###.###.##.##.##.#..###..######...####.#.#..####..#.. +###.....#..####..#.####..#..#...##.##..##.######.####.....#...##....#..#.##.#####..###.##.#.####...# +.##.##.#...#..####...##.##.###...#...#..#.#.#####.....####...#.#.#..#.####...####.#...###.#......### +###.##....#.#.#...#.###....####..##...##.##.##.#..#...####..#..#..##...#####.####.####...##.#..###.# +..####.....##..###.#.#.###.########..#...#.##..#.#.#.......#.##.#..#...####.##.#..#.######..#.#...#. +#.#.##.#.#.##.#....##......##......#######.#..#.##...##..#.#.###...#.#..#..###...#..###.....##.....# +..#.##.#.##.#.##..##.....#.#..#.#..#...##..#..#.#....###.#####....####.####..#####.##.###...#..###.# +#....#.###..#..########.###..#.#.#.##...##.#..##.###..#..#..#.#.##..###...###.#.##..#.##.#..#.#.#### +#.......#######......#...#...##.##...###.#....##.#..#....####.#.##.###...#.#####...##.###........##. +.##.####.....###.##......####.###.########..#.####..#.##.#.####.....#...#.##....#######.##..#......# +#.#.##.##....##..##.#.###..#.##.#..#..#.#..##.....###..###.##.##.####.##.#.#.##...####..#.#..##.#.#. +...##.#.#.#...###.#.......#.#.....#.#...##....##.##.##.####...#.#..#..#..#.#.##.#..#.#.#....###..#.# +....#.#.###.#####.##..###..##..#...#.##.#......##.####.#..####.#.##..####.#.#...##..#####..##.#.#... +..###.#.##..#....#..#.#.....##.#####..##....#.#...#.##..##.#.#..#...##.##..##..##....#...#..#..#..## +##.#.##.#...#.###.##.##.##.##..##.##...#..##.#..#######.#..#...#.#.##..#....##.#..####.###........#. +.##.#..#.....#####..##.#.#.#.#..###.#######.###.###....##....#.#.#.###....###.#..#.#....#.#..###...# +...###.#.#.###..#...#..###.######..##.#.#..#...####.#####.##..#..###...#..#..#..###..##.#.#...#.###. +#......#.#..#..##.##.#.##.#.###.#.##.#.#..#....#.##..#..##..##.#.#.#....##.###.###.####.#.#####...## +...#.##..#.######.......#.#.###.....#####....##.#.#.###........#.#.###.#.#########.##.##.#..##..#... +##..###..###....####.##.##..##.###....####..##...####.####..####..###.####..##.#...###.#####.##.##.# +###...##.#.#.#####..#..#####...##.#...#.#.###.#..##..###.##.#.#.....####.##.#..##.###.#...##.##...## +...#.#.##.##..##....#..#.#####.##.###..#.#.#........####.###.##....##....####..#.#....#.#.#.###..#.# +..#.#.#.#.###...#....##..######.##....#.#.##..###..#.#.###..#.##..#.#.###......#..#..#.####..#...##. +.....####.#.....###.#.##.#..##.#..###.#####.#..##...###.#..###..#..##....###.#..##.#..#.##.#..#...## diff --git a/y2015/src/bin/d15.rs b/y2015/src/bin/d15.rs index e8df673..8d30aeb 100644 --- a/y2015/src/bin/d15.rs +++ b/y2015/src/bin/d15.rs @@ -16,5 +16,6 @@ fn part1() { fn part2() { let root = env!("CARGO_MANIFEST_DIR"); let content = fs::read_to_string(format!("{root}/resources/15_input.txt")).unwrap(); - println!("{}", d15::process_part2(&content)); + // change comments in part1 + //println!("{}", d15::process_part2(&content)); } diff --git a/y2015/src/bin/d18.rs b/y2015/src/bin/d18.rs new file mode 100644 index 0000000..fb3f4d5 --- /dev/null +++ b/y2015/src/bin/d18.rs @@ -0,0 +1,20 @@ +use std::fs; + +use y2015::days::d18; + +fn main() { + part1(); + part2(); +} + +fn part1() { + let root = env!("CARGO_MANIFEST_DIR"); + let content = fs::read_to_string(format!("{root}/resources/18_input.txt")).unwrap(); + println!("{}", d18::process_part1(&content)); +} + +fn part2() { + let root = env!("CARGO_MANIFEST_DIR"); + let content = fs::read_to_string(format!("{root}/resources/18_input.txt")).unwrap(); + println!("{}", d18::process_part2(&content)); +} diff --git a/y2015/src/days/d15.rs b/y2015/src/days/d15.rs index 565568b..5916d1d 100644 --- a/y2015/src/days/d15.rs +++ b/y2015/src/days/d15.rs @@ -185,10 +185,4 @@ Cinnamon: capacity 2, durability 3, flavor -2, texture -1, calories 3"; let result = process_part1(INPUT); assert_eq!(result, 62842880); } - - #[test] - fn part2() { - let result = process_part2(INPUT); - assert_eq!(result, 0); - } } diff --git a/y2015/src/days/d18.rs b/y2015/src/days/d18.rs new file mode 100644 index 0000000..9025dcc --- /dev/null +++ b/y2015/src/days/d18.rs @@ -0,0 +1,26 @@ +pub fn process_part1(input: &str) -> i32 { + 0 +} + +pub fn process_part2(input: &str) -> i32 { + 0 +} + +#[cfg(test)] +mod tests { + use super::*; + + const INPUT: &str = "{{EXAMPLE}}"; + + #[test] + fn part1() { + let result = process_part1(INPUT); + assert_eq!(result, 0); + } + + #[test] + fn part2() { + let result = process_part2(INPUT); + assert_eq!(result, 0); + } +} diff --git a/y2015/src/days/mod.rs b/y2015/src/days/mod.rs index 7e6bd80..0e75767 100644 --- a/y2015/src/days/mod.rs +++ b/y2015/src/days/mod.rs @@ -17,3 +17,9 @@ pub mod d9; pub mod d16; pub mod d17; + +pub mod d18; + +pub mod d18; + +pub mod d18;