diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | 2023/rs/code/four/src/main.rs | 5 |
2 files changed, 3 insertions, 3 deletions
@@ -1,2 +1,3 @@ target *~ +src/bin diff --git a/2023/rs/code/four/src/main.rs b/2023/rs/code/four/src/main.rs index 7508e4a..328d84a 100644 --- a/2023/rs/code/four/src/main.rs +++ b/2023/rs/code/four/src/main.rs @@ -9,11 +9,10 @@ fn parse_val(s: &[u8]) -> u8 { } fn main() { - let valueified = INPUT.split(|b| *b == b'\n').filter(|s| !s.is_empty()) + let valueified = INPUT.array_chunks::<117>() .map(|b| { let win: u128 = b[10..40].array_chunks::<3>().fold(0, |a, b| a | (1 << parse_val(&b[0..2]))); - let valiter = b[42..].array_chunks::<3>(); - let val: u128 = valiter.clone().fold(0, |a, b| a | (1 << parse_val(&b[0..2]))) | (1 << parse_val(valiter.remainder())); + let val: u128 = b[42..].array_chunks::<3>().fold(0, |a, b| a | (1 << parse_val(&b[0..2]))); (win & val).count_ones() }); |