Advent of Code 2024 - C#
Objective: Get better at C#.
Dated Jun 25, 2025; last modified on Wed, 25 Jun 2025
Objective: Get better at C#.
| Random Link ¯\_(ツ)_/¯ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Mar 9, 2026 | » | AoC 2024 Day 16: Reindeer Maze
1 min; updated Mar 9, 2026
Data ParsingThe input is an \(R \times C\) grid with Part OneThe reindeer start at | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Feb 28, 2026 | » | AoC 2024 Day 15: Warehouse Woes
6 min; updated Feb 28, 2026
Parsing
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Jan 3, 2026 | » | AoC 2024 Day 14: Restroom Redoubt
3 min; updated Jan 3, 2026
ParsingThe input is a list of all robots’ current positions \(p = (x, y)\) and velocities \(v = (dx, dy)\), one robot per line, e.g., \(x\) represents the number of tiles away from the left wall, and similarly for \(y\) from the top wall (when viewed from above). The top-left corner of the space is \((0, 0)\). The velocity is given in tiles per second. ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Jan 2, 2026 | » | C# Performance Tools
4 min; updated Jan 2, 2026
BenchmarkDotNetSome work projects use To run the benchmarks in the A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Dec 7, 2025 | » | AoC 2024 Day 13: Claw Contraption
7 min; updated Dec 7, 2025
ParsingThe input is a list of machine configurations, where buttons \(A\) and \(B\) move the claw some distance \(X\) and \(Y\), and the location of the prize is specified. Part OneIt costs \(3\) tokens to push the \(A\) button and \(1\) token to push the \(B\) button. What is the fewest tokens you would have to spend to win all possible prizes? ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nov 30, 2025 | » | AoC 2024 Day 12: Garden Groups
8 min; updated Nov 30, 2025
ParsingEach garden plot grows only a single type of plant indicated by a single letter.
This \(4 \times 4\) arrangement includes garden plots growing 5 different
types of plants (labelled The area of a region is the number of garden plots the region
contains. The perimeter of a region is the number of sides of garden
plots in the region that do not touch another garden plot in the same region.
For example, the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Nov 29, 2025 | » | AoC 2024 Day 11: Plutonian Pebbles
4 min; updated Nov 29, 2025
ParsingThe stones are in a line, with each stone having a number engraved on it. The snippet below contains a subtle bug. The SetupEvery time you blink, the stones each simultaneously change based on the first applicable rule in this list: ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Sep 7, 2025 | » | LLM Instructions for Advent of Code Using C#
1 min; updated Sep 7, 2025
The project uses modern C#. The user is an experienced programmer who has been writing C# for a year. Before that, the user mostly wrote imperative object oriented C++ code. Reference concepts from https://learn.microsoft.com/en-us/dotnet/csharp/ where appropriate. Beware of the user writing non idiomatic code, e.g., being too imperative where a declarative or functional programming approach might be better suited. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Aug 23, 2025 | » | AoC 2024 Day 08: Resonant Collinearity
4 min; updated Aug 23, 2025
ParsingEach antenna in the map is tuned to a frequency indicated by a single lowercase letter, uppercase letter, or digit. Two antennas with the same frequency create two collinear antinodes on either side where one of the antennas is twice as far away as the other, e.g.
Antinodes can occur at locations that contain other antennas. Part One requires computing locations of antinodes. Given antennas with frequency \(f\), I need to pairwise match them and compute their antinodes. Being able to group all such antennas is useful for this puzzle. ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Aug 23, 2025 | » | AoC 2024 Day 07: Bridge Repair
6 min; updated Aug 23, 2025
ParsingEach line represents a single equation, e.g., Part One needs to make a decision based on each line independently. Parsing each line into a data structure and yielding that should suffice. Part OneUsing only add and multiply, evaluated left-to-right (not according to math precedence rules), determine which equations could possibly be true. For example, \(292 = ((11 + 6) \times 16) + 20\). Of the equations that could possibly be true, what is the sum of their results? ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Aug 23, 2025 | » | AoC 2024 Day 06: Guard Gallivant
4 min; updated Aug 23, 2025
ParsingThe map shows the current position of the guard with
Part OneThe guard follows a strict patrol protocol which involves repeatedly following these steps: ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Aug 23, 2025 | » | AoC 2024 Day 05: Print Queue
3 min; updated Aug 23, 2025
ParsingThe notation The input contains page ordering rules (pairs of Part OneDetermine which updates are already in the correct order. What do you get if you add up the middle page number from those correctly-ordered updates? ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Aug 23, 2025 | » | AoC 2024 Day 04: Ceres Search
5 min; updated Aug 23, 2025
ProblemThis word search allows words to be horizontal, vertical, diagonal, written
backwards, or even overlapping other words. Here are a few ways The actual word search will be full of letters instead. For example: ParsingFor \(M \times N\) grids, C# has multi-dimensional arrays. These differ from jagged arrays, whose elements are arrays with possibly different sizes. In memory, multi-dimensional arrays are laid out as 1D arrays. When processing array data, cache locality impacts performance. If the computation needs to access multiple rows (e.g., image convolution, this problem), then multi-dimensional arrays offer an advantage. If processing row-by-row, then jagged arrays will also have cache locality. However, if the array is larger than 85Kb, then it ends in the large object heap, which is slower. ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Jul 2, 2025 | » | AoC 2024 Day 03: Mull It Over
3 min; updated Jul 2, 2025
DataThe computer appears to be trying to run a program, but its memory is corrupted. All of the instructions have been jumbled up! It seems like the goal of the program is just to multiply some numbers. It
does that with instructions like However, because the program’s memory has been corrupted, there are also invalid
characters that should be ignored, even if they look like a | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Jun 30, 2025 | » | AoC 2024 Day 02: Red-Nosed Reports
4 min; updated Jun 30, 2025
DataThe unusual data consists of many reports, one report per line. Each report is a list of numbers called levels that are separated by spaces. For example: To parse: Part OneThe Red-Nosed reactor safety systems can only tolerate levels that are either gradually increasing or gradually decreasing. So, a report only counts as safe if both of the following are true: ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Jun 25, 2025 | » | AoC 2024 Day 01: Historian Hysteria
4 min; updated Jun 25, 2025
Day 1 - Advent of Code 2024: Historian Hysteria.
Eric Wastl.
DataThere’s just one problem: by holding the two lists up side by side, it quickly becomes clear that the lists aren’t very similar. Maybe you can help The Historians reconcile their lists? For example: To parse the input: ... |
Why doesn’t dchege711/blog@3483b54 add hyperlinks in
.cscode comments?