diff options
Diffstat (limited to '2023/rs/code/four')
-rw-r--r-- | 2023/rs/code/four/src/main.rs | 5 |
1 files changed, 2 insertions, 3 deletions
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() }); |