Apart from day 4 not much to visualise so far this year :/
it all fit in int64 tho, so could be worse
constexpr u32 TEN = 10;
constexpr u64 TWELVE = 12;
I love the easter egg jokes you add to your code :)
Computer science is just mathematics, you can do it with pen and paper. The actual IT jobs where you don't have to touch windows are plentiful, although it might be a bit of a red flag if you're vehemently refusing to touch some specific software (be it windows, or any other program, or programming language).
so many years have passed since i last wrote a line of masm...
ah that’s just because i needed rounding towards infinity and not towards zero. In other words i wanted -10/100 to be -1 and not zero. But i couldn’t figure it out on the spot, so i just made it never negative :)
Thanks! I don’t mind tips at all.
the idea is that crossing the zero is easy to detect by dividing the total dial movement by 100. I.e. if you cross from 120 to 90 you will detect that 120/100=1 changed to 90/100=0. The only case when this doesn’t work is when you stop at zero going in the negative direction, hence the extra if
you could say that, yeah, it downloads the inputs, submits the answers, and keeps track of wrong answers. You can grab my entire repository here: https://github.com/hades/aoc25/tree/master
Rust
#[derive(Default)]
pub struct Day1Solver {
input: Vec<i64>,
}
impl Solver for Day1Solver {
fn presolve(&mut self, input: &str) {
self.input = input
.trim()
.split("\n")
.map(|line| {
if let Some(n) = line.strip_prefix('L') {
-n.parse::<i64>().unwrap()
} else if let Some(n) = line.strip_prefix('R') {
n.parse().unwrap()
} else {
panic!("what: {line}");
}
})
.collect();
}
fn solve_part_one(&mut self) -> String {
let mut p = 50;
let mut count = 0;
for n in self.input.clone() {
p += n;
if p % 100 == 0 {
count += 1;
}
}
count.to_string()
}
fn solve_part_two(&mut self) -> String {
let mut count = 0;
let mut p = 1000000000050;
for i in self.input.clone() {
if p % 100 == 0 {
count += (i / 100).abs();
} else {
count += ((p + i) / 100 - p / 100).abs();
if i < 0 && (p + i) % 100 == 0 {
count += 1;
}
}
p += i;
}
count.to_string()
}
}
It uses Gemini on web or else it gets the hose again.
That's day 7, right?