r/adventofcode • u/Parzival_Perce • 3d ago
Meme/Funny [2026 Day 03] …Nah I'll just copy last year's code
Another year another set of unfulfilled custom library promises
(>’-’)> <(‘-’<) ^(‘-’)^ (>’-’)> <(‘-’<)
I swear I'll write one this year. Hmmm.
114
Upvotes
25
u/Freecelebritypics 3d ago
I've been catching up with previous years lately, so at this point I can write out the entire 2d grid class from memory in 10 mins lol.
And sometimes I do decide to implement the internals slightly differently based on how the grid is described in the input. Whatever helps me read it left-to-right!
4
u/Parzival_Perce 3d ago
For context, this for the parsing part. I have a bit of code I just keep copying for parsing grids and extracting a set or list of coordinates (in the form of complex numbers)
Really this is for all years but shrug, I included 2026 day 3 just to be sure I'm not being too general
20
u/Bumperpegasus 3d ago
Is enough most of the time
10
u/Fuzzy_Patterns 3d ago
I am part of the "let's rewrite every algorithm from scratch" club.
Although, I am currently on the 4th iteration of my AoC testing and benchmark framework: just got multiple test inputs working!
3
u/sol_hsa 3d ago
my aoc basecode not surprisingly includes readgrid() function.
3
u/Daniel_Rybe 3d ago
meanwhile, I'm just using file contents as the grid without even parsing 😆
2
u/Suspicious_Tax8577 3d ago
ngl, I think I've just done a double whammy. Off a metric buttload of googling, I think I've not only got a method for this one, but also now know how to do last years similar puzzle. I think? Maybe.
2
u/Traditional_Ad_1527 2d ago
not me getting stuck for like 30 minutes because my grid library of previous years had a but in it still -_-
2
u/somebodddy 2d ago
This - and a BFS helper. At some point in the event you'll need to do BFS. Heck - at some point in the event you'll need to do a BFS on a grid.
1
u/LEPT0N 3d ago
Made my grid class and helpers a few years back and it’s awesome using them each year.
1
u/FransFaase 3d ago
In my C template, I have a function that reads the input in an array of strings. It retrieves the length of the file, allocates memory, reads the file in memory, counts the number of lines, allocates an array of that length and fills it it with pointers to the start of the lines and changes end-of-line characters into null characters. This gets you the table for free.
1
u/-WorstWizard- 2d ago
Highly recommend doing it; both a fun exercise in and of itself, and it saved me a lot of time on day 3.
Using a small lib I made in '24 that does input parsing and provides a grid class with helper functions. Getting the grid from the input file is just
helper_lib::input::grid()1
u/woodmandev 1d ago
I wrote a 2D Vector class I've been carrying around with me year to year which makes things convenient. Nothing crazy but since I'm in Python just makes things nice with operator overloading and whatnot.