Rust
Not too difficult, but my pt1 approach didnt work for pt2. Small amount of tweaking and it was back in action. This should be a really good one for visualisations, so I am definitely going to try do something. Maybe colorise the nodes based on how many paths go through it? Definitely an animation of the trickle down. Looking forward to seeing everyone elses visualisations as well!
spoiler
#[test]
fn test_y2025_day7_part2() {
let input = include_str!("../../input/2025/day_7.txt");
let mut rows = input
.lines()
.map(|l| {
l.chars()
.map(|c| match c {
'S' | '|' => 1isize,
'^' => -1isize,
_ => 0isize,
})
.collect::<Vec<isize>>()
})
.collect::<Vec<Vec<isize>>>();
let width = rows[0].len();
for i in 1..rows.len() {
for j in 0..width {
if rows[i - 1][j] >= 1 {
if rows[i][j] == -1 {
rows[i][j - 1] += rows[i - 1][j];
rows[i][j + 1] += rows[i - 1][j];
} else {
rows[i][j] += rows[i - 1][j];
}
}
}
}
print_tree(&rows);
let total: isize = rows.pop().unwrap().iter().sum();
println!("Total: {}", total);
}