2024 day-3 as answered

This commit is contained in:
Dylan Thies
2024-12-03 13:00:11 -05:00
parent cd22838062
commit 2e7cda7aa3
6 changed files with 61 additions and 17 deletions

View File

@@ -82,7 +82,6 @@ fn main() -> std::io::Result<()> {
} else {
0
};
// println!("Right: {}, {:?}", right_score, right_part);
let left_part = board[y].iter().rev().skip(x_inv).collect::<Vec<_>>();
let left_score = if left_part.len() > 1 {
let score = left_part
@@ -99,7 +98,6 @@ fn main() -> std::io::Result<()> {
} else {
0
};
// println!("Left: {}, {:?}", left_score, left_part);
let down_part = board.iter().map(|row| row[x]).skip(y).collect::<Vec<_>>();
let down_score = if down_part.len() > 1 {
let score = down_part
@@ -116,7 +114,6 @@ fn main() -> std::io::Result<()> {
} else {
0
};
// println!("Down: {}, {:?}", down_score, down_part);
let up_part = board
.iter()
.map(|row| row[x])
@@ -138,12 +135,7 @@ fn main() -> std::io::Result<()> {
} else {
0
};
// println!("Up: {}. {:?}", up_score, up_part);
let tree_score = right_score * left_score * down_score * up_score;
// println!(
// "({}, {})({}) = {} = {} * {} * {} * {}",
// x, y, tree_from_top_left, tree_score, up_score, left_score, down_score, right_score
// );
scores[y][x] = tree_score;
}
}