Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Last year I got stuck on Day 12 for a full week, and thinking about how to solve it consumed my every waking moment. I think this year, I'm going to be kind to myself and not participate so I can really enjoy the winter break from work.


What's so hard about Day 12? It's just

    +/'{x:".",x;H:(-1+;1+i-)@'+|\m*i:!#m:x=\:"#."
     R:(x=x)({[h;d;x;y;z](z#0),+\(((-z)_~"#"=x)&z_d>z)*(*y),(-z+1)_y-0^y h}. H)[x]/y
     (*|R)-R@*|0,&1_*+m}.''1({("?"/:5#,x;,/5#,y)}.')\@[;1;.:]'" "\:'0:`:i/12.txt


This is what programming languages looked like to me before I learned programming


I'm doing this year in K2 (after a long hiatus from K). Is there a K4/5 binary? ATW gave me a K2 binary, but I miss some of the K4 and later functionality):

https://github.com/jnordwick/aok2024


I don't know if there's a specific k4 binary but you can run k4 through the q binary.


Any idea how close that is to valid J code?


My limited understanding is that K and J are very different, despite both being in the same language family. I found K a lot easier to grasp when I was playing with both languages years ago.


Is this Q? or k?


It's k4, the underlying language behind Q. With slight modifications it also runs in ngn/k which is FOSS.

https://ngn.codeberg.page/k/#eJxVjsFugzAMhu95iiyWik1CIGPtIVG...


Looks like K to me!


It ate my life for a few years in a row, I even managed to finish on Christmas eve twice. Now I don't even look, it turns from fun to stress rather quickly.


I re-read the intro and the fact it mentions leetcode and the like was enough for me to decide that it's an ultimately pointless endeavour for me.

I have no interest at all in competitive programming or maths; I spend 40+ hours a week doing programming for work, I want games and challenges that pull me away from that so I continue to have a life outside of my job.


For what it's worth, I hate leetcode with a burning passion, have no real interest in math, and yet I personally find Advent of Code quite fun and enjoyable.


I have found AoC fun, but on some of the later days time constraints make it a little stressful (full time job + kids constrain my time).

I've done it (and completed it) the last five years. I used it to try out a few languages (Haskell, Idris, Lean) and did it in python one year I was feeling lazy. I've got a project going now, and I probably should do that instead.

However, that project is a programming language, so this is a way to test practicality. But solving problems and fixing shortcomings in the underlying language at the same time may be a bit too much. (It's a dependent typed language, so there is a lot of subtlety to deal with.)


this strat won advent of code in 2022. https://blog.vero.site/post/noulith


Same, I've been coding for 40 years and I still learn plenty every year.


I find it useful for trying new languages. The first 10 days usually start very easily and progress quite gradually. The 2nd half definitely gets more brutal, but if you do have the self-control, you can stop whenever it stops being productive.


I love it for these meta-type use cases that aren’t necessarily about solving the puzzles.

For instance I’m using it this year to dial in new neovim configs. Last year was to get comfortable with a split keyboard.


Solving the puzzles in a REPL in a dynamic language brings a lot of joy to AOC.

My daily grind is like carefully scaffolding and repainting a 50 storey office building made of typed, modular, spaghetti couples Python ML code.

AOC in ipython, by comparison, is like doodling pictures with a brush pen!

It is very enjoyable and also why leetcode is a little silly for interviews: convince me you can I want to know a candidate can flawlessly paint several hundred square feet of wall, not doodle a cat cartoon.

(Or, away from the analogy, the software equivalents. Can you safely progress business goals as a member of a team on a legacy codebase that’s partly evolving on the cutting edge and also partly rotting on the trailing edge? I don’t care if you can build a naive implementation of our trading system… sorry I mean an Elephant Auction… in 90 minutes!)


How about something creative that is at the same time relaxing?

Some time ago I started creating mods for the game stardew valley. It still involves some programming but mainly drawing, creating animations and composing music! It's an absolute blast and so relaxing (like the game itself).

I think by now I could even start working on my own game but I don't yet have a desire to.


Not the OP but as someone with the same mindset as them:

Sounds very fulfilling, but I explicitly want to stay as far away from tech as possible outside of working hours. I'd much rather draw and compose music outside of any tech environment.

Plus, creative hobbies are an amazing way to connect with people, it's half the reason I like them. Tech hobbies are going to make me connect with tech people which isn't what I want: I meet enough tech people at work, I'd end up talking about tech (languages, frameworks, software, AI...) outside of work which have no interest in, and I don't really relate to tech people anyway (as a sweeping statement that obviously isn't an absolute)


Not OP, but that’s really neat. What’s your process for that? What IDE for the coding? Is C# required? What software for the art?


I started with something called ContentPatcher. It let's you patch game assets and other stuff (including some logic) using a json based DSL.

For more complex things C# is needed as Stardew Valley is made with XNA/MonoGame. There is a NuGet package to set it up which even includes hot reloading of the mod into the running game: https://www.nuget.org/packages/Pathoschild.Stardew.ModBuildC...

I use NeoVim but you can use any editor. It was a bit of a pain to get dotnet going on arch linux but I got it working after some tinkering.

To get started, one can install SMAPI, then unpack the game assets. Then, you can open game maps and assets in the Tiled level editor. I also use Aseprite to make the pixel art tilesets for the maps (LibreSprite would also work). I use a mix of my own tiles and tiles from the game itself for my maps. Music and sound can also be added or patched with ContentPatcher. I make all sound related stuff with Ableton Live. I haven't done much with C# yet but SMAPI provides a pretty nice API so it should be pleasant to use.


An offline version could be an "Exit" advent calendar game. Now that advent has started, you might find them discounted at a local board game shop.

Note it's a single-use game.

https://boardgamegeek.com/geeksearch.php?action=search&objec...

(I don't see any reference to leetcode, but people can approach Advent of Code however they like. I'm certainly not waking up at 5:50 to race for a solution.)


I go in to this not caring how fast I do it, or how far behind I get. It's just an opportunity to learn something and challenge myself a little bit.

At best, I tend to set myself an upper limit for runtime.


I have enough side projects on the back burner as it is. I even picked up a data processing one over thanksgiving.


The don't do it. Thanks for the update though


I have enough fun side project ideas that I want to do. Ones which will also be helpful for me once I’m done with them.


Advent of Code is traditionally parsing heavy and very light on actual mathematics. It’s not very leetcody.

If you have never tried it you should definitely give it a go. It’s quite enjoyable at a moderate dosage.


Only year I ever completed it it took eight months.

I’m not seeing my name on a leaderboard any time soon.


Oh yeah, me neither. The competition is far too intense. What takes me hours takes the competitors minutes.


I actually made somewhat of an effort this time, made sure I was awake in good coding shape when the problem was released. Had a scaffold set up for running the code based on previous years. And I'm a pretty decent all-round coder, should be by now.

Ended up at around spot 6500.

Boggles my mind to even imagine what it would take.


You can see videos of what it takes; Jonathan Paulson makes the leaderboard often with Python and puts videos of him doing it on YouTube; he made positions 25 and 40 on day 1 this year and here is his video: https://www.youtube.com/watch?v=ym1ae-vBy6g


Nice.

I can move that fast, faster even, when I know exactly where I'm going.

I imagine if I was doing this kind of problem solving all day every day it would be possible.


I just do the puzzles until it stops being fun. For me that's usually around day 14.


Goes up and down for me, some I enjoy a lot, some are mostly painful details to get right.


Sounds sensible. It's important to set boundaries, and enjoy time off.

For me Advent of Code is a slippery slope. The difficulty ramps up so at first it's easy, then it's rewardingly difficult. But then before I know it, it takes wayyyyy too much time. The danger is being emotionally invested by then.


There's a graph here of the "hardness" of each day/task, based on how long the 100th place on the leaderboard used. https://aoc.xhyrom.dev/

So it's not linear, and also based on your own knowledge. So perfectly fine to skip some days and still it's possible to solve some of the next ones!


> So perfectly fine to skip some days and still it's possible to solve some of the next ones!

You try telling that to my brain. That guy doesn’t listen to me.


This is why I usually do the simpler ones and then stop... Otherwise, I just can’t skip, it’s stronger than me.


For those just glancing at the chart do note the scale is logarithmic, so the difficulty increases exponentially.


Either the problems are getting easier each year, or perhaps there are just more people participating which drives down the 100th-place times.


There are some "filter" days for sure, usually those are when the solution needs a major leap in your approach such as concurrency, dynamic programming, or geometry equations.


It's usually not concurrency FWIW, it's almost always algorithmic in nature. On a modern machine, even highly concurrent* code would only execute 10-20x as fast and you could just wait a bit.

One common AoC trick is that you can brute-force part one (e.g. O(n^2) complexity or worse), but part two scales up `n` to make that intractable.

*ignore my sloppy conflating of concurrency and parallelism


I agree with you. I don't think either concurrency or parallelism have ever been necessary. In 2019 with Intcode, it was the simplest approach (use multiple threads, one per VM) for a couple days, but it was never actually necessary. You could do the same thing with purely sequential code, but you had to juggle the state of multiple running systems yourself then. Threads were much easier (or coroutines, go routines, processes, etc.; some concurrency system).

And by design, every problem is solvable on decade old computers in a reasonable amount of time (seconds) so parallelism is great if you're looking to minimize the runtime, but it's never necessary.


I very much enjoy the cat and mouse game of assumptions regarding part 2, it always makes me happy when the second part is just a simple adaptation of the existing solution.


Cool, it would be nice if that one aligned the days which were on weekends, as those tend to have harder problems.


If I understand correctly, and I'm not sure if that graph proves that, they try to put longer puzzles on weekends.


Right, Eric Wastl addresses exactly this in his talk. He considers weekends and burnout in the pacing of the event. I think this is the right video: https://youtu.be/bS9882S0ZHs


Ugh, I hate log scales used arbirarily, every silicon valley nerd things it makes them cool like their EE profs teaching actual science or Ray Kurzweil singularity whatever nonsense.


Ray Kurzweil is indeed full of crap (I have a specific bone to pick with his intentional mis-use of life expectancy among other things), but what makes you think in this case the use of log is arbitrary? Did you look at the data with a linear axis? I just tried it, and the vertical space is dominated by 4 or 5 outliers, and on top of that you can’t see the trend as well when it’s linear and all the data is smooshed at the bottom. Log plots are great when your values span many orders of magnitude. That’s true in this case, and the log plot both uses less vertical space, which is nice, and it more clearly shows the trend and wastes less empty space on the small minority of outliers.


I usually make it Monday 18 or 19 and then I loose the will as the time taken is excessive, and obsessing about it is not good. I've finished a 5 years, but all after the fact. Some I am not sure I'll ever finish....


A friend recently shared this with me. I think you'll like it.

https://eli.li/december-adventure


Thanks, I like this.


I got stuck on the graph-cut puzzle for FOUR MONTHS. I had to write a force-directed graphing engine to find the longest three edges to cut.

After I solved it I looked at other people's solutions and they used Meta's proposition solver in about 10 lines. Seemed like a massive cheat to me.


Oh man, this is my best memory of last year's AoC. After uselessly noodling for a while, I used Graphviz to draw the graph to an SVG file. It drew two messy balls of yarn neatly connected by three edges.

My script still says "TODO: find a real solution". Good times.


This was the day 25 problem: given a graph of ~1600 nodes and ~3500 edges, find the 3 edges that if deleted divide the graph into 2 components. I looked over some of the solutions and it surprised me how few used the simplest method: for each edge with endpoints u, v in the graph, delete it and then find another path P1 between u and v. Then, for each edge e1 in P1, delete it and then find another path P2 between u and v. Then, for each edge e2 in P2, delete it and then try to find another path between u and v. If there is no path, (u, v), e1, e2 is your cut-set. Otherwise, add e2 back and try the next edge in P2. When you've exhausted P2, add e1 back and try the next edge in P1. When you've exhausted P1, add (u, v) back and try the next edge in the graph. It's 3-6 loops deep depending on how you count, but it works. My python implementation completes in under 2 minutes, but it varies because it appears the standard python data structures have some nondeterminism, and I may have had a lucky draw with my puzzle input.


I have a self-imposed goal of not using third-party libraries for any of the solve logic. It feels more satisfying to do it myself, even if it takes longer.


Like Minecraft, everybody should play it however they want, it's just a game.

Which one was the "graph-cut puzzle" ? I've had a few where I couldn't do them on the day, either I was busy or I found them harder than usual or sometimes both.

It looks like in 2023 I took until almost New Year's Eve to finish, but until like the 21st of December I was fine, I got thrown off by travel and other commitments in the last few days as they got more difficult.


What solver are you referring to? I've used z3 and OR-tools, but I find it so difficult to model problems in either one that I seldom get good usage of either one.


All things in moderation! Now if I can just make it through the winter without installing the new Factorio DLC...


this comment actually prompted me to finally download and install the factorio demo, been hearing so many things about how it takes over lives! :)


It really is such a great game! I got the base game, beat it a few times, then my partner and I played a few mods, currently in an Angels+Bobs playthrough. So much replay value


So, you want it to take over your life?


No, I want it to be great, and if it takes over lives, then surely it must be great.


I've been playing half an hour each morning before the rest of the family wakes up. Just finally made it to the volcano world


I will probably solve the first 7 puzzles like every year and then just stop.


This is my experience. After the first week I develop an intense hatred of all things Elf and start swearing at my laptop. At which point I give up to stop my mental health deteriorating any further.


One reason I didn't enjoy it was that I felt the days don't build on each other well. So you get little code reuse. It was continually changing requirements, so it was especially like work.


In 2019 he built up about 12 challenges using a VM, for Intcode, you had to construct. It was poorly received because without a working version (developed over the first few Intcode challenges), you couldn't solve the rest of them. He hasn't done anything like that since, though I thought it was probably the more interesting series of challenges.

The problem with continuity across days is that the later days can be blocked by the earlier ones, as they were in 2019. That partly defeats the purpose (or structure) of the challenge, where you can mostly pick any day and try it without regard to earlier days or prior years.


I agree that it wasn't completely well-received, and I think this is a real shame. The stated goal of Advent of Code was always to make better programmers. Extending, maintaining, and testing large systems is an important part of real-world engineering efforts.

I thought the IntCode thing was great and I hope to see something like that again this year.


I agree. Intcode was fun, but completely destroyed the promise of skipping a day and still having fun with later puzzles. I didn't come to enjoy it until much later.


People are skipping days? I usually drop out when I'm stuck on some day. 2019 was my favorite.


Most years I've skipped a couple days and revisit them later. Usually just because I give myself 1-2 hours limit to avoid staying up too late working on them, and unless it's the weekend I don't always have time during the next day to wrap them up. No reason to stop just because of a single blocker.


I can understand that. I think it just points to that the challenge is not for me. It also comes at a time when I desperately want a break or to work on my own projects, software or otherwise.


There's a lot of potential code reuse between years; whether that's good or bad is up to you, I think. (I would personally prefer if my Chinese remainder theorem solving function got less use, but it seems to be called for every year or two.)


We run a private board for Advent of Code for the Carolina Code Conference. Eligibility for prizes starts after earning only 10 of 50 possible stars precisely for this reason.


Oh cool. I live in WNC and had just missed your last conference in August. Is it possible to join multiple private boards? I usually do one with my coworkers as well


Yep. I’m running a little behind but the announcement will come out later today on our site/email list.

https://carolina.codes


You can only “own” one board, but you can join many.


That's awesome. We do the exact same thing for prize eligibility on my work leaderboard. The whole point is for it to be fun and challenging. No need to grind to the end unless you want to.


Likewise. I did it one year in college and it became a life-consuming thing almost immediately. Not AoC's fault - part of it was depression, part of it was the Minnesota winter. Now that I have a full-time job and a wife, I'm trying to be more careful with those things that I know will suck me in.


The year I did it I got lucky and solved them all within a reasonable amount of time until there was one that suddenly involved a lot of nontrivial linear algebra and I immediately spotted that this wouldn't be fun and noped out. Noticed the number of people solving dropped off a cliff on that day.

I think as nerds we need to be quite careful not to get too drawn into this kind of thing. Sometimes it's like a superpower, but other times it just pointlessly consumes your life. Kinda makes me think of gambling addiction: "when the fun stops, you stop".


You can also set a time rule. For me it's 45min, if it takes longer to solve it, I an allowed to quit.

It's totally worth it, though, especially for the first week, when you look up how other people solved the thing you just solved. I always learned (or re-learned) something from that. IMHO there's not that much value in looking up solutions before you solved it yourself, though.


I just have them lingering in the back of my brain the whole year. I solved the last one from last year a month ago. This is much nicer than sudokus or whatever: I sometimes dream about them and I keep finding better (in my mind) solutions for ones from years ago. It's lovely when you sit at another dumb crap meeting/standup so you have something to do in your head.


Ah yeah I've been there! Having done it a few years now, I've found that the approach that works for me is: if it starts looking like I'll be stuck on one for more than a few hours, I'll skip it and move on. Otherwise I'll accumulate an insurmountable backlog that becomes more of a depressing chore to think about, than a fun little christmas tradition. I'd rather have a mostly-complete set of problems by the end of the year that I can come back and clean up when I feel like it.

That said, if you'd have a better holiday season by just stepping back from the computer and relaxing then that sounds great too. Either way - enjoy!


My main complaint the last time I did this (2022) was the havoc it wreaked on my sleep schedule. Advent of Code is not kind to East Coast participants.

Every year except for one has been kind of the same pattern for me:

Day 1: this year, I'm just going to solve the problems. No futzing around.

Day 3: but it would be kind of neat to turn the solutions into a reusable AoC library. Just something minimal.

Day 5: and I should really add a CLI harness for retrieving the problems and parsing the input files.

Day 6: and testing of course.

Day 7: maybe I'll skip today's problem (just for today) and keep improving the framework.

Day 358: oh neat, Advent of Code is coming up.


I'm in CET so time-wise it can be ok - problems open at 6am meaning if I get up I have about an hour around before I need to walk my walk my dog and get ready for work. But switching on at that time is really hard, the amount of stupid off-by-one errors, or referring to since-renamed-but-still-present functions in my Jupyter Notebook is not even funny.

But I luckily managed to avoid the "reusable AoC library" problem around 2019 when a week beforehand I wrote down the sort of functions I wanted to have at my disposal (usually things around representing 2D/3D grids of unknown size and pathfinding/debugging therein, but a few other bits and pieces) and made a simple library that I will sometimes add things to after I'm done with the problem for the day.

I was tempted to some functions (similar to those your CLI harness provided) for retrieving test data and submitting answers but I managed to stop myself short of that! But I am sure you're far from the only one to end up down that road.


I'm in CET too, and 6:00 is not an hour where I’m awake, and if I were, my brain functions would definitely not be at a level where I would be capable of coding.

Midnight would be much more acceptable.


I think you'd be surprised - you'll definitely be capable of coding at that hour. But like me you'd just also be quite capable of making daft mistakes :D


What if you don't get up?


If it's a work day and I don't wake up on time, I'll pick away at it over the course of the day - usually I'll get a chance to think about it on my tram ride to work and complete it at lunchtime

If it's a weekend I'll just do it at my leisure at some point during the day when I have some time - maybe head to a nice cafe or something.

I'm nowhere near the top 100 - closest has been iirc top 200 a few years back - so it's not like I need to start at 6am.


I have trouble fitting this kind of thing in consistently. It's hard with work, chores, family, and then motivation to code after coding at work.


Stay out of my head!


> I can really enjoy the winter break from work

What line of work are you in that you can take a winter break, and furthermore, that you can actually not work during that break? I'm envious...

I've always wanted to do AoC but on top of work it is too much.


I get the week between Christmas and New Year's off and then I take a bunch of my PTO in December. It's not an official break or anything.


Developer here. I'm off from 13 Dec to 6 Jan this year.

PRevious years I've managed basically the entire month of December.

I always have holiday days left over at the end of the year to take.


Lots of people (in tech at least) take time on top of mandatory vacation that can result in like 2 weeks of time.


Heh, I just checked. That's where I got stuck last year, too. I solved the first half.


Hahaha...I love this comment. I have just been stuck for a week doing edge puzzles and backstepping recursion, keeping myself awake aye night because it bothered me I couldn't "just" solve it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: