diff --git a/rust/2015/src/day_01.rs b/rust/2015/src/day_01.rs index 9b7becc..2d23354 100644 --- a/rust/2015/src/day_01.rs +++ b/rust/2015/src/day_01.rs @@ -22,12 +22,6 @@ pub fn input_generator(input: &str) -> Input { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_01::*; -/// let data = include_str!("../input/2015/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 232); -/// ``` #[aoc(day1, part1)] pub fn solve_part_01(directions: &Input) -> isize { directions @@ -41,12 +35,6 @@ pub fn solve_part_01(directions: &Input) -> isize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_01::*; -/// let data = include_str!("../input/2015/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 1783); -/// ``` #[aoc(day1, part2)] pub fn solve_part_02(directions: &Input) -> usize { let mut floor = 0; diff --git a/rust/2015/src/day_02.rs b/rust/2015/src/day_02.rs index 7d24588..9c4b002 100644 --- a/rust/2015/src/day_02.rs +++ b/rust/2015/src/day_02.rs @@ -31,12 +31,6 @@ A present with dimensions 1x1x10 requires 2*1 + 2*10 + 2*10 = 42 square feet of All numbers in the elves' list are in feet. How many total square feet of wrapping paper should they order? */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_02::*; -/// let data = include_str!("../input/2015/day2.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 1586300); -/// ``` #[aoc(day2, part1)] pub fn solve_part_01(input: &[(u32, u32, u32)]) -> u32 { input.iter().fold(0, |sum, (length, width, height)| { @@ -62,12 +56,6 @@ A present with dimensions 1x1x10 requires 1+1+1+1 = 4 feet of ribbon to wrap the How many total feet of ribbon should they order? */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_02::*; -/// let data = include_str!("../input/2015/day2.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 3737498); -/// ``` #[aoc(day2, part2)] pub fn solve_part_02(input: &[(u32, u32, u32)]) -> u32 { input.iter().fold(0, |sum, (length, width, height)| { diff --git a/rust/2015/src/day_03.rs b/rust/2015/src/day_03.rs index f24c4ea..3423e29 100644 --- a/rust/2015/src/day_03.rs +++ b/rust/2015/src/day_03.rs @@ -60,12 +60,6 @@ pub fn input_generator(input: &str) -> Input { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_03::*; -/// let data = include_str!("../input/2015/day3.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 2572); -/// ``` #[aoc(day3, part1)] pub fn solve_part_01(input: &Input) -> usize { let mut houses: HashSet<(isize, isize)> = HashSet::with_capacity(input.len()); @@ -83,12 +77,6 @@ pub fn solve_part_01(input: &Input) -> usize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2015::day_03::*; -/// let data = include_str!("../input/2015/day3.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 2631); -/// ``` #[aoc(day3, part2)] pub fn solve_part_02(input: &Input) -> usize { let mut houses: HashSet<(isize, isize)> = HashSet::with_capacity(input.len()); diff --git a/rust/2016/src/day_01.rs b/rust/2016/src/day_01.rs index c58999a..af695f1 100644 --- a/rust/2016/src/day_01.rs +++ b/rust/2016/src/day_01.rs @@ -80,11 +80,6 @@ pub fn input_generator(input: &str) -> Vec { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2016::day_01::*; -/// let input = include_str!("../input/2016/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 252); #[aoc(day1, part1)] pub fn solve_part_01(instructions: &[Instruction]) -> u32 { let mut cab = Cab::new(); diff --git a/rust/2016/src/day_03.rs b/rust/2016/src/day_03.rs index ac39065..3fa67ec 100644 --- a/rust/2016/src/day_03.rs +++ b/rust/2016/src/day_03.rs @@ -14,12 +14,6 @@ pub fn input_generator(input: &str) -> Input { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2016::day_03::*; -/// let data = include_str!("../input/2016/day3.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 862); -/// ``` #[aoc(day3, part1)] pub fn solve_part_01(input: &Input) -> usize { input diff --git a/rust/2019/src/day_01.rs b/rust/2019/src/day_01.rs index ffd6ffe..6084427 100644 --- a/rust/2019/src/day_01.rs +++ b/rust/2019/src/day_01.rs @@ -20,12 +20,6 @@ fn calculate_fuel_with_extra(mass: &i32, total_fuel: i32) -> i32 { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2019::day_01::*; -/// let data = include_str!("../input/2019/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 3553700); -/// ``` #[aoc(day1, part1)] pub fn solve_part_01(fuel: &Fuel) -> i32 { fuel.iter().map(calculate_fuel).sum() @@ -33,12 +27,6 @@ pub fn solve_part_01(fuel: &Fuel) -> i32 { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2019::day_01::*; -/// let data = include_str!("../input/2019/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 5327664); -/// ``` #[aoc(day1, part2)] pub fn solve_part_02(fuel: &Fuel) -> i32 { fuel.iter().map(|f| calculate_fuel_with_extra(f, 0)).sum() diff --git a/rust/2020/src/day_01.rs b/rust/2020/src/day_01.rs index 310adf4..c2d6a17 100644 --- a/rust/2020/src/day_01.rs +++ b/rust/2020/src/day_01.rs @@ -37,12 +37,6 @@ pub fn input_generator(input: &str) -> HashSet { * * Of course, your expense report is much larger. Find the two entries that sum to 2020; what do you get if you multiply them together? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_01::*; -/// let data = include_str!("../input/2020/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 898299); -/// ``` #[aoc(day1, part1)] pub fn solve_part_01(input: &HashSet) -> u32 { for x in input { @@ -66,12 +60,6 @@ pub fn solve_part_01(input: &HashSet) -> u32 { * * In your expense report, what is the product of the three entries that sum to 2020? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_01::*; -/// let data = include_str!("../input/2020/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 143933922); -/// ``` #[aoc(day1, part2)] pub fn solve_part_02(input: &HashSet) -> u32 { for x in input { diff --git a/rust/2020/src/day_02.rs b/rust/2020/src/day_02.rs index eee4201..fb5ca78 100644 --- a/rust/2020/src/day_02.rs +++ b/rust/2020/src/day_02.rs @@ -9,11 +9,11 @@ use std::ops::RangeInclusive; // Fastest, also a very clean solution, seems to be using a RegEx lazy_static! { - /// Input is in the form "1-3 a: abcdef" + // Input is in the form "1-3 a: abcdef" static ref RE: Regex = Regex::new(r"(\d+)-(\d+) (\w): (\w*)").unwrap(); } -/// Official Toboggan Corporate Policy +// Official Toboggan Corporate Policy pub struct OTCP { password: String, policy: char, @@ -78,12 +78,6 @@ pub fn input_generator(input: &str) -> Vec { * * How many passwords are valid according to their policies? */ -///Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_02::*; -/// let input = include_str!("../input/2020/day2.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 524); -/// ``` #[aoc(day2, part1)] pub fn solve_part_01(input: &[OTCP]) -> usize { input @@ -117,12 +111,6 @@ pub fn solve_part_01(input: &[OTCP]) -> usize { * * How many passwords are valid according to the new interpretation of the policies? */ -///your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_02::*; -/// let input = include_str!("../input/2020/day2.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 485); -/// ``` #[aoc(day2, part2)] pub fn solve_part_02(input: &[OTCP]) -> usize { input @@ -141,7 +129,7 @@ pub fn solve_part_02(input: &[OTCP]) -> usize { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -153,7 +141,7 @@ mod tests { assert_eq!(solve_part_01(&input_generator(data)), 2) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_02() { let data = " diff --git a/rust/2020/src/day_03.rs b/rust/2020/src/day_03.rs index c83d629..34a373f 100644 --- a/rust/2020/src/day_03.rs +++ b/rust/2020/src/day_03.rs @@ -91,12 +91,6 @@ fn slope_finder(input: &[String], rs: &usize, cs: &usize) -> u32 { * * Starting at the top-left corner of your map and following a slope of right 3 and down 1, how many trees would you encounter? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_03::*; -/// let input = include_str!("../input/2020/day3.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 259); -/// ``` #[aoc(day3, part1)] pub fn solve_part_01(input: &[String]) -> u32 { slope_finder(input, &1, &3) @@ -120,12 +114,6 @@ pub fn solve_part_01(input: &[String]) -> u32 { * * What do you get if you multiply together the number of trees encountered on each of the listed slopes? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_03::*; -/// let input = include_str!("../input/2020/day3.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 2224913600); -/// ``` #[aoc(day3, part2)] pub fn solve_part_02(input: &[String]) -> u32 { [(1, 1), (1, 3), (1, 5), (1, 7), (2, 1)] @@ -137,7 +125,7 @@ pub fn solve_part_02(input: &[String]) -> u32 { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -157,7 +145,7 @@ mod tests { assert_eq!(solve_part_01(&input_generator(data)), 7) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_02() { let data = " diff --git a/rust/2020/src/day_04.rs b/rust/2020/src/day_04.rs index c365fee..60242ac 100644 --- a/rust/2020/src/day_04.rs +++ b/rust/2020/src/day_04.rs @@ -81,12 +81,6 @@ pub fn input_generator_part_02(input: &str) -> Vec { * Count the number of valid passports - those that have all required fields. * Treat cid as optional. In your batch file, how many passports are valid? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_04::*; -/// let input = include_str!("../input/2020/day4.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_01(input)), 200); -/// ``` #[aoc(day4, part1)] pub fn solve_part_01(input: &[Passport]) -> usize { input @@ -165,12 +159,6 @@ pub fn solve_part_01(input: &[Passport]) -> usize { * Count the number of valid passports - those that have all required fields and valid values. * Continue to treat cid as optional. In your batch file, how many passports are valid? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_04::*; -/// let input = include_str!("../input/2020/day4.txt"); -/// assert_eq!(solve_part_02(&input_generator_part_02(input)), 116); -/// ``` #[aoc(day4, part2)] pub fn solve_part_02(input: &[Passport]) -> usize { input.iter().filter(|passport| passport.is_valid()).count() @@ -180,7 +168,7 @@ pub fn solve_part_02(input: &[Passport]) -> usize { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -202,7 +190,7 @@ iyr:2011 ecl:brn hgt:59in assert_eq!(solve_part_01(&input_generator_part_01(data)), 2) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_data_invalid_02() { let data = " diff --git a/rust/2020/src/day_05.rs b/rust/2020/src/day_05.rs index b65c4e7..27d53ff 100644 --- a/rust/2020/src/day_05.rs +++ b/rust/2020/src/day_05.rs @@ -97,12 +97,6 @@ fn find_airplane_seats(input: &[String]) -> Vec { * BBFFBBFRLL: row 102, column 4, seat ID 820. * As a sanity check, look through your list of boarding passes. What is the highest seat ID on a boarding pass? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_05::*; -/// let input = include_str!("../input/2020/day5.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 866); -/// ``` #[aoc(day5, part1)] pub fn solve_part_01(input: &[String]) -> u32 { find_airplane_seats(input).into_iter().max().unwrap() @@ -120,12 +114,6 @@ pub fn solve_part_01(input: &[String]) -> u32 { * * What is the ID of your seat? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_05::*; -/// let input = include_str!("../input/2020/day5.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 583); -/// ``` #[aoc(day5, part2)] pub fn solve_part_02(input: &[String]) -> u32 { let mut my_seat = 0; @@ -145,7 +133,7 @@ pub fn solve_part_02(input: &[String]) -> u32 { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = "FBFBBFFRLR"; diff --git a/rust/2020/src/day_06.rs b/rust/2020/src/day_06.rs index 7c45842..6d2e703 100644 --- a/rust/2020/src/day_06.rs +++ b/rust/2020/src/day_06.rs @@ -83,12 +83,6 @@ pub fn input_generator_part_02(input: &str) -> Vec> { * * For each group, count the number of questions to which anyone answered "yes". What is the sum of those counts? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_06::*; -/// let input = include_str!("../input/2020/day6.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_01(input)), 6778); -/// ``` #[aoc(day6, part1)] pub fn solve_part_01(input: &[String]) -> usize { input @@ -131,12 +125,6 @@ pub fn solve_part_01(input: &[String]) -> usize { * * For each group, count the number of questions to which everyone answered "yes". What is the sum of those counts? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_06::*; -/// let input = include_str!("../input/2020/day6.txt"); -/// assert_eq!(solve_part_02(&input_generator_part_02(input)), 3406); -/// ``` #[aoc(day6, part2)] pub fn solve_part_02(input: &[Vec]) -> usize { input.iter().fold(0, |acc, group| { @@ -168,7 +156,7 @@ pub fn solve_part_02(input: &[Vec]) -> usize { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -191,7 +179,7 @@ b assert_eq!(solve_part_01(&input_generator_part_01(data)), 11) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_02() { let data = " diff --git a/rust/2020/src/day_07.rs b/rust/2020/src/day_07.rs index c034e0b..ddb4c16 100644 --- a/rust/2020/src/day_07.rs +++ b/rust/2020/src/day_07.rs @@ -123,12 +123,6 @@ fn search(input: &BagsCanContain, holds_gold_bags: &mut HashSet, color: * * How many bag colors can eventually contain at least one shiny gold bag? (The list of rules is quite long; make sure you get all of it.) */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_07::*; -/// let input = include_str!("../input/2020/day7.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_01(input).unwrap()), 226); -/// ``` #[aoc(day7, part1)] pub fn solve_part_01(input: &BagsCanContain) -> usize { let mut holds_gold_bags: HashSet = HashSet::new(); @@ -180,12 +174,6 @@ fn calculate_cost(input: &BagsRequired, color: &str) -> u32 { * * How many individual bags are required inside your single shiny gold bag? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_07::*; -/// let input = include_str!("../input/2020/day7.txt"); -/// assert_eq!(solve_part_02(&input_generator_part_02(input).unwrap()), 9569); -/// ``` #[aoc(day7, part2)] pub fn solve_part_02(input: &BagsRequired) -> u32 { calculate_cost(input, "shiny gold") @@ -195,7 +183,7 @@ pub fn solve_part_02(input: &BagsRequired) -> u32 { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -213,7 +201,7 @@ dotted black bags contain no other bags. assert_eq!(solve_part_01(&input_generator_part_01(data).unwrap()), 4) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_02() { let data = " diff --git a/rust/2020/src/day_08.rs b/rust/2020/src/day_08.rs index 178bd9d..42b78fa 100644 --- a/rust/2020/src/day_08.rs +++ b/rust/2020/src/day_08.rs @@ -204,12 +204,6 @@ pub fn input_generator(input: &str) -> Vec { * * Run your copy of the boot code. Immediately before any instruction is executed a second time, what value is in the accumulator? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_08::*; -/// let input = include_str!("../input/2020/day8.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)).unwrap(), 1489); -/// ``` #[aoc(day8, part1)] pub fn solve_part_01(input: &[Instruction]) -> Option { Program::new().calculate_to_error(input) @@ -262,12 +256,6 @@ pub fn solve_part_01(input: &[Instruction]) -> Option { * Fix the program so that it terminates normally by changing exactly one jmp (to nop) * or nop (to jmp). What is the value of the accumulator after the program terminates? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_08::*; -/// let input = include_str!("../input/2020/day8.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)).unwrap(), 1539); -/// ``` #[aoc(day8, part2)] pub fn solve_part_02(input: &[Instruction]) -> Option { for i in 0..input.len() { @@ -310,7 +298,7 @@ pub fn solve_part_02(input: &[Instruction]) -> Option { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn sample_01() { let data = " @@ -328,7 +316,7 @@ acc +6 assert_eq!(solve_part_01(&input_generator(data)).unwrap(), 5) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn sample_02() { let data = " diff --git a/rust/2020/src/day_09.rs b/rust/2020/src/day_09.rs index a7f94b6..4d0ed77 100644 --- a/rust/2020/src/day_09.rs +++ b/rust/2020/src/day_09.rs @@ -116,23 +116,11 @@ fn find_weakness(input: &[u64], preamble: usize) -> Option { * * What is the first number that does not have this property? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_09::*; -/// let input = include_str!("../input/2020/day9.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)).unwrap(), 21806024); -/// ``` #[aoc(day9, part1)] pub fn solve_part_01(input: &[u64]) -> Option { find_broken_number(input, 25) } -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_09::*; -/// let input = include_str!("../input/2020/day9.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)).unwrap(), 2986195); -/// ``` #[aoc(day9, part2)] pub fn solve_part_02(input: &[u64]) -> Option { find_weakness(input, 25) @@ -142,7 +130,7 @@ pub fn solve_part_02(input: &[u64]) -> Option { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn find_broken_number_for_sample() { let data = "35 @@ -170,7 +158,7 @@ mod tests { assert_eq!(find_broken_number(&input_generator(data), 5).unwrap(), 127) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn find_weakness_for_sample() { let data = "35 diff --git a/rust/2020/src/day_10.rs b/rust/2020/src/day_10.rs index 80335da..9ff98e0 100644 --- a/rust/2020/src/day_10.rs +++ b/rust/2020/src/day_10.rs @@ -118,12 +118,6 @@ fn find_differences(input: &BTreeSet) -> impl Iterator + '_ { * outlet, the adapters, and your device. What is the number of 1-jolt * differences multiplied by the number of 3-jolt differences? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_10::*; -/// let input = include_str!("../input/2020/day10.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 2475); -/// ``` #[aoc(day10, part1)] pub fn solve_part_01(input: &BTreeSet) -> u64 { let mut results = [0, 0, 1]; @@ -225,12 +219,6 @@ fn count_connections( * * What is the total number of distinct ways you can arrange the adapters to connect the charging outlet to your device? */ -///your puzzle answer was. -/// ``` -/// use advent_of_code_2020::day_10::*; -/// let input = include_str!("../input/2020/day10.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 442136281481216); -/// ``` #[aoc(day10, part2)] pub fn solve_part_02(input: &BTreeSet) -> u64 { let max = match input.iter().max_by(|a, b| a.cmp(b)) { @@ -247,7 +235,7 @@ pub fn solve_part_02(input: &BTreeSet) -> u64 { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn solves_with_example_data_part_01() { let data = "16 @@ -266,7 +254,7 @@ mod tests { assert_eq!(solve_part_01(&input_generator(data)), 35); } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn solves_with_example_data_part_02() { let data = "16 @@ -285,7 +273,7 @@ mod tests { assert_eq!(solve_part_02(&input_generator(data)), 8); } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn solves_with_long_example_data_part_02() { let data = "28 diff --git a/rust/2020/src/day_11.rs b/rust/2020/src/day_11.rs index a018bcf..aabbf8e 100644 --- a/rust/2020/src/day_11.rs +++ b/rust/2020/src/day_11.rs @@ -258,11 +258,6 @@ fn simulate_seating], usize, usize) -> bool>( * Simulate your seating area by applying the seating rules repeatedly until no seats change state. * How many seats end up occupied? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_11::*; -/// let input = include_str!("../input/2020/day11.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 2183); #[aoc(day11, part1)] pub fn solve_part_01(grid: &[Vec]) -> usize { simulate_seating(grid, should_swap_part_1) @@ -394,12 +389,6 @@ pub fn solve_part_01(grid: &[Vec]) -> usize { * Given the new visibility method and the rule change for occupied seats becoming empty, * once equilibrium is reached, how many seats end up occupied? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_11::*; -/// let input = include_str!("../input/2020/day11.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 1990); -/// ``` #[aoc(day11, part2)] pub fn solve_part_02(grid: &[Vec]) -> usize { simulate_seating(grid, should_swap_part_2) @@ -409,7 +398,7 @@ pub fn solve_part_02(grid: &[Vec]) -> usize { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn test_example_part_1() { let data = "L.LL.LL.LL @@ -427,7 +416,7 @@ L.LLLLL.LL assert_eq!(solve_part_01(&input_generator(data)), 37) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn test_example_part_2() { let data = "L.LL.LL.LL diff --git a/rust/2020/src/day_12.rs b/rust/2020/src/day_12.rs index 31dff0c..489f149 100644 --- a/rust/2020/src/day_12.rs +++ b/rust/2020/src/day_12.rs @@ -167,11 +167,6 @@ pub fn input_generator(input: &str) -> Vec { * Figure out where the navigation instructions lead. What is the Manhattan distance * between that location and the ship's starting position? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_12::*; -/// let input = include_str!("../input/2020/day12.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 1294); #[aoc(day12, part1)] pub fn solve_part_01(instructions: &[Instruction]) -> u32 { let mut ship = Ship::new(); @@ -225,12 +220,6 @@ pub fn solve_part_01(instructions: &[Instruction]) -> u32 { * * Figure out where the navigation instructions actually lead. What is the Manhattan distance between that location and the ship's starting position? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_12::*; -/// let input = include_str!("../input/2020/day12.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 20592); -/// ``` #[aoc(day12, part2)] pub fn solve_part_02(instructions: &[Instruction]) -> u32 { let mut waypoint = Waypoint::new(10, 1); @@ -255,7 +244,7 @@ pub fn solve_part_02(instructions: &[Instruction]) -> u32 { mod tests { use super::*; - /// Test example data on part 1 + // Test example data on part 1 #[test] fn test_example_part_1() { let data = "F10 @@ -267,7 +256,7 @@ F11"; assert_eq!(solve_part_01(&input_generator(data)), 25) } - /// Test example data on part 2 + // Test example data on part 2 #[test] fn test_example_part_2() { let data = "F10 diff --git a/rust/2020/src/day_13.rs b/rust/2020/src/day_13.rs index 8d15919..f0bc0ac 100644 --- a/rust/2020/src/day_13.rs +++ b/rust/2020/src/day_13.rs @@ -111,12 +111,6 @@ pub fn input_generator_part_2(input: &str) -> Vec { * What is the ID of the earliest bus you can take to the airport multiplied * by the number of minutes you'll need to wait for that bus? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_13::*; -/// let input = include_str!("../input/2020/day13.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_1(input)).unwrap(), 3246); -/// ``` #[aoc(day13, part1)] pub fn solve_part_01((timestamp, buses): &(u64, Vec)) -> Option { (0..) @@ -202,12 +196,6 @@ pub fn solve_part_01((timestamp, buses): &(u64, Vec)) -> Option { * What is the earliest timestamp such that all of the listed bus * IDs depart at offsets matching their positions in the list? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_13::*; -/// let input = include_str!("../input/2020/day13.txt"); -/// assert_eq!(solve_part_02(&input_generator_part_2(input)), 1010182346291467); -/// ``` #[aoc(day13, part2)] pub fn solve_part_02(buses: &[String]) -> i64 { let mut residues = vec![]; diff --git a/rust/2020/src/day_14.rs b/rust/2020/src/day_14.rs index 0d3ab4e..23b12dc 100644 --- a/rust/2020/src/day_14.rs +++ b/rust/2020/src/day_14.rs @@ -103,12 +103,6 @@ fn parse_mask(value: usize, mask: &str) -> usize { * * Execute the initialization program. What is the sum of all values left in memory after it completes? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_14::*; -/// let input = include_str!("../input/2020/day14.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 5055782549997); -/// ``` #[aoc(day14, part1)] pub fn solve_part_01(input: &[(String, String)]) -> usize { let mut memory: HashMap = HashMap::new(); @@ -130,13 +124,6 @@ pub fn solve_part_01(input: &[(String, String)]) -> usize { memory.values().sum() } -///// Your puzzle answer was -///// -//#[aoc(day14, part2)] -//pub fn solve_part_02(_input: &[String]) -> u32 { -// 0 -//} - #[cfg(test)] mod tests { use super::*; diff --git a/rust/2020/src/day_15.rs b/rust/2020/src/day_15.rs index 98658ae..80858cd 100644 --- a/rust/2020/src/day_15.rs +++ b/rust/2020/src/day_15.rs @@ -89,12 +89,6 @@ fn solver(input: &[usize], end_on_turn: usize) -> usize { * Given the starting numbers 3,1,2, the 2020th number spoken is 1836. * Given your starting numbers, what will be the 2020th number spoken? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_15::*; -/// let input = include_str!("../input/2020/day15.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 1696); -/// ``` #[aoc(day15, part1)] pub fn solve_part_01(input: &[usize]) -> usize { solver(input, 2020) @@ -115,13 +109,6 @@ pub fn solve_part_01(input: &[usize]) -> usize { * * Given your starting numbers, what will be the 30000000th number spoken? */ -// Ignored test, takes too long -// /// Your puzzle answer was -// /// ``` -// /// use advent_of_code_2020::day_15::*; -// /// let input = include_str!("../input/2020/day15.txt"); -// /// assert_eq!(solve_part_02(&input_generator(input)), 37385); -// /// ``` #[aoc(day15, part2)] pub fn solve_part_02(input: &[usize]) -> usize { solver(input, 30_000_000) diff --git a/rust/2020/src/day_16.rs b/rust/2020/src/day_16.rs index a5dfcdc..77144e0 100644 --- a/rust/2020/src/day_16.rs +++ b/rust/2020/src/day_16.rs @@ -118,12 +118,6 @@ pub fn input_generator(input: &str) -> Train { * * Consider the validity of the nearby tickets you scanned. What is your ticket scanning error rate? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_16::*; -/// let input = include_str!("../input/2020/day16.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 26980); -/// ``` #[aoc(day16, part1)] pub fn solve_part_01(train: &Train) -> u32 { let mut error = 0; @@ -149,17 +143,6 @@ pub fn solve_part_01(train: &Train) -> u32 { error } -// /// Your puzzle answer was -// /// ``` -// /// use advent_of_code_2020::day_16::*; -// /// let input = include_str!("../input/2020/day16.txt"); -// /// assert_eq!(solve_part_02(&input_generator(input)), 37385); -// /// ``` -// #[aoc(day16, part2)] -// pub fn solve_part_02(_input: &[usize]) -> usize { -// 0 -// } - #[cfg(test)] mod tests { use super::*; diff --git a/rust/2020/src/day_17.rs b/rust/2020/src/day_17.rs index 9fbf0f2..8e73ad0 100644 --- a/rust/2020/src/day_17.rs +++ b/rust/2020/src/day_17.rs @@ -260,12 +260,6 @@ fn hyper_cube_neighbors() -> Vec<(i32, i32, i32, i32)> { * Starting with your given initial configuration, simulate six cycles. * How many cubes are left in the active state after the sixth cycle? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_17::*; -/// let input = include_str!("../input/2020/day17.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_01(input)), 242); -/// ``` #[aoc(day17, part1)] pub fn solve_part_01(input: &[Cube]) -> usize { let mut cube = input.to_owned(); @@ -308,8 +302,6 @@ pub fn solve_part_01(input: &[Cube]) -> usize { * * Starting with your given initial configuration, simulate six cycles in a 4-dimensional space. * How many cubes are left in the active state after the sixth cycle? - * - * NO DOC TEST because slow */ #[aoc(day17, part2)] pub fn solve_part_02(input: &[HyperCube]) -> usize { diff --git a/rust/2020/src/day_18.rs b/rust/2020/src/day_18.rs index 20852e1..b4a4e2d 100644 --- a/rust/2020/src/day_18.rs +++ b/rust/2020/src/day_18.rs @@ -129,12 +129,6 @@ pub fn input_generator_part_2(input: &str) -> Vec { * Before you can help with the homework, you need to understand it yourself. * Evaluate the expression on each line of the homework; what is the sum of the resulting values? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_18::*; -/// let input = include_str!("../input/2020/day18.txt"); -/// assert_eq!(solve_part_01(&input_generator_part_1(input)), 29839238838303); -/// ``` #[aoc(day18, part1)] pub fn solve_part_01(input: &[String]) -> u64 { input @@ -168,12 +162,6 @@ pub fn solve_part_01(input: &[String]) -> u64 { * * What do you get if you add up the results of evaluating the homework problems using these new rules? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_18::*; -/// let input = include_str!("../input/2020/day18.txt"); -/// assert_eq!(solve_part_02(&input_generator_part_2(input)), 201376568795521); -/// ``` #[aoc(day18, part2)] pub fn solve_part_02(input: &[String]) -> u64 { input diff --git a/rust/2020/src/day_19.rs b/rust/2020/src/day_19.rs index dc95139..5c1a08d 100644 --- a/rust/2020/src/day_19.rs +++ b/rust/2020/src/day_19.rs @@ -216,12 +216,6 @@ fn count_matches(program: &Program) -> usize { * * How many messages completely match rule 0? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_19::*; -/// let input = include_str!("../input/2020/day19.txt"); -/// assert_eq!(solve_part_01(&input_generator(input)), 122); -/// ``` #[aoc(day19, part1)] pub fn solve_part_01(program: &Program) -> usize { count_matches(program) @@ -313,12 +307,6 @@ pub fn solve_part_01(program: &Program) -> usize { * * After updating rules 8 and 11, how many messages completely match rule 0? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_19::*; -/// let input = include_str!("../input/2020/day19.txt"); -/// assert_eq!(solve_part_02(&input_generator(input)), 287); -/// ``` #[aoc(day19, part2)] pub fn solve_part_02(program: &Program) -> usize { let mut program = program.to_owned(); diff --git a/rust/2020/src/day_21.rs b/rust/2020/src/day_21.rs index bace29b..7feea1d 100644 --- a/rust/2020/src/day_21.rs +++ b/rust/2020/src/day_21.rs @@ -84,12 +84,6 @@ pub fn input_generator(input: &str) -> (Vec, BTreeMap) { * * Determine which ingredients cannot possibly contain any of the allergens in your list. How many times do any of those ingredients appear? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_21::*; -/// let data = include_str!("../input/2020/day21.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 2517); -/// ``` #[aoc(day21, part1)] pub fn solve_part_01((foods, allergens): &(Vec, BTreeMap)) -> usize { let allergens = allergens @@ -119,12 +113,6 @@ pub fn solve_part_01((foods, allergens): &(Vec, BTreeMap * * Time to stock your raft with supplies. What is your canonical dangerous ingredient list? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_21::*; -/// let data = include_str!("../input/2020/day21.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), "rhvbn,mmcpg,kjf,fvk,lbmt,jgtb,hcbdb,zrb"); -/// ``` #[aoc(day21, part2)] pub fn solve_part_02((_, allergens): &(Vec, BTreeMap)) -> String { allergens.iter().map(|(_, i)| i).join(",") diff --git a/rust/2020/src/day_22.rs b/rust/2020/src/day_22.rs index 6c2ff7a..4043c44 100644 --- a/rust/2020/src/day_22.rs +++ b/rust/2020/src/day_22.rs @@ -205,12 +205,6 @@ fn combat(player_1: &VecDeque, player_2: &VecDeque) -> (u32, VecDeque< * * Play the small crab in a game of Combat using the two decks you just dealt. What is the winning player's score? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_22::*; -/// let data = include_str!("../input/2020/day22.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 32472); -/// ``` #[aoc(day22, part1)] pub fn solve_part_01((player_1, player_2): &(VecDeque, VecDeque)) -> u32 { let mut player_1 = player_1.to_owned(); @@ -303,12 +297,6 @@ pub fn solve_part_01((player_1, player_2): &(VecDeque, VecDeque)) -> u * * Defend your honor as Raft Captain by playing the small crab in a game of Recursive Combat using the same two decks as before. What is the winning player's score? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2020::day_22::*; -/// let data = include_str!("../input/2020/day22.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 36463); -/// ``` #[aoc(day22, part2)] pub fn solve_part_02((player_1, player_2): &(VecDeque, VecDeque)) -> u32 { let (_, winner) = combat(player_1, player_2); diff --git a/rust/2021/src/day_01.rs b/rust/2021/src/day_01.rs index e905252..53df105 100644 --- a/rust/2021/src/day_01.rs +++ b/rust/2021/src/day_01.rs @@ -45,12 +45,6 @@ In this example, there are 7 measurements that are larger than the previous meas How many measurements are larger than the previous measurement? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2021::day_01::*; -/// let data = include_str!("../input/2021/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 1713); -/// ``` #[aoc(day1, part1)] pub fn solve_part_01(input: &[u32]) -> u32 { let mut increases = 0; @@ -103,12 +97,6 @@ In this example, there are 5 sums that are larger than the previous sum. Consider sums of a three-measurement sliding window. How many sums are larger than the previous sum? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2021::day_01::*; -/// let data = include_str!("../input/2021/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 1734); -/// ``` #[aoc(day1, part2)] pub fn solve_part_02(input: &[u32]) -> u32 { let mut previous_sum: u32 = input.windows(3).next().unwrap().iter().sum(); diff --git a/rust/2021/src/day_02.rs b/rust/2021/src/day_02.rs index 4aa43a5..a6f318d 100644 --- a/rust/2021/src/day_02.rs +++ b/rust/2021/src/day_02.rs @@ -40,12 +40,6 @@ After following these instructions, you would have a horizontal position of 15 a Calculate the horizontal position and depth you would have after following the planned course. What do you get if you multiply your final horizontal position by your final depth? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2021::day_02::*; -/// let data = include_str!("../input/2021/day2.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 1947824); -/// ``` #[aoc(day2, part1)] pub fn solve_part_01(input: &[String]) -> u32 { let mut depth = 0; @@ -93,12 +87,6 @@ After following these new instructions, you would have a horizontal position of Using this new interpretation of the commands, calculate the horizontal position and depth you would have after following the planned course. What do you get if you multiply your final horizontal position by your final depth? */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2021::day_02::*; -/// let data = include_str!("../input/2021/day2.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 1813062561); -/// ``` #[aoc(day2, part2)] pub fn solve_part_02(input: &[String]) -> u32 { let mut aim = 0; diff --git a/rust/2022/src/day_01.rs b/rust/2022/src/day_01.rs index 66b4757..b7b7e28 100644 --- a/rust/2022/src/day_01.rs +++ b/rust/2022/src/day_01.rs @@ -57,12 +57,6 @@ pub fn input_generator(input: &str) -> CaloriesPerElf { * From the example above, the calories for each elf are 6000, 4000, 11000. So, 11000 * would be our answer. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_01::*; -/// let data = include_str!("../input/2022/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 69528); -/// ``` #[aoc(day1, part1)] pub fn solve_part_01(elves: &CaloriesPerElf) -> u32 { *elves.first().unwrap() @@ -73,12 +67,6 @@ pub fn solve_part_01(elves: &CaloriesPerElf) -> u32 { * In part two we want to find the top three elves and sum up the * amount of calories they are carrying. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_01::*; -/// let data = include_str!("../input/2022/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 206152); -/// ``` #[aoc(day1, part2)] pub fn solve_part_02(elves: &CaloriesPerElf) -> u32 { elves.iter().take(3).sum::() diff --git a/rust/2022/src/day_02.rs b/rust/2022/src/day_02.rs index 9493535..e447c4e 100644 --- a/rust/2022/src/day_02.rs +++ b/rust/2022/src/day_02.rs @@ -47,12 +47,6 @@ pub fn input_generator(input: &str) -> Game { * Following the example that would give us a score of 15 ((6 + 2) + (0 + 1) + (3 + 3)) * What is our total score if we follow this strategy guide? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_02::*; -/// let data = include_str!("../input/2022/day2.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 13809); -/// ``` #[aoc(day2, part1)] pub fn solve_part_01(game: &Game) -> u32 { game.iter() @@ -94,12 +88,6 @@ pub fn solve_part_01(game: &Game) -> u32 { * We have to change our strategy to match the desired outcome. * What is our total score if we follow this guide? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_02::*; -/// let data = include_str!("../input/2022/day2.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 12316); -/// ``` #[aoc(day2, part2)] pub fn solve_part_02(game: &Game) -> u32 { game.iter() diff --git a/rust/2022/src/day_03.rs b/rust/2022/src/day_03.rs index fdcab02..565f0f5 100644 --- a/rust/2022/src/day_03.rs +++ b/rust/2022/src/day_03.rs @@ -95,12 +95,6 @@ pub fn input_generator(input: &str) -> Rucksack { * * Find the item type that appears in both compartments of each rucksack. What is the sum of the priorities of those item types? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_03::*; -/// let data = include_str!("../input/2022/day3.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 7831); -/// ``` #[aoc(day3, part1)] pub fn solve_part_01(rucksack: &Rucksack) -> u32 { let items = Items::new(); @@ -169,12 +163,6 @@ pub fn solve_part_01(rucksack: &Rucksack) -> u32 { * Find the item type that corresponds to the badges of each * three-Elf group. What is the sum of the priorities of those item types? */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_03::*; -/// let data = include_str!("../input/2022/day3.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 2683); -/// ``` #[aoc(day3, part2)] pub fn solve_part_02(rucksack: &Rucksack) -> u32 { let items = Items::new(); diff --git a/rust/2022/src/day_04.rs b/rust/2022/src/day_04.rs index d8a9277..605303d 100644 --- a/rust/2022/src/day_04.rs +++ b/rust/2022/src/day_04.rs @@ -66,12 +66,6 @@ pub fn input_generator(input: &str) -> Groups { * * Find how many pairs overlap completely. In the example above, the answer would be 2. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_04::*; -/// let data = include_str!("../input/2022/day4.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 550); -/// ``` #[aoc(day4, part1)] pub fn solve_part_01(groups: &Groups) -> u32 { let mut overlap = 0; @@ -94,12 +88,6 @@ pub fn solve_part_01(groups: &Groups) -> u32 { * * In this part, we need to find the pairs that partially overlap. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_04::*; -/// let data = include_str!("../input/2022/day4.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 931); -/// ``` #[aoc(day4, part2)] pub fn solve_part_02(groups: &Groups) -> u32 { let mut overlap = 0; diff --git a/rust/2022/src/day_05.rs b/rust/2022/src/day_05.rs index e257165..18ec7b7 100644 --- a/rust/2022/src/day_05.rs +++ b/rust/2022/src/day_05.rs @@ -104,12 +104,6 @@ pub fn input_generator(input: &str) -> Input { * * Move each crate to the correct stack. One at a time. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_05::*; -/// let data = include_str!("../input/2022/day5.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), "PSNRGBTFT"); -/// ``` #[aoc(day5, part1)] pub fn solve_part_01((stacks, instructions): &Input) -> String { let mut stacks = stacks.clone(); @@ -133,12 +127,6 @@ pub fn solve_part_01((stacks, instructions): &Input) -> String { * * Move each crate to the correct stack. All at once. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_05::*; -/// let data = include_str!("../input/2022/day5.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), "BNTZFPMMW"); -/// ``` #[aoc(day5, part2)] pub fn solve_part_02((stacks, instructions): &Input) -> String { let mut stacks = stacks.clone(); diff --git a/rust/2022/src/day_06.rs b/rust/2022/src/day_06.rs index 513aa10..11f741c 100644 --- a/rust/2022/src/day_06.rs +++ b/rust/2022/src/day_06.rs @@ -40,12 +40,6 @@ fn find_start_of_message_marker(input: &Input, window_size: usize) -> usize { * so this isn't it. The first window that's unique is 'jpqm' and the end of that marker * is found on position 7. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_06::*; -/// let data = include_str!("../input/2022/day6.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 1300); -/// ``` #[aoc(day6, part1)] pub fn solve_part_01(input: &Input) -> usize { find_start_of_message_marker(input, 4) @@ -55,12 +49,6 @@ pub fn solve_part_01(input: &Input) -> usize { * * The window size is now 14, but everything else is the same. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_06::*; -/// let data = include_str!("../input/2022/day6.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 3986); -/// ``` #[aoc(day6, part2)] pub fn solve_part_02(input: &Input) -> usize { find_start_of_message_marker(input, 14) diff --git a/rust/2022/src/day_08.rs b/rust/2022/src/day_08.rs index 7414137..f119eb4 100644 --- a/rust/2022/src/day_08.rs +++ b/rust/2022/src/day_08.rs @@ -32,12 +32,6 @@ fn find_inner_trees(input: &Input) -> Vec> { * * The edges of the forest are always visible, so we can count them first. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_08::*; -/// let data = include_str!("../input/2022/day8.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 1684); -/// ``` #[aoc(day8, part1)] pub fn solve_part_01(input: &Input) -> u32 { // We know that the outer most ring of tree are always visible. @@ -92,12 +86,6 @@ pub fn solve_part_01(input: &Input) -> u32 { * * The scenic score is 3 * 2 * 1 * 2 = 12 */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_08::*; -/// let data = include_str!("../input/2022/day8.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 486540); -/// ``` #[aoc(day8, part2)] pub fn solve_part_02(input: &Input) -> u32 { let mut scenic_scores: Vec = vec![]; diff --git a/rust/2022/src/day_09.rs b/rust/2022/src/day_09.rs index 4d3aa84..cad9f66 100644 --- a/rust/2022/src/day_09.rs +++ b/rust/2022/src/day_09.rs @@ -88,12 +88,6 @@ pub fn input_generator(input: &str) -> Instructions { * * Calculate the number of coordinates visited by the _tail_ of the rope. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_09::*; -/// let data = include_str!("../input/2022/day9.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 5735); -/// ``` #[aoc(day9, part1)] pub fn solve_part_01(instructions: &Instructions) -> usize { // Create rope with two knots @@ -111,12 +105,6 @@ pub fn solve_part_01(instructions: &Instructions) -> usize { * * Here we need to use 10 knots instead of 2. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_09::*; -/// let data = include_str!("../input/2022/day9.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 2478); -/// ``` #[aoc(day9, part2)] pub fn solve_part_02(instructions: &Instructions) -> usize { // Create rope with ten knots diff --git a/rust/2022/src/day_10.rs b/rust/2022/src/day_10.rs index 5a7e791..def11c4 100644 --- a/rust/2022/src/day_10.rs +++ b/rust/2022/src/day_10.rs @@ -38,12 +38,6 @@ pub fn input_generator(input: &str) -> Operations { * we should add the cycle value * x to the solution. These cycles * can happen in the middle of an operation. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_10::*; -/// let data = include_str!("../input/2022/day10.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 16880); -/// ``` #[aoc(day10, part1)] pub fn solve_part_01(operations: &Operations) -> i32 { let mut x = 1; @@ -88,12 +82,6 @@ pub fn solve_part_01(operations: &Operations) -> i32 { * * The result will be eight capital letters that are spelled out on the CRT. */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_10::*; -/// let data = include_str!("../input/2022/day10.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), "###..#..#..##..####..##....##.###..###..#..#.#.#..#..#....#.#..#....#.#..#.#..#.#..#.##...#..#...#..#..#....#.###..#..#.#.#..#.#..####..#...####....#.#..#.###..#.#..#.#..#..#.#....#..#.#..#.#..#.#.#..#..#.#..#.#..#.####.#..#..##..###..#..#."); -/// ``` #[aoc(day10, part2)] pub fn solve_part_02(operations: &Operations) -> String { let mut x: isize = 1; diff --git a/rust/2022/src/day_11.rs b/rust/2022/src/day_11.rs index c0d3f7b..539aa4f 100644 --- a/rust/2022/src/day_11.rs +++ b/rust/2022/src/day_11.rs @@ -177,12 +177,6 @@ fn monkey_in_the_middle(monkeys: &mut [Monkey], rounds: u32, divisor: Option u64 { let mut monkeys = create_monkeys(input); @@ -192,12 +186,6 @@ pub fn solve_part_01(input: &str) -> u64 { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_11::*; -/// let data = include_str!("../input/2022/day11.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 19309892877); -/// ``` #[aoc(day11, part2)] pub fn solve_part_02(input: &str) -> u64 { let mut monkeys = create_monkeys(input); diff --git a/rust/2022/src/day_12.rs b/rust/2022/src/day_12.rs index aa55dcd..da8026c 100644 --- a/rust/2022/src/day_12.rs +++ b/rust/2022/src/day_12.rs @@ -79,12 +79,6 @@ pub fn input_generator(input: &str) -> Input { // Part One // // Find the shortest path from a provided start position to an end position. -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_12::*; -/// let data = include_str!("../input/2022/day12.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 420); -/// ``` #[aoc(day12, part1)] pub fn solve_part_01((matrix, start, end): &Input) -> usize { // Find the shortest path from start to end @@ -101,12 +95,6 @@ pub fn solve_part_01((matrix, start, end): &Input) -> usize { // First, let's find all position with the lowest cost. Then, we can // run Dijkstra's algorithm from each of these positions and save the // amount of steps needed. Then we pick the shortest path. -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_12::*; -/// let data = include_str!("../input/2022/day12.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 414); -/// ``` #[aoc(day12, part2)] pub fn solve_part_02((matrix, _start, end): &Input) -> usize { // Find all starting points at the lowest cost diff --git a/rust/2022/src/day_13.rs b/rust/2022/src/day_13.rs index 9c44729..40225e6 100644 --- a/rust/2022/src/day_13.rs +++ b/rust/2022/src/day_13.rs @@ -99,12 +99,6 @@ pub fn input_generator(input: &str) -> Packets { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_13::*; -/// let data = include_str!("../input/2022/day13.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 5390); -/// ``` #[aoc(day13, part1)] pub fn solve_part_01(packets: &Packets) -> usize { packets @@ -121,12 +115,6 @@ pub fn solve_part_01(packets: &Packets) -> usize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_13::*; -/// let data = include_str!("../input/2022/day13.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 19261); -/// ``` #[aoc(day13, part2)] pub fn solve_part_02(packets: &Packets) -> usize { let mut packets: Vec<&Packet> = packets diff --git a/rust/2022/src/day_14.rs b/rust/2022/src/day_14.rs index 5247593..2f9d909 100644 --- a/rust/2022/src/day_14.rs +++ b/rust/2022/src/day_14.rs @@ -140,12 +140,6 @@ impl Sand { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_14::*; -/// let data = include_str!("../input/2022/day14.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 737); -/// ``` #[aoc(day14, part1)] pub fn solve_part_01(rocks: &Rocks) -> usize { let mut units_of_sand: BTreeSet<(u32, u32)> = BTreeSet::new(); @@ -204,12 +198,6 @@ pub fn solve_part_01(rocks: &Rocks) -> usize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_14::*; -/// let data = include_str!("../input/2022/day14.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 28145); -/// ``` #[aoc(day14, part2)] pub fn solve_part_02(rocks: &Rocks) -> usize { let mut rocks = rocks.clone(); diff --git a/rust/2022/src/day_15.rs b/rust/2022/src/day_15.rs index 5f05537..fa98d14 100644 --- a/rust/2022/src/day_15.rs +++ b/rust/2022/src/day_15.rs @@ -137,12 +137,6 @@ fn part2_solver(sensors: &Sensors, max: isize) -> isize { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_15::*; -/// let data = include_str!("../input/2022/day15.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 5083287); -/// ``` #[aoc(day15, part1)] pub fn solve_part_01(sensors: &Sensors) -> usize { part1_solver(sensors, 2000000) @@ -150,12 +144,6 @@ pub fn solve_part_01(sensors: &Sensors) -> usize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_15::*; -/// let data = include_str!("../input/2022/day15.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 13134039205729); -/// ``` #[aoc(day15, part2)] pub fn solve_part_02(sensors: &Sensors) -> isize { part2_solver(sensors, 4000000) diff --git a/rust/2022/src/day_17.rs b/rust/2022/src/day_17.rs index d1d87bd..1a7496f 100644 --- a/rust/2022/src/day_17.rs +++ b/rust/2022/src/day_17.rs @@ -145,12 +145,6 @@ pub fn input_generator(input: &str) -> Input { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_17::*; -/// let data = include_str!("../input/2022/day17.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 3109); -/// ``` #[aoc(day17, part1)] pub fn solve_part_01(input: &Input) -> usize { let mut jets = input.clone(); diff --git a/rust/2022/src/day_18.rs b/rust/2022/src/day_18.rs index 743b705..d13b86e 100644 --- a/rust/2022/src/day_18.rs +++ b/rust/2022/src/day_18.rs @@ -70,12 +70,6 @@ pub fn input_generator(input: &str) -> Input { parse_input(input).unwrap().1 } -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_18::*; -/// let data = include_str!("../input/2022/day18.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 4244); -/// ``` #[aoc(day18, part1)] pub fn solve_part_01(input: &Input) -> usize { input @@ -89,12 +83,6 @@ pub fn solve_part_01(input: &Input) -> usize { .sum() } -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_18::*; -/// let data = include_str!("../input/2022/day18.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 2460); -/// ``` #[aoc(day18, part2)] pub fn solve_part_02(input: &Input) -> usize { let min_x = input.iter().map(|cube| cube.x).min().unwrap(); diff --git a/rust/2022/src/day_21.rs b/rust/2022/src/day_21.rs index bcad528..e674ebf 100644 --- a/rust/2022/src/day_21.rs +++ b/rust/2022/src/day_21.rs @@ -88,12 +88,6 @@ fn evaluate_monkeys(numbers: &mut AllNumbers, equations: &mut AllEquations) { /* Part One */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_21::*; -/// let data = include_str!("../input/2022/day21.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 170237589447588); -/// ``` #[aoc(day21, part1)] pub fn solve_part_01(monkeys: &Input) -> isize { let (mut numbers, mut equations) = monkeys.clone(); @@ -105,12 +99,6 @@ pub fn solve_part_01(monkeys: &Input) -> isize { /* Part Two */ -/// Your puzzle answer was -/// ``` -/// use advent_of_code_2022::day_21::*; -/// let data = include_str!("../input/2022/day21.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 3712643961892); -/// ``` #[aoc(day21, part2)] pub fn solve_part_02(monkeys: &Input) -> isize { let (mut numbers, mut equations) = monkeys.clone(); diff --git a/rust/2023/src/day_01.rs b/rust/2023/src/day_01.rs index 6ac4e54..02676c1 100644 --- a/rust/2023/src/day_01.rs +++ b/rust/2023/src/day_01.rs @@ -47,11 +47,11 @@ fn sum_first_and_last_digit(line: &str) -> u32 { * */ // Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_01::*; -/// let data = include_str!("../input/2023/day1.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 54304); -/// ``` + ``` + use advent_of_code_2023::day_01::*; + let data = include_str!("../input/2023/day1.txt"); + assert_eq!(solve_part_01(&input_generator(data)), 54304); + ``` #[aoc(day1, part1)] pub fn solve_part_01(input: &str) -> u32 { input.lines().map(sum_first_and_last_digit).sum() @@ -89,11 +89,11 @@ const TRANSLATIONS: [(&str, &str); 9] = [ * */ // Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_01::*; -/// let data = include_str!("../input/2023/day1.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 54418); -/// ``` + ``` + use advent_of_code_2023::day_01::*; + let data = include_str!("../input/2023/day1.txt"); + assert_eq!(solve_part_02(&input_generator(data)), 54418); + ``` #[aoc(day1, part2)] pub fn solve_part_02(input: &str) -> u32 { input diff --git a/rust/2023/src/day_02.rs b/rust/2023/src/day_02.rs index dd7aebc..6413aa5 100644 --- a/rust/2023/src/day_02.rs +++ b/rust/2023/src/day_02.rs @@ -96,12 +96,6 @@ pub fn input_generator(input: &str) -> Games { * The sum of the game IDs is 1 + 2 + 5 = 8. * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_02::*; -/// let data = include_str!("../input/2023/day2.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 2162); -/// ``` #[aoc(day2, part1)] pub fn solve_part_01(input: &Games) -> u32 { let mut id_sum = 0; @@ -133,12 +127,6 @@ pub fn solve_part_01(input: &Games) -> u32 { * Sum up the powers of all games. * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_02::*; -/// let data = include_str!("../input/2023/day2.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 72513); -/// ``` #[aoc(day2, part2)] pub fn solve_part_02(input: &Games) -> u32 { let mut power_sum = 0; diff --git a/rust/2023/src/day_03.rs b/rust/2023/src/day_03.rs index 80a66da..b7943d4 100644 --- a/rust/2023/src/day_03.rs +++ b/rust/2023/src/day_03.rs @@ -85,12 +85,6 @@ pub fn input_generator(input: &str) -> Input { * The sum of these numbers is 467 + 633 + 617 + 592 + 755 + 664 + 598 = 4361 * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_03::*; -/// let data = include_str!("../input/2023/day3.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 535235); -/// ``` #[aoc(day3, part1)] pub fn solve_part_01(input: &Input) -> u32 { let Input { @@ -123,12 +117,6 @@ pub fn solve_part_01(input: &Input) -> u32 { * If a gear only has one number connected to it, ignore it. * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_03::*; -/// let data = include_str!("../input/2023/day3.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 79844424); -/// ``` #[aoc(day3, part2)] pub fn solve_part_02(input: &Input) -> u32 { let Input { gears, numbers, .. } = input; diff --git a/rust/2023/src/day_04.rs b/rust/2023/src/day_04.rs index ffb6c34..864c51c 100644 --- a/rust/2023/src/day_04.rs +++ b/rust/2023/src/day_04.rs @@ -54,11 +54,11 @@ pub fn input_generator(input: &str) -> Input { * 8 + 2 + 2 + 1 + 0 + 0 = 13 */ // Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_04::*; -/// let data = include_str!("../input/2023/day4.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 27454); -/// ``` + ``` + use advent_of_code_2023::day_04::*; + let data = include_str!("../input/2023/day4.txt"); + assert_eq!(solve_part_01(&input_generator(data)), 27454); + ``` #[aoc(day4, part1)] pub fn solve_part_01(input: &Input) -> u32 { input @@ -86,11 +86,11 @@ pub fn solve_part_01(input: &Input) -> u32 { * */ // Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_04::*; -/// let data = include_str!("../input/2023/day4.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 6857330); -/// ``` + ``` + use advent_of_code_2023::day_04::*; + let data = include_str!("../input/2023/day4.txt"); + assert_eq!(solve_part_02(&input_generator(data)), 6857330); + ``` #[aoc(day4, part2)] pub fn solve_part_02(input: &Input) -> u32 { // Create a list of starting cards, one of each diff --git a/rust/2023/src/day_05.rs b/rust/2023/src/day_05.rs index 4a88339..540bb6a 100644 --- a/rust/2023/src/day_05.rs +++ b/rust/2023/src/day_05.rs @@ -143,12 +143,6 @@ pub fn input_generator(input: &str) -> Input { * to find the location of the seeds. Return the lowest location. * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_05::*; -/// let data = include_str!("../input/2023/day5.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 993500720); -/// ``` #[aoc(day5, part1)] pub fn solve_part_01(input: &Input) -> u64 { let Input { seeds, maps } = input; @@ -165,7 +159,6 @@ pub fn solve_part_01(input: &Input) -> u64 { * Otherwise, the calculation is the same as part one. Just A LOT more seeds. * * No doctest for this one, it takes too long. -* Your puzzle answer was: 4917124 */ #[aoc(day5, part2)] pub fn solve_part_02(input: &Input) -> u64 { diff --git a/rust/2023/src/day_06.rs b/rust/2023/src/day_06.rs index 814f0fa..ba1518c 100644 --- a/rust/2023/src/day_06.rs +++ b/rust/2023/src/day_06.rs @@ -80,14 +80,6 @@ fn race(races: &[(u64, u64)]) -> u64 { * covered is the speed times the remaining time. * */ -// Your puzzle answer was -/* -/// ``` -/// use advent_of_code_2023::day_06::*; -/// let data = include_str!("../input/2023/day6.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 861300); -/// ``` -*/ #[aoc(day6, part1)] pub fn solve_part_01(input: &Input) -> u64 { race(&input.races) @@ -100,13 +92,6 @@ pub fn solve_part_01(input: &Input) -> u64 { * is longer, we have a lot more ways to beat the record. * */ -/* -/// ``` -/// use advent_of_code_2023::day_06::*; -/// let data = include_str!("../input/2023/day6.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 28101347); -/// ``` -*/ #[aoc(day6, part2)] pub fn solve_part_02(input: &Input) -> u64 { race(&input.races) diff --git a/rust/2023/src/day_07.rs b/rust/2023/src/day_07.rs index 76147b6..78172d3 100644 --- a/rust/2023/src/day_07.rs +++ b/rust/2023/src/day_07.rs @@ -205,12 +205,6 @@ fn play(input: &Input) -> u64 { * 765 + 440 + 84 + 2736 + 2415 = 6440 * */ -// Your puzzle answer was -/// ``` -/// use advent_of_code_2023::day_07::*; -/// let data = include_str!("../input/2023/day7.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 250474325); -/// ``` #[aoc(day7, part1)] pub fn solve_part_01(input: &Input) -> u64 { play(input) @@ -223,11 +217,6 @@ pub fn solve_part_01(input: &Input) -> u64 { * are the same. * */ -/// ``` -/// use advent_of_code_2023::day_07::*; -/// let data = include_str!("../input/2023/day7.txt"); -/// assert_eq!(solve_part_02(&input_generator_part2(data)), 248909434); -/// ``` #[aoc(day7, part2)] pub fn solve_part_02(input: &Input) -> u64 { play(input) diff --git a/rust/2023/src/day_10.rs b/rust/2023/src/day_10.rs index e7ed0b5..ad49544 100644 --- a/rust/2023/src/day_10.rs +++ b/rust/2023/src/day_10.rs @@ -84,11 +84,11 @@ pub fn input_generator(input: &str) -> Input { Input { grid, start } } -/// Find how many points are enclosed by the loop. The loop is a polygon, so we can use -/// the Shoelace formula to calculate the area. Then we use Pick's theorem to find the -/// number of interior points. -/// https://en.wikipedia.org/wiki/Shoelace_formula -/// https://en.wikipedia.org/wiki/Pick%27s_theorem +// Find how many points are enclosed by the loop. The loop is a polygon, so we can use +// the Shoelace formula to calculate the area. Then we use Pick's theorem to find the +// number of interior points. +// https://en.wikipedia.org/wiki/Shoelace_formula +// https://en.wikipedia.org/wiki/Pick%27s_theorem pub fn solver(input: &Input) -> (i32, i32) { let Input { grid, start } = input; let determinant = |a: Point, b: Point| a.x * b.y - a.y * b.x; @@ -161,13 +161,6 @@ pub fn solver(input: &Input) -> (i32, i32) { * Follow pipes along a grid and find the furthest point from the start. * */ -/// Your puzzle answer was -/// -/// ``` -/// use advent_of_code_2023::day_10::*; -/// let data = include_str!("../input/2023/day10.txt"); -/// assert_eq!(solve_part_01(&input_generator(data)), 6882); -/// ``` #[aoc(day10, part1)] pub fn solve_part_01(input: &Input) -> i32 { solver(input).0 @@ -178,25 +171,12 @@ pub fn solve_part_01(input: &Input) -> i32 { * Find how many points are enclosed by the loop. * */ -/// ``` -/// use advent_of_code_2023::day_10::*; -/// let data = include_str!("../input/2023/day10.txt"); -/// assert_eq!(solve_part_02(&input_generator(data)), 491); -/// ``` #[aoc(day10, part2)] pub fn solve_part_02(input: &Input) -> i32 { solver(input).1 } -/// First solution using BFS -/// -/// Your puzzle answer was -/// -/// ``` -/// use advent_of_code_2023::day_10::*; -/// let data = include_str!("../input/2023/day10.txt"); -/// assert_eq!(solve_part_01_bfs(&input_generator(data)), 6882); -/// ``` +// First solution using BFS pub fn solve_part_01_bfs(input: &Input) -> u64 { let Input { grid, start } = input; let mut visited: HashSet = HashSet::new(); diff --git a/rust/2023/src/day_18.rs b/rust/2023/src/day_18.rs index 337c80f..6edcdcc 100644 --- a/rust/2023/src/day_18.rs +++ b/rust/2023/src/day_18.rs @@ -70,11 +70,11 @@ fn determinant(a: Point, b: Point) -> i64 { a.x as i64 * b.y as i64 - a.y as i64 * b.x as i64 } -/// Like day 10 we can use the Shoelace formula to calculate the area -/// of the polygon. Then we can make use of Pick's theorem -/// to find the number of interior points. We can then add the number of boundary -/// points and interior points to find the number of cubic meters that -/// the lava lagoon will hold. +// Like day 10 we can use the Shoelace formula to calculate the area +// of the polygon. Then we can make use of Pick's theorem +// to find the number of interior points. We can then add the number of boundary +// points and interior points to find the number of cubic meters that +// the lava lagoon will hold. fn cubic_meters(boundary: i64, area: i64) -> i64 { // Pick's theorem to find the number of interior points let interior_points = area.abs() / 2 - boundary / 2 + 1; @@ -105,12 +105,6 @@ fn dig(dig_plan: &Vec<(Point, i32)>) -> i64 { * Follow the plan and then determine how many cubic meters the lagoon will hold. * */ -// Your puzzle answer was -#[doc = r#"``` -use advent_of_code_2023::day_18::*; -let data = include_str!("../input/2023/day18.txt"); -assert_eq!(solve_part_01(&input_generator(data)), 48652); -```"#] #[aoc(day18, part1)] pub fn solve_part_01(input: &Input) -> i64 { dig(&input.dig_plan) @@ -121,11 +115,6 @@ pub fn solve_part_01(input: &Input) -> i64 { * Nothing changes in the solver, we just need to parse the input differently. * */ -#[doc = r#"``` -use advent_of_code_2023::day_18::*; -let data = include_str!("../input/2023/day18.txt"); -assert_eq!(solve_part_02(&input_generator_part2(data)), 45757884535661); -```"#] #[aoc(day18, part2)] pub fn solve_part_02(input: &Input) -> i64 { dig(&input.dig_plan)