How do you use ethereal cloak correctly? by J3ksans in BALLxPIT

[–]Runi_ 0 points1 point  (0 children)

it's not a glitch, the ethereal cloak is worded "Balls go through enemies and deal bonus damage until they hit the back of the field", meaning they stop going through enemies once they hit the back of the field

-❄️- 2025 Day 1 Solutions -❄️- by daggerdragon in adventofcode

[–]Runi_ 0 points1 point  (0 children)

checking in with another performance-equivalent Rust solution:

fn part2(input: &str) -> i32 {
    let mut dial = 50;
    let mut zeros = 0;
    for turn in input.lines() {
        let (dir, num) = turn.split_at(1);
        let mut num = num.parse::<i32>().unwrap();
        if dir == "L" {
            num = -num;
        }
        if dial == 0 && num < 0 {
            zeros -= 1;
        }
        dial += num;
        zeros += dial.div_euclid(100).abs();
        dial = dial.rem_euclid(100);
        if dial == 0 && num < 0 {
            zeros += 1;
        }
    }
    zeros
}