Day 1 - Calorie Counting #1
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 inProgram.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 returnsvoid
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 usingwatch
since the working dir become inconsistent.