Skip to content

Day 1 - Calorie Counting #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2022
Merged

Day 1 - Calorie Counting #1

merged 1 commit into from
Dec 1, 2022

Conversation

shadeon
Copy link
Owner

@shadeon shadeon commented Dec 1, 2022

Pretty simple day 1 this year thanks to the use of LINQ. One of those challenges where making it testable (via adding the Day1 class rather than just having three methods in Program.cs) almost triples the line count.

Whilst doing part 1 the whole thing was telegraphing "part 2 is going to care about the calorie sets/elf ordering, don't discard them", but in the end the gamble paid off and I didn't need to break out the Sum projection into a separate step. Knowing Advent of Code I'm sure I won't be so lucky in future days.

I'm quite pleased with the generic method I added to clean-up the initialization of a stack with a single member. Sometimes I really miss objects that were designed with a fluent syntax in mind (in this case, the Push() method returns void rather than the Stack itself).

Also went back and forth a couple of times on where to store the sample and input files, as various locations would break the various dotnet commands when using watch since the working dir become inconsistent.

@shadeon shadeon merged commit afbde3f into main Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant