▲ 1 r/adventofcode
[2025 Day 1 (Part 2)] [C++] Where have I gone wrong?
I have never struggled with a Day1 like this before, so I'm a little embarrassed to have to ask for help. Here is the code I have tried:
The definition of a 'Turn' is:
class Turn {
public:
int clicks;
Direction dir;
Turn(char d, int c) {
switch (d) {
case 'L':
dir = Direction::Left;
break;
case 'R':
dir = Direction::Right;
break;
}
clicks = c;
}
};
My solution for Part1 worked so I am reasonably confident the input is parsed correctly, and my part2 solution (pasted above) works on the example provided. Where have I gone wrong?
Edit: I needed an abs() call. Thanks for the help!! Updated code: Part2 Corrected
Don't code on an empty stomach!
u/toxicliam — 7 days ago