summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--2023/rs/code/four/src/main.rs5
2 files changed, 3 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 7aef303..7e2068a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -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()
});