From 197dab78d77aa3b9da3147b395a65e83ff0770d6 Mon Sep 17 00:00:00 2001 From: Burnus Date: Mon, 3 Apr 2023 17:34:44 +0200 Subject: [PATCH] Added Solution for 2020 day 05 --- 2020/day05_binary_boarding/Cargo.toml | 8 + 2020/day05_binary_boarding/challenge.txt | 60 ++ 2020/day05_binary_boarding/src/lib.rs | 86 ++ .../tests/challenge_input | 837 ++++++++++++++++++ 2020/day05_binary_boarding/tests/sample_input | 4 + 5 files changed, 995 insertions(+) create mode 100644 2020/day05_binary_boarding/Cargo.toml create mode 100644 2020/day05_binary_boarding/challenge.txt create mode 100644 2020/day05_binary_boarding/src/lib.rs create mode 100644 2020/day05_binary_boarding/tests/challenge_input create mode 100644 2020/day05_binary_boarding/tests/sample_input diff --git a/2020/day05_binary_boarding/Cargo.toml b/2020/day05_binary_boarding/Cargo.toml new file mode 100644 index 0000000..d1223a1 --- /dev/null +++ b/2020/day05_binary_boarding/Cargo.toml @@ -0,0 +1,8 @@ +[package] +name = "day05_binary_boarding" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/2020/day05_binary_boarding/challenge.txt b/2020/day05_binary_boarding/challenge.txt new file mode 100644 index 0000000..003f40d --- /dev/null +++ b/2020/day05_binary_boarding/challenge.txt @@ -0,0 +1,60 @@ +You board your plane only to discover a new problem: you dropped your boarding pass! You aren't sure which seat is yours, and all of the flight attendants are busy with the flood of people that suddenly made it through passport control. + +You write a quick program to use your phone's camera to scan all of the nearby boarding passes (your puzzle input); perhaps you can find your seat through process of elimination. + +Instead of [zones or groups](https://www.youtube.com/watch?v=oAHbLRjF0vo), this airline uses *binary space partitioning* to seat people. A seat might be specified like `FBFBBFFRLR`, where `F` means "front", `B` means "back", `L` means "left", and `R` means "right". + +The first 7 characters will either be `F` or `B`; these specify exactly one of the *128 rows* on the plane (numbered `0` through `127`). Each letter tells you which half of a region the given seat is in. Start with the whole list of rows; the first letter indicates whether the seat is in the *front* (`0` through `63`) or the *back* (`64` through `127`). The next letter indicates which half of that region the seat is in, and so on until you're left with exactly one row. + +For example, consider just the first seven characters of `FBFBBFFRLR`: + +* Start by considering the whole range, rows `0` through `127`. +* `F` means to take the *lower half*, keeping rows `0` through `63`. +* `B` means to take the *upper half*, keeping rows `32` through `63`. +* `F` means to take the *lower half*, keeping rows `32` through `47`. +* `B` means to take the *upper half*, keeping rows `40` through `47`. +* `B` keeps rows `44` through `47`. +* `F` keeps rows `44` through `45`. +* The final `F` keeps the lower of the two, *row `44`*. + +The last three characters will be either `L` or `R`; these specify exactly one of the *8 columns* of seats on the plane (numbered `0` through `7`). The same process as above proceeds again, this time with only three steps. `L` means to keep the *lower half*, while `R` means to keep the *upper half*. + +For example, consider just the last 3 characters of `FBFBBFFRLR`: + +* Start by considering the whole range, columns `0` through `7`. +* `R` means to take the *upper half*, keeping columns `4` through `7`. +* `L` means to take the *lower half*, keeping columns `4` through `5`. +* The final `R` keeps the upper of the two, *column `5`*. + +So, decoding `FBFBBFFRLR` reveals that it is the seat at *row `44`, column `5`*. + +Every seat also has a unique *seat ID*: multiply the row by 8, then add the column. In this example, the seat has ID `44 * 8 + 5 = *357*`. + +Here are some other boarding passes: + +* `BFFFBBFRRR`: row `70`, column `7`, seat ID `567`. +* `FFFBBBFRRR`: row `14`, column `7`, seat ID `119`. +* `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 `928`. + +\--- Part Two --- +---------- + +*Ding!* The "fasten seat belt" signs have turned on. Time to find your seat. + +It's a completely full flight, so your seat should be the only missing boarding pass in your list. However, there's a catch: some of the seats at the very front and back of the plane don't exist on this aircraft, so they'll be missing from your list as well. + +Your seat wasn't at the very front or back, though; the seats with IDs +1 and -1 from yours will be in your list. + +*What is the ID of your seat?* + +Your puzzle answer was `610`. + +Both parts of this puzzle are complete! They provide two gold stars: \*\* + +At this point, you should [return to your Advent calendar](/2020) and try another puzzle. + +If you still want to see it, you can [get your puzzle input](5/input). \ No newline at end of file diff --git a/2020/day05_binary_boarding/src/lib.rs b/2020/day05_binary_boarding/src/lib.rs new file mode 100644 index 0000000..e738961 --- /dev/null +++ b/2020/day05_binary_boarding/src/lib.rs @@ -0,0 +1,86 @@ +use core::fmt::Display; + +#[derive(Debug, PartialEq, Eq)] +pub enum ParseError { + LineMalformed(String), + InvalidRowChar(char), + InvalidColChar(char), +} + +impl Display for ParseError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::LineMalformed(v) => write!(f, "Boarding Pass is malformed: {v}"), + Self::InvalidRowChar(c) => write!(f, "Invalid Character in Row Part: {c} (Should be 'B' or 'F')."), + Self::InvalidColChar(c) => write!(f, "Invalid Character in Col Part: {c} (Should be 'L' or 'R')."), + } + } +} + +struct Pass { + row: usize, + col: usize, +} + +impl TryFrom<&str> for Pass { + type Error = ParseError; + + fn try_from(value: &str) -> Result { + if let Some(partition) = value.find(['L', 'R']) { + let bin_row: String = value[..partition].chars().map(|c| match c { + 'F' => Ok('0'), + 'B' => Ok('1'), + _ => Err(Self::Error::InvalidRowChar(c)), + }).collect::>()?; + let bin_col: String = value[partition..].chars().map(|c| match c { + 'L' => Ok('0'), + 'R' => Ok('1'), + _ => Err(Self::Error::InvalidColChar(c)), + }).collect::>()?; + Ok(Self { + row: usize::from_str_radix(&bin_row, 2).unwrap(), + col: usize::from_str_radix(&bin_col, 2).unwrap(), + }) + } else { + Err(Self::Error::LineMalformed(value.to_string())) + } + } +} + +impl Pass { + fn seat_id(&self) -> usize { + self.row*8 + self.col + } +} + +pub fn run(input: &str) -> Result<(usize, usize), ParseError> { + let mut ids: Vec<_> = input.lines() + .map(|line| Pass::try_from(line).map(|pass| pass.seat_id())) + .collect::, _>>()?; + ids.sort(); + let first = *ids.last().unwrap(); + let second = ids.windows(2).find(|w| w[1]-w[0] > 1).map(|w| w[0]+1).unwrap(); + Ok((first, second)) +} + +#[cfg(test)] +mod tests { + use super::*; + use std::fs::read_to_string; + + fn read_file(name: &str) -> String { + read_to_string(name).expect(&format!("Unable to read file: {name}")[..]).trim().to_string() + } + + #[test] + fn test_sample() { + let sample_input = read_file("tests/sample_input"); + assert_eq!(run(&sample_input), Ok((820, 120))); + } + + #[test] + fn test_challenge() { + let challenge_input = read_file("tests/challenge_input"); + assert_eq!(run(&challenge_input), Ok((928, 610))); + } +} diff --git a/2020/day05_binary_boarding/tests/challenge_input b/2020/day05_binary_boarding/tests/challenge_input new file mode 100644 index 0000000..30f47a7 --- /dev/null +++ b/2020/day05_binary_boarding/tests/challenge_input @@ -0,0 +1,837 @@ +BFBFFFBLRL +FFBFFBFRLR +BBBFFBBRLL +FBFFBBFLRL +BFBBFFFLRR +BFBBFBFRRL +BFFBBBFRRL +BFBBFFBRRL +FFFBFBBLRR +FBBBBBBLRL +FFBBFFBRLR +FFBBFBBRLL +FBFFBFFLRL +FBFBFFBRRR +FBFBBFBRLR +FFBBFBFLRR +BFBBBBFLRL +BFFFFFFLRR +BBFFFBBRLR +BFBFBFBLRR +FFBBFFBRRR +BBFBBFBRLR +FBBFFBFRLR +FBFFFBFLRL +BFFFBFBLRR +BFFFFBFRLR +FBBFFFFRRL +BFFBBBBRRR +FBFBFFFLLR +BBBFFBFRRR +FBFBFBBLRL +FBFBBBFRLL +FBBFBFFLRL +BBBFFBFRLR +FFBBBBFLLR +BFFFBBFRLR +FFBBBFFRRR +BFFFBFFLRL +BFFBBFFRRL +FBFBFFFRLR +BBFBFBBRRL +FFBBBBFRRR +FBBBBFFRRL +FBFFFBFRRR +FBFFFBFLLR +FFBBFBBLLR +BFBFBFFLRR +FBBFBFBRRR +BBFBFFFRRL +BFFBFFBLLR +FBFBFBFRLR +BFFBBBFRRR +FBBFFFBLRL +BBFBFFBRLR +BFBBFBBRRR +FBFBFBBLRR +BBFFFBFRLR +FFBFBBFRLL +BBFFBFBRLR +FBFBFFBRRL +BFFBFBFLLR +BBBFF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BFFFFRRR +FFBFFFBRRL +FFBBFBBRRR +BBFFFFFRLR +BFFFBBFRRL +BBFFBFBRRL +BBBFFFFLRL +BBFFFBFLRR +FBFFBFBRLR +BBFFBFFRRR +BFBFBFBRRL +BFFBFFBRRR +FBBFBBBLLL +FBFFBFBLLR +BBFBFFFLLL +FFBFBFFRRR +BFBFFBBRLL +BBFFFBFLLR +FFBBFBFLRL +BFBFBBBRLR +FBFBBFBRRR +FBFBBBBLLL +BBFBFBFLLR +BFBFFBBRLR +BFFFBFFLLL +FBFFBBBLLL +FBBBBFFLRL +FFFBBBFLRR +BBFFBFBRRR +BBFBFFBLLR +FFFBBFBRRL diff --git a/2020/day05_binary_boarding/tests/sample_input b/2020/day05_binary_boarding/tests/sample_input new file mode 100644 index 0000000..6b89eb8 --- /dev/null +++ b/2020/day05_binary_boarding/tests/sample_input @@ -0,0 +1,4 @@ +FBFBBFFRLR +BFFFBBFRRR +FFFBBBFRRR +BBFFBBFRLL