I love AoC! Did it the last 2-3 years in Rust, hanging out in a discord where we all try to make the absolute fastest solutions. Learnt all kinds of crazy performance hacks and some advanced algorithms & SIMD that way.

This time I'm trying to do them in Rust and Golang in an effort to either learn to like/tolerate Golang (because we use it at work) or prove my hypothesis that it sucks and never use it unless I have to.

I've used Go in the past few years (but I never find the time / attention span to get any further than day 6), I really like it for this kind of thing because it's pragmatic, minimal environment setup / "sidequests", most things you need (reading/parsing files, etc) are builtin, performance is great and close to the metal (few hidden performance pitfalls), etc.

I can't compare with Rust though because I've never used it. From a very superficial point of view though, it feels less pragmatic. But since AoC doesn't need memory safety or whatever criteria you have for production software, pragmatism and performance for later challenges are more important than safety.

Interested by your rust speed approaches, care to share a link ?
Same. I am doing rust + clojure this year. Very interested in performance hax, esp around SIMD. I know absolutely nothing at all about rust, this is my first time working with it.

My day 1 rust solution:

    cargo solve 1 --
    release
        Finished `release` profile [optimized] target(s) in 0.05s
        Running `target/release/01`
    Part 1: 1189304 (95.8µs)
    Part 2: 24349736 (120.4µs)
Day 1 clojure solution:

      lein run 1
      running all tasks for day 1
      reading input from resources/day01.txt
      running day 1 part 1
         part-fn: #'aoc.day-01/part-1
         took: 5.511375 ms
         result: 1189304
      reading input from resources/day01.txt
      running day 1 part 2
         part-fn: #'aoc.day-01/part-2
         took: 1.822334 ms
         result: 243497365
Code here: https://github.com/whalesalad/aoc
There's a Rust solution posted in the Reddit Day 1 answers mega thread which claims 22 microseconds part 1 and 10 microseconds part 2. (I haven't tried to verify):

https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_...

Can't edit my comment, here's another claiming 12.7 μs and 7 μs:

https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_...

Another claiming 30μs and 32μs:

https://old.reddit.com/r/adventofcode/comments/1h3vp6n/2024_...

For an interesting comparison, here's BQN, an array language, at 25.5μs (on an i3-4160) for both parts, including input parsing:

https://github.com/dzaima/aoc/blob/master/2024/BQN/1_fast.bq...

That's very impressive.
Sure but how long did it take to compile
I 'git clone' and 'cargo run' and it downloaded 16 crates and compiled all the crates and built a debug version in 29.7 seconds.

Then 'cargo build --release' took 23.3 seconds.

Commenting out one of the sort_unstable lines and rebuilding gave me a warning, recompiled in 1.8 seconds.

I do AoC first time and use it to try a functional LISP like language (Clojure).

Though it is just a beginning and maybe it is a matter of habit,but I should say, that reading LISP family language is so difficult for my brain.

It takes a while. But if you continue to practice, it will eventually click.
Are the timings with language runtime startup, or only the procedure calls of the actual code?
Just the individual part1 and part2 functions. At least on the Clojure side, I made the runner. For the rust side I’m not sure I’m using a template project that does that containment.
'd you be interested in sharing the discord? :)

I try every year to optimize for speed in zig: https://github.com/ManDeJan/advent-of-code

This server seems to be active, although they are all unofficial servers from enthusiasts.

https://discord.gg/wYmyYsf

Go (not "Golang") has better compilation times than Rust and does not try to combine incompatible ways of using concurrency.

I have the opposite dilemma to you, I want to learn to like Rust.

Personally I loathe golang for the sheer fact that it was created recently enough to have included a much better design. Old languages get a pass.

Rust to me is what a modern take on a systems language would be. I think it’s substantially better than go.

To be fair, Go was never a proper "systems language" (and shamefully attempted to redefine what the term means).
I don't think it attempted to redefine the term, but "web" was left off the beginning of the phrase. Go's primary strength is in creating distributed, concurrent services and other networked systems. This makes sense as a language born within Google, though like any language it can be used for other purposes.
Let's try to settle the Go/Rust debate in this AoC sub-thread ^_^
Let's mix in some tabs/spaces and vim/emacs too, and we've got a stew going!
Personally I like them both but I find the barrier to onboarding new devs is lower for Golang.

/s

  • GTP
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
What's Go, if not Golang? I mean, there's some other programming language called Go that I don't know about?
Yes, "Go!" came before "Go".

But regardless of this, the name of the Go programming language is "Go" and not "Golang".

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
How do you structure your aoc project?

I tried doing Rust, but I'm too dumb to figure out if each day should be a module or if I should use lib (I guess?) files for each day and link everything to a main entry point.

Can you share your repo (if public)?

Take a look at my repo - http://github.com/nindalf/advent-2024

Each day is a new module, this way I don't have to think of new names for part1() and part2(). I can still import code from the rest of the crate if I want with `use crate::`.

If you like this style of structuring the project, you may be interested in the generator I use for it - http://github.com/nindalf/aocgen. `aocgen --day 2` will create these files and save you a bit of time. It will even download your problem input if you give it your adventofcode.com cookie.

Also check out https://codspeed.io/advent/day/1 for other Rust solutions that are aimed at being fast. They all use the same project structure. I wouldn't read the top 20 solutions though, they sacrifice readability and idiomaticity for speed.

Looks pretty neat I'll take some inspiration from this.

Though you shouldn't upload the text and inputs of the puzzles (maybe .gitignore them) as per [0]:

> Can I copy/redistribute part of Advent of Code? Please don't. Advent of Code is free to use, not free to copy. If you're posting a code repository somewhere, please don't include parts of Advent of Code like the puzzle text or your inputs. If you're making a website, please don't make it look like Advent of Code or name it something similar.

[0]: https://adventofcode.com/2024/about

I'm usually a rule follower, but this is a rule that I choose not to follow. I have a couple of reasons:

- I've spent effort on this, and I want the repository to work in future. I want to be able to clone it and run all the code without having to fetch the input once more, even if the site is unavailable. (I actually do this while benchmarking new hardware).

- I don't think it actually hurts the creator in any way, in my opinion. Here's an example: At least 660 people have uploaded inputs from 2022 (https://github.com/search?q=%22closest+beacon+is+at+x%22+pat...). These files have been up for 2 years. Exactly what injury has the creator suffered because of this? Are there people out there thinking "nah, it's too much effort to log into adventofcode.com, I'll just trawl GitHub repos for inputs and figure out what I'm supposed to do from there"? Obviously not.

So I have a compelling interest, and the creator hasn't articulated a good reason to avoid it. If he's able to articulate a good reason, then I'm willing to reassess my stance on this. He has my sympathy and full support if someone creates a lookalike site with the same puzzles and inputs but different CSS and without ads. That would be messed up. The potential injury is clear - he'd be losing users to the lookalike.

This is a subject of some controversy in the AOC community, but nothing I've read in those threads so far has been compelling. Anti-storage arguments usually just come down to "he's asking nicely so please comply". To which I politely respond that I don't accede to every polite request that comes my way.

I use a private submodule (hosted on my own infra) for the inputs, which addresses point 1. But I get where you're coming from.
That's smart! I'll probably do this too when I'll publish my AoC code
Is there a discord every year? Interested in joining that if you don’t mind sharing
Sounds like a very interesting Discord to check :)
[flagged]
This years challenge for me: write it in C without the standard library or an allocator. Has to be runnable on an STM32 with 32kb of SRAM.

I tried doing it in Assembly two years ago, ended up spending hours and hours writing an Assembly standard library, then gave up and switched to Rust...

Last year I tried C on a real Amiga 1200 (using DICE, Matt Dillon’s compiler / runtime). I didn’t get very far, lack of memory protection makes things really hard.

This year the Amiga has an 060 upgrade with an MMU, so perhaps I can figure out how to use that and have another go.

Forgive the dumb question... it's been ages since I've done Amiga programming in C. What behaves differently? Is the lower K of memory mapped, such that null pointer deferences cause excitement rather than simply crashing your program? Or is it something else?
AmigaOS has no memory protection whatsoever. If your program crashes, so does the entire machine. And it will possibly bring your hard drive with it, too.

Not unworkable, but not the most relaxed environment for fast’n’fun cowboy coding. You typically have to reboot a lot.

I thought the Amiga 1k had page protection, just not virtual memory?
  • snvzz
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
No MMU.

A1000 has... something. The WORM (write once read many), RAM used for the kickstart, which is latched as read-only after the kickstart has been loaded from floppy by the bootstrap ROM.

No, there's no MMU.
Well, apparently if your CPU has one (030+) you can use something like Enforcer (http://www.sinz.org/Michael.Sinz/Enforcer/). I’ve yet to try it.
  • snvzz
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I don't get it either, particularly as most advent challenges can be solved using just iso c and its standard library.
> I didn’t get very far, lack of memory protection makes things really hard

What was the issue with lack of memory protection? If you're used to programming in C is there actually that much difference to running on a modern PC or embedded system?

Heh. Yeah, a memfault tanking the machine is not conducive to iterative programming :o)
Just stop writing memfault.

I say it in jest but that's actually how I used to program a few years ago when I was working on large industrial pieces of software with long compilation time. You just have to be careful and check what you wrote before sending it to the machine.

I think "iterative" programming has made people really complacent when it comes to silly errors. Slowing down can often do wonder.

I feel like if you're writing C then writing with memory safety in mind should probably be autonomous anyway
  • rob74
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Honestly, I forgot all about that aspect of ancient programming. It probably made one more careful, or more patient. (Source: typing 6502 programs into a hex "monitor" which is a way to edit memory, view memory, and issue "jump to this memory address".)
Good luck! Personally, I'm still going with CL but decided to try it in all the languages I "know" for the first day. Including C which doesn't have hash tables (inb4 hsearch)... what a pain, let me tell you.

https://git.sr.ht/~q3cpma/aoc2024/tree/master/item/01

If you could post a repo link so I can look at some of the progress, I'd be grateful.

I just want to note that Quake 3 CPMA is one of the best games ever made. No idea if the handle is in reference to that, but thanks for the :)
Perhaps it’s a reference to the Kraftwerk song?

https://www.musixmatch.com/lyrics/Kraftwerk/Boing-Boom-Tscha...

POSIX `hsearch` is absolutely terrible and almost useless, but... it would get the job done for this problem.
The advantages of foregoing hsearch is that I don't have to understand its weird API that works only for NUL-terminated string keys and that I don't require POSIX.

Remember that brute force is also a solution in the AoC; had plenty of fun using SBCL to crack some problems where Pythonistas had to be clever, last year =)

I don't think there are enough entries to make it worth the cost of a hash. I know it's not "efficient" exactly, but just repeatedly looping through and counting just isn't that slow.
  • 9029
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
The numbers are so small that you can also just use a big array
- bsearch + qsort is a great way to implement associative tables

- you can implement a hash table in C in about 125 LOC and reuse it.

- hash tables are not the only way to solve problems. hammer/nail

Also the TclHash table implementation is quite good and independent of the Tcl interpreter runtime.
> bsearch + qsort is a great way to implement associative tables

Only if you write/read your table in two separate passes. A tally needs mixed read/write to increment a counter, not just insertion, so it must be kept sorted during the table creation. Some kind of tree or linked list is probably better in this case.

> you can implement a hash table in C in about 125 LOC and reuse it.

I know. Anyone who uses C and never made at least a basic FNV1A/bucket-based hash table must be insane. But I wanted a small self-contained .c here and have become allergic to (void *); if I were to use C seriously, I'd fix it using a better preprocessor (à la https://github.com/etwyniel/c-generics).

> hash tables are not the only way to solve problems. hammer/nail

Eh, a tally seemed the most intuitive way for the 2nd part.

> incremental insert vs two pass

Insert each element in its sorted position. It will only degenerate if there are many more inserts than lookups, in which case a hash table would do nothing for you.

This could also be a good case for a radix structure.

> void* hash table

I would stay far from poor implementations of high level languages. Why use C if you want generics?

A reusable hash table can be implemented by implementing open addressing with 64 bit integer keys. Then if you have a fancy type you write a hash function and perform linked list chaining on the values.

Another way is to treat the keys as byte arrays.

> seemed the most intuitive way for the 2nd part.

Intuition is a kind of familiarity. There is no reason to learn C if you just write the techniques you already know in a less safe and more verbose way. You instead should be learning a new way to think about problems.

Your restrictions sound quite challenging, good luck!

Last year I solved all the problems in C without external libraries [1] and I enjoyed it a lot. It forced me implement some low-level stuff that I had forgotten how to do (e.g. a heap) and to write some numerical routines myself (easier than you'd think!).

[1] https://github.com/sebastianotronto/aoc/tree/master/2023

Fitting, given that iirc one of the problems was to implement a hashtable!
  • foota
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
As long as you can make an RPC call, anything is doable within 32kb of ram :-)
Symmetrically, I would consider only using sh and standard non-Turing-complete CLI tools (grep yes, awk no). About as limiting, but without devastating memory corruption bugs.
Awk is turing complete. You could do the challenges only in Awk if you wanted.
That would be too easy! :)

Well, awk suffices to write a first-person shooter: https://news.ycombinator.com/item?id=34442528

I think there might end up being some problems which will be very challenging to solve with those resource constraints - namely memory. You will probably have to be pretty clever with your solutions.

I remember one of my naive brute force solutions from last year ended up allocating gigabtyes of memory. There were obviously more efficient solutions, but some of the inputs are pretty large and so hefty allocations might be difficult to avoid.

Yeah I know it will be tough.

I do allow myself a 5Gb disk to which I can page out memory.

How does that work irl? Do you have an SD card attached?
I tried doing it in C a few years ago but wasted so much time just not having a string library
Assembly is so much cleaner on an STM8 8-bit. If you’re into that sort of masochism
  • mlsu
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Glorious!

I think I'll follow in your footsteps. STM32F7 with 320k but with bare metal Rust :)

this is like trying to solve it in a computer built in turing complete
  • 127
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Do you have a public repo?
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I usually do AoC in Common Lisp, but this year I'm giving Swift a chance.

It's not half bad at this kind of twiddling for being a statically typed mainstream language.

https://github.com/codr7/aoc24/tree/main/swift/Sources/aoc

This year is a tiny bit weird, I was just getting ramped up organizing the event at a new job; because I think it's very useful for devs to learn some real problem solving, as opposed to stitching frameworks.

And then I had to leave because my new boss turned out to be someone I couldn't imagine working with.

Guess it'll be just me and Emacs as usual.

Excellent! Come and join the Swift leaderboard here https://forums.swift.org/t/advent-of-code-2024 if you haven't already -- it's super interesting to compare different solutions.
dont you find all the string parsing and manipulation to be quite painful in Swift? I tried to do AoC in Swift before and that put me off a lot. I liked doing little functional one liners but a week from now the parsing burden will be too high.
I found the Scanner API (1) to be pretty handy for the more complex parsing in past years.

It’s Foundation so hopefully also on Linux/Windows, but if not there’s also one on GitHub called SwiftScanner.

1: https://developer.apple.com/documentation/foundation/scanner

I program everyday in Swift. I attempted AoC for the first time in Swift last year and gave up after about a week or so for this exact reason and switched to python for the remainder. I don't want to struggle with the awkward string API to do things other languages can do in a line.
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I'm curious, any specific examples you can remember?
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Nah, the String type is fine as far as basic functionality goes, I like adding my own convenience stuff in extensions.

The language has been moving pretty fast though, I have a feeling a lot of features I find useful are relatively new.

I enjoyed reading your solutions! I’m surprised how terse they are!
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Lovely! I try to strive for readability first and foremost, which is a challenge in itself.
Are you writing the solutions / compiling / running all with Emacs? I wanted to try Swift this year as well but feels sort of silly spinning up XCode for this.
You can use VSCode with a swift project created with the SwiftPackageManager (SPM). I find the experience to be good, with a good LSP support. I just have to sometimes trigger the build task for it to find newly defined objects.

That is if you have nothing against using VSCode.

  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Yep, on Linux, or WSL to be exact, I just use the internal shell though.
Ah here it is again, 25 days of writing increasingly complex input parsers.
Those are the problems I loathe the most, where the real problem is figuring out how to parse the input into something more workable. Once its parsed its ezpz.
Are you solving all puzzles? I find usually that the parsing isn't my problem, but some of the puzzles puzzle me (ha, couldn't resist), because they expect some kind of graph knowledge or some mathematical trick or so. Last year got stuck at day 17 for example. Usually some learning in it then, but parsing, while possibly annoying day after day, wasn't usually what stopped me from completing puzzles.
  • 63
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
After a few days I cave and just use regex, which I of course forget every year and need to relearn.
Hahahaha, this is so true. Regex is so easy to forget.
the input parsers don't get increasingly complex over the days. The problems themselves do. Even on the most difficult days around 22 or 23, the inputs are all just lines of space separate ints or some grid of points or something, just like the trivial problems on days 1-3
From last year: hot springs, the pipes problem, gears, pulses, range math.. half the problem is turning the text input into the correct data structures to solve it.
yes, that kinda is what the reality of programming is. Correctly representing the problem so that the solution easily follows. Various famous people have various quotes about this, for example Rob Pike: "if you've chosen the right data structures and organized things well, the algorithms will almost always be self-evident".
AoC used to be more fun than that. I already have enough reality at my day job :)
It's input parsing with a fun story
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
i find ScanF and state machines are a lot more effective than split / explode style parsers.
  • fdrs
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Rust + nom makes it easier
Why isn’t the input a csv?
Sometimes it is, or very nearly is.
  • akx
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
... and inevitably, a virtual machine
Claude will do it for you.
What is the point in doing a programming challenge if you aren't learning anything
Depends if you're really stuck on a problem. I'd rather learn by getting a look at how it's done, even if the code is incorrect, than be completely suck with no idea why or what to do.
Being stuck with no idea why or what to do is what gets you exploring and figuring things out. That's the whole point...
That all well and good until you hit a brick wall you cannot pass. At this point a helping hand and/or the answer is the only way forward or to learn.
> you cannot pass

This is his entire point: getting to this brick wall is _where_ the real learning happens. When you start scrambling, reading old stackoverflow posts, and breaking out the calculus text book you're pushing the boundaries of what is possible for you.

Body builders don't grow by watching other people lift weights.

That isn't an accurate comparison. Asking an AI is functionally equivalent to searching the web. Your comparison is like saying you can't get strong by filling up the buckets you have handy with water and lifting them, you have to do what real bodybuilders do and lift weights. Whether I'm researching the answer using a search engine or an AI prompt, the result is the same.
Agree to disagree.

Don't see any difference with finding the answers on SO, or in textbooks, and having an AI provide the same.

And at the start, novice body builders will of course watch other body builders to learn how it's done.

Unless you're exceptional you're not teaching yourself anything unless it's by learning from others. Few are the pioneers in any field.

How do they become pioneers? By digging into the body of knowledge. They know what books and authors are good, what blogs to read, they posted questions on SO. They don't search for direct answers, but instead they search for the knowledge that allowed the person who made the question to make the question, and person who found solutions to find the solution.

Looking how it's done doesn't equal you doing it. It's apples to oranges. OP was referring to needing to do work in the gym to get results. You didn't get results if you looked at others and did the same in the advent of code etc. You are merely entertaining yourself, but you are not competitive participant. With that approach you'll never be on top.

There are people who use frameworks and people who write frameworks. The first group struggles when there is no official documentation or tutorial on a topic they need. The second group when faced with the same goes through the source code and gets the answers.

Bottom line is the question of what you want to achieve - just go through the problems and be done with them, or deep dive into new topics ans material, to widen your knowledge?

I don't see much to disgree with in what you're saying. Were clearly talking about different things.

What happens when you dig in and exhaust all your best efforts and still don't find a solution? Are you a lost cause because you couldn't figure it out for yourself? Or are you allowed to be shown the way it's done so you can learn from that?

Many times in my life have I not been able to figure something out for myself, and needed shown how the thing was done. Just because I couldn't do it on my own doesn't mean I wasn't capable of either doing it once shown, or that by being shown I didn't learn anything.

Honestly use the gym analogy again:

You've spent the last hour trying to curl the 50kg dumbbell and you just can't do it. You walk up to the yolked out guy and ask him to show you how it's done, he picks up the weight and curls it with ease.

At this point its not really fair to say you curled those 50kgs, and you didn't get much out of the experience. Maybe you noticed something about his technique that helped, or he gave you some pointers, but you still can't lift the weight by yourself even with that information.

Now if you instead went back and trained some more at lower weights not only would you get more out of the experience (in terms of growth), but also seeing someone else do it is more beneficial since you can try it again yourself and directly apply what you just learned. Eventually with enough training at easier weights and progressing naturally you'll be able to lift the 50kg weights. But that one curl you're now getting to do for the noobie is in no way indicative of the time and effort you actually put in to be able to do that one curl.

Now if you're instead in a warehouse doing your job moving heavy boxes from A to B getting the yolked out guy to help you isn't that bad - sure you can't do it in the future but all that matters is that it was moved from A to B. If we take that same mindset into the gym we'll get nowhere since the gym isn't about moving something from A to B, it's about making you better at moving something from A to B.

I think this is where your analogy falls apart.

Sometimes being shown the answer to a problem is just what you need to move forward, especially if you are inexperienced. Shown the answer with an explanation as to how you get to it is better.

I think the difference between the textbooks and AI is that the AI can answer exactly your question without providing the necessary context/reasoning behind how it arrived there.

When you are drawing connections between SO posts, textbooks, whatever you do a fair amount of reasoning yourself.

Now that I think about it it isn't AI specific (more knowledge specific) - I'd say the same if you wait a few hours and then look up the AOC solutions on github. Sure you'll have "solved" the problem but you never spent the time to actually figure out the solution.

> And at the start, novice body builders will of course watch other body builders to learn how it's done.

"Learn how it's done" - not get bigger. This is the important difference. If those novice body builders watched others and learned how its done without putting in the reps themselves they'd get nowhere.

Say I have no idea how to complete day 12 of AoC. Racked my brains, done some searching, researched as best I can, can't find anything that makes sense. I'm stuck.

By your logic I would gain absolutely nothing, learn nothing, but either looking up the answer or getting AI to give me the answer. I don't accept that.

Reason being? I've been in the exact same situation. Guess what, I learned different approaches to the problem I could not solve. I improved and can now solve similar problems as a result. Is it cheating? Maybe. Do I care? No. Why? Because I'm not doing AoC for the struggle, I'm doing it for fun, and I know my limits too.

But if you want weights lifted, you don't use bodybuilders.
Consider looking at the solutions threads on Reddit instead - that way, the code you're looking at isn't broken in ways you don't know enough to spot.
I think in that case you can only guarantee that the code you're looking at isn't broken in some ways neither I or the author on Reddit know enough to spot.

If Claude generates it and it produces correct output for the challenge but is subtly broken on some edge case not in the challenge input, how is it difference from pulling some code from Reddit that produces correct output for the challenge but is subtly broken on some edge case not in the challenge input?

Maybe I'm interested in solving the algorithmic problem and less interested in writing input parsers...
Here's your opportunity to learn something: Different people can get enjoyment from the same thing in different ways, and you can learn things about data structures and algorithms without learning the syntax of a particular language to implement them.
You don't need an ai to do any of that.
But you can use an AI to do all of it effectively. What's your point?
For me, it's my ability to give feedback directly to a dev team building out an imperative language for use in our products: what was easy, what's a PITA, what are big, glaring gaps making things impossible, etc.
So will Fiverr. Who cares?
Why bother.
"Running a marathon is hard work, but a car will do it for you."

Sure, but then what's the point?

Aiming to get all the stars this year to round it out with 500 total - all the years, all the problems.

As of last week there were something around 1024 people who had all 450 stars.

Only started on like day 6 of 2022, but became hooked and had some time early in 2023 to go through the previous years. Once you have a few algorithms canned, it's not too difficult and some themes repeat across years.

It's fun to brush up on stuff you don't touch all the time - actual algorithms and stuff.

Hats off to the volunteers and Eric - I aim to donate every year now - it's a great event.

  • ctur
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Woohoo, one of the highlights of this time of year. I had to do mine from an eastbound flight over the pacific. This has become a fun tradition not just for me personally but for many friends, colleagues, and fellow HNers. Big props once again to wastl and his helper elves for making this!

I encourage anyone who gets value from this to donate to support it if they can. It is a passion project but nonetheless comes with real costs.

> I encourage anyone who gets value from this to donate to support it if they can. It is a passion project but nonetheless comes with real costs.

With the sheer amount of sponsors and AoC++ users I do believe that this is not quite a small 'passion project' struggling to pay the monthly subscription to a VPS.

That being said, adventofcode is absolutely great and people should support it if they can. But I do think the author is doing quite well with the amount of support he is currently receiving.

I will try to do it with F# and Gleam this year, but like every year I won’t have time (and brain) to do more than 10/12 days ^^

For the pythonists around here, give F# a try: it can feels very close to scripting and it has a wonderful REPL too :)

I'm continuing my tradition of doing AoC in Whitespace[0]. The first year I did it, it was motivation to build out a standard library so things wouldn't be so tedious. Now, I find myself wishing I had finished better tooling. I debug with wsjq[1], a CLI debugger like gdb written in jq, but it's slow.

[0]: https://github.com/thaliaarchi/ws-challenges

[1]: https://github.com/thaliaarchi/wsjq

I am doing it in bash. Will see how far I can go!
I've done last two AoCs in F# (well, only the first few days too). For a person without prior functional programming experience, it was fun! Unfortunately I won't have time to participate this year, but if I did, I'd probably chose F# again.
Nice. I've started picking up F# too and am trying AoC with it this year. I'm still early in my functional journey, but I think AoC has been helpful thus far.
How's linux support? :)
Perfect, run loads of f# and c# on Linux, and have for years
Works like a charm for me with Ubuntu 24.04/VSCode/Ionide (F# extension) !

For AoC I don't use a real project setup, just a `dayX.fsx` file and I run it like a script with `dotnet fsi dayX.fsx`, et voilà :)

If almost 9 years were not enough to make this question seem silly, perhaps DuckDuckGo/Kagi/Perplexity could answer this?
Sure those can answer it. That person is perhaps trying to be social on a social network by inviting comments instead?
This specific question posed in this specific way usually implies a negative interaction. I have seen maybe one exception here so far.

And after providing detailed answers for so many times, I don't think it's worth it.

You guaranteed it would be a negative interaction when you negatively interacted with the post. You're allowed to skip the ones you don't want to reply to.
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...

  • icen
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • ljm
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.)

  • pxx
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
this strat won advent of code in 2022. https://blog.vero.site/post/noulith
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • pjot
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Goes up and down for me, some I enjoy a lot, some are mostly painful details to get right.
  • orra
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.

  • tg180
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.

  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • ruuda
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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

  • pkd
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.

  • evah
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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...
  • mrwww
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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?
  • mrwww
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
No, I want it to be great, and if it takes over lives, then surely it must be great.
  • Tyr42
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • bmitc
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • bmitc
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • smrq
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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".

  • 9witz
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
  • smcl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.

  • smcl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.

  • smcl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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?
  • smcl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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!
  • nja
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
> 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.
  • LandR
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
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.
I love AoC. You don't have to care about the AI bots solving it or people waking up earlier than you, just solve it for your own fun. Either because you like the challenges, or to try it in a new language etc.

I like to do them in a functional style in Kotlin as far as possible, as that's different from what I do at work.

Edit: Here's mine from today, with my utils it's not exactly plain kotlin, but part of the fun is building a library of sorts with cool functions https://github.com/Matsemann/algorithm-problems/blob/main/ad...

  • c-fe
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Nice one, i like your transpose function, as python-numpy user in past years, but kotlin this year, i really missed the transpose function the most for this day one. My code: https://github.com/charelF/AdventOfCode/blob/main/kt/src/y20...
Unzip was nice, will remember that one!

This is also what I like, reading other's solutions and learning new stuff. I browse the subreddit after solving it myself to see all kinds of cool approaches.

Solved the whole thing. It's a business problem. Just replace the Chief Historian.
  • tmtvl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I still haven't made my way through all of the 2015 problems yet. But I don't play the game correctly any way: instead of trying to solve the problems as fast as I can, I try to write well-documented easily maintained code which runs fast. Balancing 'easily maintained' and 'runs fast' takes a little more time than 'just solve it' _and_ I'm planning on working my way through the problems chronologically, so I doubt I'll get to the 2024 problems any time this decade.
> But I don't play the game correctly any way: instead of trying to solve the problems as fast as I can, ...

FYI trying to solve the problems as fast as you can is not considered "the correct way". The author has emphasized multiple times that going for the leaderboard is not for everyone and requires a pretty questionable coding style. The main goal is to have fun and learn something new.

doesn't the existence of the public leaderboard beg to differ? :)
  • rbits
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
The fact that there are only 100 spots means it's not intended for everyone
The way I see it, it exists because it's the only one that can be reasonably implemented.
I do not disagree, but the fact that this is the only leaderboard that can be implemented does not imply that one needs to be implemented in the first place.
I try to do everything in a single pure functional expression no matter how dumb and unreadable that makes the code look.
That’s one of the many ways to do Advent of Code.
[flagged]
Why not?

It’s supposed to be fun. As long as you’re not cheating the global leader board - which this approach doesn’t - why not play however you want.

I like go to overboard writing parsers for each day.

  • mytec
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
From the about page: "... However, you should do Advent of Code in a way that is useful to you, and so it is completely fine to choose an approach that meets your goals and ignore the leaderboard entirely."
Is there really a wrong way to do it?
Yes, with ChatGPT or similar: " Can I use AI to get on the global leaderboard? Please don't use AI / LLMs (like GPT) to automatically solve a day's puzzles until that day's global leaderboards are full."

https://adventofcode.com/about

  • tmtvl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Ha! Yeah, imagine me streaming my working on AoC, basically anyone tuning in the stream would say 'you're doing it wrong, stop having fun!' and leave.
my guess is that the creator would almost certainly disagree with you
I can't explain why but doing AoC is always interesting, and doing LeetCode which is supposed to be similar is always very depressing.

Wishing everyone a fun challenge. This year I will be practicing F# and hope some of you will give it a try too :) https://github.com/neon-sunset/AOC24/blob/master/day1.fsx

The Christmas theme is fun and it’s nice to do one problem per day with a large community.

With leetcode you’re off in the woods by yourself. Stuck on a problem? Here’s a cold write up. Finished a problem? Do another, monkey.

Think it's because certain topics, such as dynamic programming or graph algorithms, are just not something you can attack from first principles for most mortal people. I certainly wouldn't have invented binary trees. So there is quite a bit of things to read up on (though it should all be covered in an algorithms course).

Then once you do get that context... like LeetCode problems often aren't very inspiring? A lot of the time it's "just apply this technique here".

Whereas in AoC, at least in the first few weeks, it's mostly just, do the task, attack it from first principles.

AoC would be more stressful if you had to solve a problem in 30 minutes for a highly competitive job.
  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I had 3 of those 1 hour interviews for a position at Apple, with people watching every move and thinking of ways to break the solution. I don't think I could do it again, no matter what.
those exist. except I think the one I did was an hour(? it was ten years ago). I got the interview, but that didn't go well, so I went to work elsewhere.

they have part of the site that has lessons for developers:

https://app.codility.com/programmers/

I haven't used it for a long time, but they also have contests with some small prizes: https://app.codility.com/programmers/challenges/

I’m also doing them in F# (again). Hoping to best my past attempts, never gone beyond day 12 before!

I’m never gonna do it fast but I enjoy using fparsec to get the input text in whatever format I need each time, even if writing and debugging the parsers sometimes takes up way too much of my time!

The community is most of the difference. That and the problems aren't very similar to leetcode.
Have you ever tried the LeetCode live competitions? I found those to be really fun with a great community. Just grinding problems in isolation can definitely be depressing.
  • andai
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
That's actually a very important question I think, and sorely neglected by most educators! (and book authors, etc)
People here are doing it in Common Lisp and C standard library, meanwhile I’m just sitting here trying to get a curl call to download the data file.
Copy your session token into .token then:

curl "https://adventofcode.com/2024/day/$DAY/input" --header "Cookie: $(cat .token)" > input.txt

  • sva_
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
You could open the dev console in the browser and copy the curl command off the network tab
I just copy and paste into a local text file, but I bet there’s a tool if you want to do it programmatically already (unless curl’ing is your idea of fun!)
Assuming you already opened it in a web browser, why not right click the page and choose "Save As"?
You can use Firefox: "Copy as cUrl" (https://superuser.com/a/1382425)
The command line tool included with this python library does just what you want once you paste your session token into an environment variable:

https://github.com/wimglenn/advent-of-code-data

I have this script:

  #!/bin/sh
  set -e
  curl "https://adventofcode.com/${YEAR:?}/day/${DAY:?}/input" --cookie "session=$(cat .token)"
then: YEAR=2024 DAY=1 ./aocdata
Other challenges (in advent and not in advent) like advent of code:

https://github.com/NoelJacob/advent-and-other-calandars Compiled by myself.

Do you want to add Genuary to your list? A month of daily prompts to get you producing some generative / creative coding art. Starts Jan 1. Website here: https://genuary.art/

I've promised myself that one year I will move beyond the first seven prompts ... who knew creativity could be so taxing?

  • smcl
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Not a challenge, but it may be of interest anyway - Sergey Tihon's F# Advent Calendar: https://sergeytihon.com/2024/10/26/f-advent-calendar-in-engl...

I think there's a few of these for different languages/tech. I think they may be good for HN'ers seeking some kind of little daily advent-y fix without the potential emotional/mental investment of AoC.

That’s an impressively broken website on mobile. Really, I haven’t seen a site I wasn’t able to scroll horizontally before.
Hey! Thank you. I have updated mine to include the ones from your list.

https://github.com/vimode/Advent-Calendars-For-Developers

This is great, thanks! I usually do AoC to learn a new programming language but there's no more language I care to learn right now.
  • tgv
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Going to use it to learn a bit of Ada. I've always been curious about it. It's not a popular language, and it has some serious documentation problems. Sure, there are guides for "hello, world" and other basics, but how to use a generic integer vector or even how to read lines with two numbers from stdin or a file? That was a bit of a puzzle. I saw a solution that allocates an array of 99999 elements, just to track the number of occurrences of each number in the input.

Ada took me somewhere between 90-120 minutes, whereas I had the first problem done in JavaScript in about 30s-60s, just for verification.

Ada.Integer_Text_IO with Get will happily read across all whitespace, including new lines, to find the next integer. This is true for most (all?) instances of Get, though that may not always be what you want.

  with Ada.Integer_Text_IO;
  use Ada.Integer_Text_IO;

  procedure main is
    Left : Integer;
    Right : Integer;
  begin
    Get(Left);
    Get(Right);
    Put(Left);
    Put(Right);
  end main;
If you give it any of these pairs it'll work as expected, put it in a loop and you'll get all of them:

  1 2
  3      4
  5
       6
Sometimes thinking about lines is a red herring in AoC, the lines often don't matter, only getting each value into the appropriate collection (a pair of vectors in this case since you don't know the size). For the counts, you can use a hashed map, they're built into the standard library. If you learn to use them now that'll help you out in later days, they're a commonly used collection (for me) in these challenges.
  • tgv
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I know that now, even though some of the details remain fuzzy (Get_Line reads 100 characters?), but it's just that the documentation is a big pile of facts with very little to guide you towards the right function/type. And then to get it to use in the rest of the code. And of course, many 'modern' helpers are simply not available, so that too takes a bit of time to find out. But that's learning.
It stops at 100 or the length of the supplied string or the end of the line, whichever is shorter. You can also use unbounded strings which allows you to skip specifying the size for the output.

  with Ada.Strings.Unbounded.Text_IO;
  use Ada.Strings.Unbounded.Text_IO;

  with Ada.Strings.Unbounded;
  use Ada.Strings.Unbounded;

  procedure main is
    Line: Unbounded_String;
  begin
    Line := Get_Line;
    Put_Line(Line);
  end main;
https://learn.adacore.com - good source of tutorials, unfortunately a lot of the better learning materials beyond this are books, not online tutorials.
Am I alone in thinking that measuring time to get answer is the worst possible metric? I have not participated because of that (yet).

If there is a community for those who use other rules to compare actual solutions instead of answers I would be interested to hear about it.

I am coming from low level C++ gamedev side so I understand that most people here use different tools to solve different problems.

The vast majority of people are doing it for fun or learning purposes and not to compete on the leaderboard, and it wouldn't quite be fair to compare much else in a competitive setting but time of completion and correctness, since you'd be at a disadvantage just by language choice in many other metrics. Unless you are someone with experience competing in competitive programming you almost certainly won't make the leaderboard anyway.

If your goal is to compare solutions, lots of that happens on the subreddit for it where people post solutions in their language of choice on the daily threads.

I just do it for fun. When I was younger I'd actually do them at release (11pm in my timezone), now I don't even bother and just used them as sort of a brain teaser to start my days and compare with coworkers who also do it, a lot of us in different languages.

I try to get it done within a day, so they don't back up, but I've never tried to compete. I am PST which opens at 9PM. I try to get through part 1 then, so I can sleep on part 2.

The subreddit /r/adventofcode contains discussions of solutions with lots of different skill levels.

I've done AoC for five years to learn new languages and try solve all of them myself during the month of December. (Dunno if I'll run the whole thing this year - I have another project.) Others try to get on the leaderboard, and some will implement solutions that they've seen sketched on reddit.

Last year a few people used Z3 for one of the problems, and I went back and tried that to get some experience with Z3. And I've occasionally gone back and tried another approach or new trick that I saw on the subreddit. (In the years that I've used Lean, I've sometimes gone back and added proofs for termination or array indices, too.)

I think most people don't participate for the competition. I did it several times to increase my coding skills, have fun or get more practice in a new programming language.
It is normal for coding to seek feedback from others to your solution. Even if it is automated. Looking at 'competing' solutions after you spent time on yours can teach how others think. Improving code after you learned new facts is huge part of coding fun at least for me. People mentioned private leaderboards in the topic few times. I just don't think time to submit an answer is relevant.
Why do you care about the time so much then? Just ignore it :D
Can you propose other metrics that don't involve executing stuff in a whole lot of languages? The point is to let people work in whatever they want, as only the solution matters. If only the solution matters I don't really see other options beyond time.
That's like saying you don't want to go for a run, because professional marathon runners are so focused on time
Here's a website that appears to be about competing on the performance of each solution: https://codspeed.io/advent
>Participants have 36 hours

Looks like it is for young people who have dedicated time for it everyday.

Personally I would like to do anything like this with no time limit and probably no monetary prizes. I think the only value of those puzzles is to fire up rarely used neurons that hopefully are still there after another year of shipping corporate products xD. I might appreciate fresh point of view from young people and new programming languages though.

  • _se
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Because only young people can make time for things.

There are plenty of professionals with jobs and families making time for AOC because they enjoy it. Doing the problems at the same time as everyone else is a VERY different experience from doing them whenever you'd like.

If you don't want to make the time for it, power to you. I'd recommend most people to drop off after the first 10ish days. But don't delude yourself by ascribing this as the domain of "young people" or those without responsibilities. You're making a decision. Own it.

I appreciate your perspective and it is correct. I should have phrased it differently.

Imho: I worked with code that has long history for my entire career. If the goal is to look at some objective quality of solution then I do not believe in time limits. The longer I work the more things getting patches/updates/remasters and value of better code goes up and value of arriving at any kind of solution overnight goes down.

  • _se
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
For software that's meant to be maintained for long periods, especially by others, I agree with you.

The thing about AOC is that it's really less about the code that you generate, and more about the process of solving the problem. The challenge is really what you make of it. Some people will golf it, some will go for speed, other for performance, etc.

That's why it's so different to solve the problems in "real time". There's a huge community of people solving the same problem that you can interact with and bounce ideas off of. Even just a few days after the problem is released, most of that active discussion has dried up, so you can no longer participate in that discourse.

So, again, I don't think there's anything wrong at all with what you're saying, but there are other elements to consider beyond maintainable code and pristine solutions.

> Doing the problems at the same time as everyone else is a VERY different experience from doing them whenever you'd like.

I agree and I happen to think the experience of doing it later than everybody else is significantly better. If I search for “AoC 2024 day 12 hint”, I’ll get better results on Jan 12 than Dec 12.

Then you may like https://highload.fun/ No time limits, no monetary prizes, fastest solutions win.
After trying to turn day 4 part 2 as example to my colleagues I came back to check the site. Day 1 winner seems like what I would have expected so thanks for the link!

Sry, can't upvote because I mostly read HN not logged in so I still can't upvote. If there were some other performance oriented forums either on reddit or somewhere I seem to be too lazy to find them anyway.

> If there is a community for those who use other rules to compare actual solutions instead of answers I would be interested to hear about it.

Generally you have the main community on reddit (memes, questions, daily thread for sharing solutions), then the language specific subreddits or hosted forums where you will see solutions discussed and shared, plus a couple of new users asking questions.

Also, within the daily main community thread you will see the niche sub community of people posting their code-golfing attempts.

I also don't like it, last year we had a private leaderboard at work and I realized being crazy enough to wake up at 5:50 every and solve at least part 1 would give me an edge. But the "wake up at 5:50" part is what I enjoyed the least.

However, there are other ways to rank yourself against others. You can order your private leaderboard by number of stars, or make your own leaderboard using their APIs.

It could be interesting to find the shortest solution. But the site is not set up for verifying solutions in various languages.
I wouldn’t use an AI to solve the problems, but I wonder if an AI could give good feedback on a solution I cook up?
That's what I've been doing with some older AOC puzzles. I solve it, then paste my solution into Claude and ask for tips on making it more idiomatic. It's been pretty nice so far. I learned about Haskell Arrows which I would probably have never come across otherwise.
This year I will run my AoC solutions on my toaster and write them in ALGOL 58 using only my feet.
I can hear the elves calling me...

But no, last year I lost all momentum on my side projects and my gf thought she'd lost me to the elves.

Completing it on time was rewarding but I can't go back.

But I can hear those elven bells a jingling...

My personal challenge last year was to solve everything on my mobile phone, using LLMs (mostly ChatGPT4 with code interpreter; I didn't paste in the problems, but rather described the code I wanted.)

This year I'm declaring "Advent of Claude"!

Challenge: Write a Claude custom style to solve Advent of Code puzzles within Claude's UI.

Score: # adventofcode.com stars earned in 2 daily conversation turns.

Fine print: web app artifacts are allowed, including paste of your custom input into the artifact UI; one click only.

Per https://adventofcode.com/2024/about, wait until the daily http://adventofcode.com leaderboard is full before submitting LLM-generated solutions!

Of course, feel free to use ChatGPT custom instructions, static prompts, etc.

Day 1: two stars, https://claude.site/artifacts/d16e6bdb-f697-45fe-930c-7f58b2...

While I personally wouldn't find it a ton of fun to solve the puzzles that way, that's pretty cool. Nice work.

Is there a place where you're blogging this or at least aggregating the links so we can see how far you get with it as the puzzles get more challenging?

Fair enough! I'll document my progress at https://github.com/jmandel/advent-of-claude/tree/main, though I may not keep up.
Thanks for posting that. It's been entertaining to follow your progress.
I completed last year's in Scryer Prolog and it was a joy. Some problems were almost impossible due to the lack of mutation (Karger's algorithm comes to mind), but file parsing was a breeze and I find Prolog programs generally beautiful. My favourite syntactical feature is the full stop at the end of clauses.
Erlang lifted it as the comma, semicolon, dot convention. When I was writing a lot of Erlang I found myself wishing it was in other languages. After not writing Erlang for a long time, I wrote a few functions recently and it was jarring. Then again I usually prefer the conventions of whatever language I'm using most at the time, unless I really dislike the language (Javascript).
I've never done AoC but I've done other programming-related challenges before. I come from a non-IT background (mech eng), and I'm currently away for work for the first several days with only their locked-down laptop.

Normally I'd break out Python for this, but given the constraints maybe I should try to see how far I can get through this in Excel. It'd be a fun little challenge :)

  • andai
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
My approach here would be to make an index.html file with a script tag and drag it onto whatever browser is available. Then again I have made peace with JavaScript!

(I think you could even use typescript with this method with the on the fly babel transpiler (you just include a script tag) but I haven't tried that.)

You'll lose the benefit of the TypeScript compiler picking up mismatched types if you only use a transpiler.
  • andai
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Interesting, the in-browser one doesn't do type checking? They're actually adding that to JS itself as far as I can tell -- the ability to strip TS types and run it as-is.
I use Excel for the first few as well! I actually find it to be easier than using Python/Javascript, at least early on.
Woohoo! This is my favorite time of the year. As the year rolls into vacation'ish days and on call rotations, this is where I hunker down and use this to code something other than power point. Last year, solved via my primary language (Java), then ported to Rust. This year, I'm starting with Rust. I had not realized it was the first.
The tiny thin gray font on black background is impossible to read on a mobile device :(
  • 0xEF
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Color aside they also ignore a number of solutions for font resizing that follow the users accessibility settings. I can think of at least three easy ways to do this with html/css alone, and yet hear we are; a site that is unreadable to me.

I love what Advent of Code does, but when your site is all text, there's just no excuse to not let the user resize it by default.

AoC day one challenge… make website responsive
It is terrible for me on my desktop too :(
On iOS you can switch to Reader view, and I imagine Android has something similar.
Yes on Android it's already readable in Firefox, but that may be due to ad-blocking plugin. Even so, Firefox reader mode makes it even better.
I tried that, but it broke all navigation links (including to the actual exercises).
*browser not os feature :)
if you want to use Zig, here are some tips : https://kristoff.it/blog/advent-of-code-zig/
I'm gonna try doing this on the NES (Nintendo Entertainment System) this year.

Probably some problems will be impossible with limited RAM (2KiB, plus an optional 8KiB on the cartridge, maybe more if a fancy cartridge is used). But I'll try to solve as many as possible.

Today's was possible, in under 4 seconds, using 4KiB extra RAM on the cartridge.

Could you use a cartridge type that has enough swappable memory banks?
what is the dev cycle like on that? can you attach to it and operate it remotely via something like a repl or do you have to compile something to a cartridge and boot it from that?
Generally you compile to a rom and load it into an emulator. There's a certain amount of memory manipulation you can do in NES debuggers, but it's usually just easier to go through a full build cycle; especially for small programs like used in AoC.
  • a_t48
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Very interested in this - I have a SNES flash cart, I wonder if there's a good basic library to handle printing to the screen and such.
I believe that this page should be mobile friendly. I won't be coding on mobile, but reading about it on my portable device would be great.
  • dchuk
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
At least on iOS, Reader mode in safari fixes it right up
I’m attempting to make my own language for solving the puzzles as I go along.
I'd pretty much decided I wasn't going to participate because it would take up too much time, but now you've both made it way more complicated and way more appealing...
I did this, and it's been very satisfying! Here's where I'm at now: https://www.youtube.com/watch?v=r99-nzGDapg
This is the first year that I will do AoC. I have never wanted to, but I have a working language of my own now.

https://gavinhoward.com/2024/11/advent-of-code-2024-getting-...

Lots of people seem to be doing hardcore things like using C without libraries, limiting memory etc.

And here I am doing it in Ruby instead of Java this year thinking I was giving myself a challenge.

  • orra
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I would love it if the first star of the day was required, but the second was a bonus. I love Advent of Code, but I don't have the time to get 50 stars.
  • andix
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
No stars are required at all. You can also skip some days if you don't want to do them. Or only to the first stars. However you like. First/silver stars will also increase your score in the leader boards.
I think you need all stars to do the final puzzle.
I might be mistaken but I believe the final day has only one puzzle, but the 50th star (a.k.a., the second star of December 25th) is given for having solved everything else. I don't think any puzzles are "locked".
You're right. The second star is a freebie for completing the rest.
  • andix
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
That might be true, I've only completed it once a few years ago. But if you don't want to the more complicated parts, then you want to skip the last one for sure.
Same. Especially when it gets really hard later on. Despite studying CS, I still struggle with it.
This is the first time I've seen Firefox's alternate stylesheets mentioned in the wild. Interesting.
I’m using sqlite this year. Hoping that there won’t be any computational geometry or trie problems. Kind of hoping for a graph problem solvable with recursive CTEs, that would be cool.
I've been doing a lot with SQL for the first time in my life, this is tempting. I posted some SQLite CTE dark magic the other day but I certainly didn't understand it.

Edit: Someone else posted an "Advent of " list which included https://adventofsql.com/, perhaps those problems will be a little more pedestrian for SQL.

  • feike
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
As every year, I try to solve it with 1 sql statement for every challenge, https://gitlab.com/feike/adventofcode/-/tree/master/2024, likely going to get stuck again around day 12/13 or so!
Awesome! Thanks for sharing. It feels good to have some company in this, I will follow your progress!

I created a repo for my solutions here: https://github.com/lyxell/aoc2024-sqlite

Update: Wow. Reading your solutions was a real eye-opener for me. It never struck me that one can exploit the fact that unmaterialized CTE's will not be evaluated for rows that is not needed by another SELECT and one can use this the same way one uses laziness in Haskell. This is great stuff, thanks again for sharing!

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I've solved some days in past years with sqlite + enough awk to transform the input into something that can be imported into a table. It can be a fun challenge.
I’m allowing myself to convert the data to a csv and read it using ’.mode csv’.

I realized when solving todays problem that SQLite’s

  json_each("[" || T.c1 || "]")
Is useful for parsing comma separated rows into (row, col)-pairs as well.
> You don't need a computer science background to participate - just a little programming knowledge and some problem solving skills will get you pretty far.

The use of “pretty far” gives them a bit of an out, but I think this statement is a little disingenuous. Last year, at least, a bunch of the problems needed fairly sophisticated algorithms to find the solution in a reasonable amount of time.

To me, a little programming knowledge is what somebody who is six weeks into their introduction to programming class has. They know variables, loops, lists, and maybe associative arrays.

"Participate" doesn't mean "win". You can look things up as well. I haven't done a ton of AoC, but the harder ones from it I've seen were not very hard to search/research for the correct algorithm (even avoiding "what's the answer for day X" searches).
Anecdote to support your comment: The Chinese Remainder Theorem has featured in Advent of Code at least twice IIRC. Not an algorithm the average programmer (average is a very fuzzy term, yeah) would know.
> The Chinese Remainder Theorem has featured in Advent of Code at least twice IIRC

Fortunately it's never been needed. Every time it's come up the problem has been solvable with high school algebra level math skills (you need to know what the lcm is and that's covered in middle school in many places). If you knew the CRT you could jump straight to a solution, but a solution was easily derived using algebra and a couple loops.

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Got some specific references for the days that was required?

I think a lot of people are so focused on "optimal" solutions they fail out or burn out quickly, ignoring the ugly "just loop a bunch of things" option.

I'm by far an expert on AoC, but the number of people I see every year on day 2 or 3 saying "IT'S TOO MUCH" because they were trying to implement some crazy algorithm when basic array operations and for loops would solve it...

I flunked out of high school. I don't even properly understand algebra, never mind any sort of complex math. I have no CS degree. I've completed most of it in some gross PHP that completed before next year on a single core in an old laptop.

If "knowledge of obscure algorithms" is a requirement either I'm a once in a generation genius or... it's not a requirement.

AoC doesn't require any particular algorithmic knowledge to solve its problems. Sometimes knowing algorithms is useful to quickly write your solution, but IME it's never a requirement. Unlike leetcode-style challenges, AoC tasks usually don't even try to punish you for solutions that are specific to your particular input. You can get some stars with just pen and paper.

It's more like a set of logic puzzles. Programming and algorithms are only incidental.

I love looking at AoC solution megathreads on reddit. So many languages and so many different approaches are hard to find and observe anywhere.
I feel like those threads would make great research opportunities. We often hear people say that code should be for people to read, incidentally for machines to execute, just be amazed at how much the readability varies from answer to answer.

Skimming some, the core of Part 1 after people have parsed and sorted:

Python:

    sum([abs(x-y) for x,y in zip(left,right))
TypeScript:

    list1.reduce((acc, cur, i) => {
        return acc += Math.abs(cur - list2[i])
    }, 0)
Common Lisp:

    (reduce #'+ (mapcar (lambda (l r) (abs (- l r))) sorted-left sorted-right))))
Julia:

    sum(abs.(list1 .- list2))
Rust:

    Ok(zip(left, right).map(|(l, r)| l.abs_diff(r)).sum()

F#:

    Seq.map2 (fun x y -> abs (x - y)) xs ys |> Seq.sum
APL:

    +/|-⌿
Haskell:

     map abs $ zipWith (-) column2 column1
and then all the submissions which don't do anything like this, and have manual loops and indexing and clunky data representations or performance-optimized data representations, etc. etc.
I usually get stuck about halfway through and give up.

Doing it in a Lisp I’ve been writing in Ruby will have me giving up even sooner, but it will be fun!

I have seen a couple of snarky comments about how AoC is just a competition for who can write an input parser the fastest for 25 days in a row, I'll just share the following:

Just write that once, put it in a template /day0 folder that has /day0/part1, /day0/part2, and /day0/input.txt, and then just copy it and focus on the actual problem. It's all about having fun!

  • ruuda
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
This has been a good driver for me to add features to https://rcl-lang.org/. I just added List.sort for today’s problem.
Interesting, do you publish your AoC solutions in rcl somewhere?

EDIT: nevermind, found it! https://github.com/ruuda/adventofcode/tree/master

I know a lot of people use AoC to try out/learn a new language. I tried that with Go in like 2018. However, I found it too frustrating (especially since AoC requires a lot of string parsing/regex which are difficult/verbose in Go).

The past few years I've decided to stick to the same principle I've used in all of my side projects recently. Either I do something in a new language, or I get it done correctly before I get bored. I've found I can't have both.

I love AoC. I made a CLI client in python for me (and a lib for common tasks, especially the 2d grid maps).

Repo: https://github.com/ArcHound/advent_of_code Writeup: https://blog.miloslavhomer.cz/p/advent-of-code-cli-client-an...

Good luck to y'all in 2024 and enjoy!

For anyone interested in using this to learn Elixir or improve your skills with it, I saw this video[0] a while back and their AoC starter repo[1] is super slick.

[0] https://www.youtube.com/watch?v=gpaV4bgEG-g

[1] https://github.com/ChristianAlexander/advent-generator

There are a few Elixir solutions fo Day 1 here, including mine: https://elixirforum.com/t/advent-of-code-2024-day-1/67786. I'm using it as a motivator for actually learning the language/libs.
Awesome, in that thread I found this library[0] to make it easy to write AoC solutions with Elixir's Livebook.

[0] https://hexdocs.pm/kino_aoc/KinoAOC.html

One of the things I look forward to. It is a lot of fun.
I usually get to around day 10 in AoC before they get so time consuming that I give up. I still really enjoy the first week or so though!
It feels like AI will shape a lot of the submissions for these types of coding “traditions”. But, I guess that’s just the world we live in.
The global leaderboard is so fast that any AI assistance would literally slow them down, here's one of the guys who tends to score highly solving today's puzzle. (https://youtu.be/ym1ae-vBy6g), and on the more complicated days that's even more pronounced because anyone who is even somewhat decent doesn't need to ask chatgpt how to write Dijkstra.

Obviously if you're doing it recreationally you can cheat with AI but then again that's no different than copying a solution from reddit and you're only fooling yourself. I don't see it having an impact.

  • Kiro
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
The "winner" solved it in 9 seconds using AI so I don't understand how you can claim that.

https://adventofcode.com/2024/leaderboard/day/1

I'm curious to know how did you know the winner used AI?
  • Kiro
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
See https://news.ycombinator.com/item?id=42287377

I also don't see how it would be possible otherwise.

The thing is that the AI can read a puzzle faster than a human can. If someone put any effort towards an AI-based setup, it would easily beat human competitiors (well, up until the point the puzzles got too difficult for it to solve).
I've always done AoC "properly" but this year I've decided to actually use it as a learning experience for working with LLMs (and I don't get up early so will never sully the leaderboard) and trying some experiments along the way.

I think the strategy for the harder puzzles is to still "do" them yourself (i.e. read the challenge and understand it) but write the solution in English pseudocode and then have an LLM take it from there. Doing this has yielded perfect results (but less than perfect implementations) in several languages for me so far and I've learnt a few interesting things about how they perform and the "tells" that an LLM was involved.

  • anonu
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Python looks excruciatingly slow to me. If you want fast I believe you need to think and write in vector languages like kdb+/q. I am not a kdb+ expert by any means and my code can probably use more q primitives, but here was my solution in ~2 minutes:

  i1:("I  I";" ")0: `:1.txt;
  sum {abs last deltas x }each flip asc each i1 / answer 1
  sum {x * sum x = i1[1]}each i1[0] / answer 2
Everything autocompletes in Python.

    from collections import *
    xys = list(map(int, open(0).read().split()))
    xs = xys[::2]
    ys = xys[1::2]
    xs.sort()
    ys.sort()
    print(sum(abs(x-y) for x,y in zip(xs,ys)))
    
    yc = Counter(ys)
    
    print(sum(((yc[x])*x for x in xs)))
this is the least amount of loc I can think of rn

    data = { i+1 : sorted([ x for x in list(map(int, open('input').read().split()))[i::2]]) for i in range(2) }
    total_distance = sum(list(map(lambda x: abs(x[0]-x[1]), zip(data[1], data[2]))))
    print("part 1:", total_distance)
    similarity_score = sum(list(map(lambda x: (x*data[2].count(x))*data[1].count(x), set(data[1]).intersection(data[2]))))
    print("part 2:", similarity_score)
That’s cool, but horribly ugly! What does production kdb+ look like? Is it similarly terse, maybe Perl-ish, or was this purely for speed?

What does each flip asc do?

  • anonu
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
i1 is Nx2. asc each i1 sorts each N in ascending order. flip transposes to 2xN.
I'm actually pleasantly surprised by the results. I like to think that despite problem 1 being easily solvable by LLMs, just about everyone (sans qianxyz) read the FAQ, and decided that they would forego a leaderboard spot for the sake of this coding tradition.

Either that, or there were hundreds of people trying and none were able to get it working despite the basic problem. I like to imagine most people reading the rules and being a good sport.

Even before AI I was never fast enough for a respectable global rank, but it's still fun to compare solutions with friends.
All the people I know already participate on private boards. AI enshitification will only speed up the process of moving there.
  • andix
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
It also doesn't make any sense for most of the people to compete with the geniuses on the public leader board. It's like signing up for the Olympics as an amateur athlete.
Are we using enshittification for everything we don't like these days? We invented calculators, those really enshittified manual arithmetic puzzles. Private boards for this stuff makes sense anyway, it's the Internet afterall.
Using LLM for this kind of thing is like using cheats or aim assist for online games. So yes, this is prime example of enshifittication.
enshittification isn't "things become worse" - it's the specific process of how services worsen in 3 stages:

> Here is how platforms die: first, they are good to their users; then they abuse their users to make things better for their business customers; finally, they abuse those business customers to claw back all the value for themselves. Then, they die. I call this enshittification, and it is a seemingly inevitable consequence arising from the combination of the ease of changing how a platform allocates value, combined with the nature of a "two-sided market", where a platform sits between buyers and sellers, hold each hostage to the other, raking off an ever-larger share of the value that passes between them.

Just because that's how it was defined in a blog post doesn't mean that it's the only way to use it
  • Terr_
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
We already have plenty of words for the ancient and generic concept of things-getting-worse, like "ruining".
I think the intent is important. Using LLMs to do well on the public leaderboard is like using cheats/aim assist. But learning how to use LLMs to solve complex puzzles independent of any sense of "competition" is more like when people train neural networks to drive a car in GTA or something - it's not hurting anyone and it can be a real learning experience that leads to other interesting byproducts.

But, yeah, don't use LLMs to try and get 9 second solve times on the public leaderboard, it's not in the spirit of the thing and is more like taking a dictionary to a spelling bee.

Just the shitty things like using LLMs to spoil a fun competition
No, we do not. Calculators are a whole different issue from LLMs, which plagiarize and spoonfeed whole paragraphs of thought.

Enshittification occurs when previously good or excellent things are replaced by mediocre things that are good enough for those susceptible for advertising and group think.

Examples are McDonalds vs. real restaurants, Disney theme parks vs. Paris, the interior of modern cars, search engine decline, software bloat etc.

> those susceptible for advertising and group think.

That's everyone, including you, no matter how edgelordy you post about 'normies' and how you are above that. See how quickly your brain hands you "McDonalds" and "Disney" when you need an example.

Yes you just used the first one that came to mind, the one that everyone would recognise, that's because billions of dollars keep McDonalds first in mind and universally recognised. And even if you make your personality "I wouldn't eat at McDonalds" that money is getting you to propagate the name on HN, just to remind people it exists and keep people talking about it.

If LLMs are really as good at writing code as some people say, they should write a script that fetches each challenge, as soon as it's released, and feeds it to an LLM, to produce a solution. Then run this code and submit the answer it outputs.
This is how most of the top of leaderboard works.
Do you have any evidence to support that claim? Competitive programmers (especially those with their own libraries ready to go) can be incredibly fast at solving coding challenges.
  • gf000
  • ·
  • 1 week ago
  • ·
  • [ - ]
Also, LLMs already fail on the two-star problems.
I use it to learn new languages - this year it's Ada -

https://blog.adacore.com/announcing-advent-of-ada-2024-codin...

Excited to try this. I was aiming to be done by Christmas, but this is my first AoC and reading other replies makes this seem a bit unrealistic. Decided to do it in elisp to try and improve my emacs-fu and lisp knowledge.
Gl. I've yet to meet anyone that actually finished AoC. At some point the problems take 8+ hours to solve and people give up :).
I am a bit late to the trend, but I am planning to do Advent of CUDA this year. It's been a while since I have written a lot of parallel code, and thinking about concurrent algorithms is fun.
I'm excited about this! I'll be sticking to Python so I can practice writing maintainable code. I'm also looking forward to keeping up with my explanations of each puzzle, which helps me (and others!) learn a lot.

Everything is here: https://advent-of-code.xavd.id/

I'm unlikely to finish it all in December (the puzzles get hard and I get busy) but I _do_ love the event.

Remarkable. Bought, sold within 2 weeks. Really underwhelmed
Meant for another discussion?
indeed xD. TY!
I haven't completed one before and I have a question for those who have. Can I treat the entire month as one code based which evolves over time, with an evolving set of unit and integration tests? Or do some days require starting from scratch? Lots of people here are talking about completing it in exotic languages but I'm more interested in using it to sharpen enterprise coding techniques.
Every day is mostly independent of the others. I generally don't reuse code because most of the common code is easy enough to rewrite, sometimes I copy/paste earlier code in to a new solution.

The main exception is 2019's Intcode VM/interpreter which was used over about a dozen days (I mentioned it elsewhere, he hasn't done anything like that since). Occasionally, beyond basic algorithms there is some continuity between 2-3 days but that's not terribly common, I don't think there were any pairs of puzzles like that last year or the year before.

If you want to make one code base, you'll still have 25 or so separate solutions. You might have some continuity with common algorithms (like A*) that get used a fair bit in search problems or abstracting out the input handling when you identify common structures for parsing.

I decided to do it in Erlang in 2019, that Intcode VM was much "fun"... I really enjoyed it, I wish there were more years than that.
Svelte is doing its own Advent of Code challenge with a twist this year. Instead of challenging users, the maintainers will be challenging themselves to launch one feature a day. Today's feature is error boundaries!

https://bsky.app/profile/svelte.dev/post/3lcavobxn7c2k

  • cod1r
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
This year I'm going to try to do this in Haskell.
I don’t code for a living anymore so this looks fun.
What do you do then?
Insurance
Yup. Advent of Code is a fun, yearly alternative to LeetCode with a Christmas theme, and it's approachable for novice developers.
I was looking for a puzzle in the first link until I saw the home page: "One article on Raku per day, until Christmas." I vaguely remember these from my Perl days (a decade ago) now.

AoC usually loses my interest around day 6 or so, but a PDL journey for the advent sounds a lot more appealing. Time to dust off my Perl skills and see if I find it as fun today as I did back then.

yes perl was the original advent of code iirc
The first year was the best year for me. It was really fun and I think I got 22/24 days done. After that my participation rate has been shocking, I really want to do it but I get this weird anxiety that I'm not quick enough.

Which is weird because that is not a thought that entered my mind when I did it for the first time. It was pure fun!

Just give up on the main leaderboard. Maybe join another, preferably with people who share your time zone and schedule.
Last year, I spent more time coming up with a reusable framework than the challenges themselves, proven by the fact that I only solved two days.

This year, I shook my head at my framework and rewrote it, but at least that only took me a day (so far). Day one was easy, which also helps. IIRC, last year’s first few days were non-trivial.

I always get too ambitious with AoC, e.g. trying to do it in a new to me language or abstract everything into a new library. Subsequently I never finish. So this year I'm using whatever language or tool is easiest for me and the only goal is to finish!
I did some of it in TXR Lisp a bunch of years ago.

https://www.kylheku.com/cgit/advent/tree/2021

Give it a try. The structure and recurring themes in these solutions could be used as a source of ideas for how to get started.

Because we can assume that these problems necessarily cannot be in the training set of any current LLM (and are hard enough, i.e. they should be more than mere variations on existing problems), I'm wondering if they can be a good benchmark to get a better sense of how good they really are at problem solving?
Modern LLMs are very good at solving programming puzzles like that. As soon as it recognizes which algorithm needs to apply, it's just massaging the data to the right format.
Your answer somehow suggests that solving such problems is merely "recognizing which algorithms to apply".. which is another way of saying that they are more "pattern matchers" than "true reasoners". I would think, on the contrary, that these problems (at least the tougher ones that are coming in about two weeks) require more than pattern matching, but I'm not sure exactly what are my thoughts on that.
Consider ignoring the reasoning for how/why LLM's can do this sort of thing which doesn't matter as much when you simply try it out. I wouldn't be surprised if many of these problems are in fact solved by LLM's. Just from my experience using them to solve relatively novel issues in my day-to-day. There will of course be mistakes and hallucinations, but in a proper dialogue with a motivated programmer, I bet it works >50% of the time.
This year I will solve AoC using Gleam. My challenge is to finally learn functional programming and learn Gleam at the same time.

I already solved the first problem and it was hard to get things ready, read the file, handle the data, etc. But once I had the first steps done it was easy to solve the problem

Not sure if it would take away from the experience, but there's this repo which is made for AoC that handles getting the input from a text file, sets up a source file for each day, etc

https://github.com/TanklesXL/gladvent

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
  • bas
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Day 1 led me to a deep(ish) dive into the CPython implementation of the abs(...) builtin. Good times!
Does anyone know what is the theme of this year? If it's VM or anything low level then it's fun.
It’s only ever elves finding and losing things
I just did this in a few lines of python with numpy. I don’t understand why the input isn’t a csv.
It’s ssv — space separated values
This is my fourth year. I'm using Go while being surprised how inadequate it is for this kind of problem. Standard libraries lack basic data structures and often Go is too slow for a compiled language!
What does "Go is too slow" mean in this context? Were you expecting similar performance to Rust or C++?
Well, it is slow to run, because all the built-in Python magic is highly optimized. When you start implementing stuff in the bare bones Go, and you're pressed by time, you don't optimize, and the result is code that is slower than Python.
I'm doing it in K2 this year (a language that has a single data structure: a vector). If you can do it in K2, you can do it in Go.
I am doing it, it's just not convenient for a major language that has been around for 15 years!
AOC follows "Tony's Law of Comprehending Things on the Internet": Reading the content from bottom to top is the most efficient way to grok the content.
I'm trying Haskell this time.

For this one, I learned how to write a basic parser with Text.Parsec and manipulate the tuples with bimap !

It's a very fun occasion to learn a new programming language.

  • b5n
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I've generally chosen a new (to me) or spartan lang to challenge myself, but this year I'm going easy mode with python and just focusing on meeting the requirement.
AoC is fun for learning a new language but I feel like all of us have that one "project" that we rewrite every few years in this language or that to learn it.
I never have made it to the end of a season, just due to lack of time. It's great fun, though - already solved today's "warm up" puzzles...
I think I'm going to be using MicroSoft QuickBasic for System 7 this year. I might regret this pretty quickly.
  • dchuk
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
While I agree that just dumping the puzzle instructions into an llm and getting the right answer at least doesn’t align with the spirit of Advent of Code (though it does show how crazy good LLMs are getting), I’m using this as an opportunity to try out the new Windsurf AI IDE and am driving the AI code editing in it to help me write the code to solve each puzzle (I’m using Ruby).

My goal is to develop the muscle memory for the tool so I can write code quickly. I’m still generally thinking through the puzzles, but being able to just write out plain English logic, get code generated, ask for it to be well documented, quickly refactor things to be generally reusable, etc, is just fantastic and how all software development should be done in this day and age frankly. Such an accelerator to problem solving.

Is this any good for beginners/kids?
Sure, but it starts to get hard a few days in so beginners won't be able to finish. However, I think that makes it an amazing learning opportunity. There's plenty of write-ups on solutions on the internet.
I'm doing the challenges in PowerShell to see how it goes.

I want to use it as a test to see how human programming can be improved by an AI, so I wrote the solution for day 1, got the right answer, and then gave my code to ChatGPT 4o to ask it to make the code faster.

My version ran in ~3500 ms ChatGPT's version ran in 140 ms

both worked

A great example of how a common DevOps language program can be improved on by ChatGPT.

That seems rather slow for yours, and not very fast for an optimised one. It can speed up a lot from a cold start to a warm run, my tuned code can show 8 ms in powershell 7.4 after a few runs.

My hack-it-out code: https://pastebin.com/PDQhxDc9

Faster code: https://pastebin.com/6xwaVkwq

The hacky code uses slower techniques like:

- Get-Content which adds metadata to every line.

- @() arrays with += which copies the array in memory to a new one-larger memory location for every addition.

- Pipeline overhead e.g. ForEach-Object and Measure-Object.

- Filtering the whole second column for each number in the first column, repeated wasted work.

and it's still in the region of your ChatGPT one.

The faster one addresses these with:

- ReadAllLines() .NET method to get plain strings.

- [system.collections.generic.list[int]]::new() which don't box integers and can grow more quickly.

- plain adding numbers into sum variables.

- Building a hashtable [system.collections.generic.dictionary[int, int]]::new() to count each number in the second column.

- Swapping -split for string split() which may have a tiny bit less overhead.

- no pipelines.

The code isn't completely different, it's the same blocks doing the same things, leaning more on .NET lower levels, and years of experience of the basic PowerShell performance hits.

Great to see your optimizations.

I'm going through each day and asking ChatGPT to speed it up, it doesn't always work, but that is the way of the Gippity.

The payoff is these heavy iterating operational scripts I run for work will end up running faster :)

Learning when to lean on some of the .NET primitives really helps speed up PS as it likes to wrap things with unnecessary features.

You may find Claude giving better results. You can ask her to write code with "please apply technical guidance from Stephen Toub w.r.t. performance to the code you come up with" and it helps to improve the quality since Stephen Toub is someone she knows about. Or maybe some other core contributors and article authors that have more likelihood to be present in the dataset.
co-pilot solved day 2 in a second, kind of makes me sad. I’ll try some of the others myself though they’re kond of fun. Would be fun to use as many languages as possible or maybe some convoluted micro services architecture.
New factorio dropped. Probably be doing that with every spare minute of the day.
I maintain a joke domain which I've found sadly applicable through the years. https://adventofrealizingicantread.com. I try to keep it updated pointing to the current day throughout the month

I've found especially as the month progresses it's just as much Advent of Reading Comprehension as it is coding :)

It seems it does not work now now?
AoC is in this weird place where it's too easy to be fulfilling on its own, but too bothersome to just do it for leisure. I did it once (using Python with no imports for some mild challenge), waking up super early to actually start on time, then golfing my answers if I felt like it. It was a fun thing to do... once. I don't feel the need to repeat that and I don't find it engaging enough to do without time pressure, so I don't.

Perhaps if you aimed at global leaderboards it would be different, but that's neither my league nor I see any fun in that - getting there requires serious effort and preparation in things that aren't directly related to solving intelectual puzzles.

It's best for me when I do something that I ordinarily don't do for AoC.

I find no particular pleasure in using an everyday language like Python for it, because as you said it's too easy.

I have used Haskell, Racket, and in some easier cases APL and it's been fun. Treating it more like a puzzle than an actual programming assignment.

When learning new languages, it's best to do something that actually makes you think in a different shape. If you know Python, don't do Ruby. If you know Java, don't do C#.

It goes into "too bothersome" territory in this case for me. Competing in a local leaderboard was fun and kept me engaged until the end, but it was only possible by choosing a comfortable language to be free to actually think about the puzzle itself to solve it fast. Choosing something that I'm not already familiar with (or that isn't well-suited for this type of tasks) is a great way to ramp up the difficulty and perhaps gain some bragging rights, but I can't see me doing it for longer than a few days before losing interest. Even in this "easy mode" in Python, there were four days that had me spend more than an hour (up to 5h) on the task. There's plenty of actually useful projects I could do in this time to learn new things instead after all.
> There's plenty of actually useful projects I could do in this time to learn new things instead after all.

I suppose. I do actually useful projects at work. AoC reminds me of why I personally loved programming in the first place - solving small technical puzzles. I don't like trying to make every single moment of my life "productive".

Who does?

When I said "useful", I meant "useful to me". I figure I'd prefer to solve some problem to scratch a personal itch, or play some instrument, or make a funny game, whatever. Even spending that time on resting would probably be useful. Solving a technical puzzle is nice, but my point was that collecting stars to finish the advent calendar isn't particularly useful or rewarding on its own, and if I need to be motivated internally to do it by adding some artificial challenges, then I can find more enjoyable ways to make myself busy as well.

But that's just me. I just don't think AoC could motivate me into learning something I wouldn't learn otherwise. It just doesn't provide enough incentive to keep going. Tasks are mostly too easy to be rewarding on their own, but some are too hard to just do casually. I can't imagine spending as much time as I did on it - about 30 hours in total, not counting time spent on golfing and browsing other people's solutions etc. - if I had a regular job at the time, and once you skip days it just becomes a random set of challenges that could be tackled at any time anyway.

C# allows for terser and very functional-y implementations thanks to differences between LINQ and Java’s Streams.
I guess, but it's not really a fundamentally different programming paradigm, which is what I was getting at.
It doesn't do: partial application, currying, structurally constrained generics and gradual typing (and of course much more small details that e.g. F# can do)

It does do: higher order functions and functional composition, monads and monadic comprehensions, records, list comprehensions and iterators.

You are correct that it's not going to "push" you into that direction aside from APIs that are already popular, but it's unfortunate it keeps getting bundled together with Java. C# and Java are languages with differing priorities, paradigm support and target scenarios. There is great overlap, but the differences are significant.

Getting the vibe of Google code jam

Pretty good tbh

I read the entire page and I don't see anywhere that it actually lists what the puzzles are, I'm so confused.
It's an advent calendar design, one puzzle unlocks each day, the rows in the picture where the number and countdown are. You can click rows 1 and 2 now.
What I hate about AoC is the tons of bullshit about Christmas elves I have to tolerate before getting to the damn point. I mean, I understand they want to make the context entertaining, but sometimes it's like reading a Jira card written by a junior product owner!

BTW I love AoC for all else

  • codr7
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I actually enjoy it in this context, not so much in JIRA.
Here's to another year of being sleep deprived for the entire month of December.
Getting the vibe of Google code jam, pretty good
Mkay, day 3 part 2 is making me want to step in front of a bus and never touch a computer again.
9 seconds to get both stars is absolutely insane - there had to be some AI assistance here.

Come to think of it, a pipeline that feeds the problem text into an LLM to generate a solution and automatically runs it on the input and attempts to submit the solution, doing this N times in parallel, could certainly solve the first few days' problem in 9 seconds.

  • emadb
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I participate almost every year but I don't care about the leaderboard. The timezone play a crucial role in being able to be ready at the right time, so actually who cares? I prefer to build private leaderboards with my friends and colleagues.
Yep, there was; they even wrote so in their commit message before removing it: https://old.reddit.com/r/adventofcode/comments/1h3w7mc/2024_...
Caring about the leaderboards is the problem. Are you (impersonal) seriously doing AoC for clout or something?
The primary reason to not care about AoC leaderboards is that that it penalizes people for being in the wrong time zone. That said, the top 100 or so contributors clearly do care about these things and using an LLM is cheating.

In particular the LLM cheating isn’t just by conjuring a solution: humans don’t get ASCII characters pumped directly into their brain, we have to slowly read problem descriptions with our eyes. It takes humans more than 9 seconds to solve AoC #1 purely because of unavoidable latency.

If people are concerned about leaderboards there are private leaderboards: https://adventofcode.com/2024/leaderboard/private

Personally I don't do it to compete, I just like puzzles.

  • nicce
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I did it without AI last year and planning to do it again, for fun.
  • zwnow
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
True. Leaderboards are and always have been full of cheaters.
It was, of course, an AI-generated solution; they posted it here: https://web.archive.org/web/20241201052156/https://github.co...

Later, after being called out on it, they posted an apology to their GitHub profile (https://web.archive.org/web/20241201064816/https://github.co...): "If you are here from the AoC leaderboard, I apologize for not reading the FAQ. Won't happen again."

Both the repo and that message are now gone.

For comparison, here's how long it took in past years:

    2015 - 10:55
    2016 -  7:01
    2017 -  1:16
    2018 -  1:48
    2019 -  1:39
    2020 -  7:11
    2021 -  1:07
    2022 -  0:53
    2023 -  2:24
And this year's second place was 0:54.
Note that regarding the outliers, in 2015 and 2016 the puzzles weren't as widely known, and in 2020, AWS' load balancers crashed and the puzzle was unavailable to most people for 6 minutes, then solved in a few minutes. https://adventofcode.com/2020/leaderboard/day/1 -- postmortem: https://old.reddit.com/r/adventofcode/comments/k9lt09/postmo...
OpenAI did something similar with their o1 model. Ran a coding problem through o1 thousands or maybe millions of times and then checked if the solution was correct.

I can imagine a great pipeline for performance optimization: 1. have an AI generate millions of tests for your existing code 2. have another AI generate faster code that still makes the tests pass

So I guess all I want for Christmas is a massive compute cluster and infinite OpenAI credits :P

AI coding assistants ruined the global leaderboard experience. AoC might as well nerf it by discarding the quickest x percent of submissions, or something...
It's not that bad. I'm sure there are more LLM'ers in there than the one, but you can tell that the majority of the day 1 leaderboard is made up of people who have historically performed well, even before LLMs were a thing.

Compare https://adventofcode.com/2024/leaderboard/day/1 to e.g. https://fuglede.github.io/aoc-full-leaderboard/

There was also at least one instance of people working together where you would have 15 people from the same company submit solutions at the same time, which can be a bit frustrating but again, not a huge issue.

Okay, I think I have to go ahead and retract my own comment. Day 5 appears to have been sufficiently tricky for humans to do quickly while still easy enough for the LLMs that it is clear that there is a very large amount of cheating going on.
I have a rule in life: no summary statistics without showing the distribution.

Usually this goes for any median which might be in a sneaky bimodal distribution of, say, AI models vs humans. I guess it applies to leaderboards too though.

  • exitb
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Potentially the challenge just doesn’t make as much sense anymore? There apparently are „mental calculations” competitions and I’m sure their participants have fun. Yet I can hardly imagine doing arithmetic in ones head is any fun for an average mathematician. The challenge just shifted elsewhere over time.
They should check that LLMs can't solve the problems in 9 seconds and come up with appropriate problems. Or just allow AI assistants, they are now as much part of the programmer's toolkit as syntax highlighting or autocomplete or Stack Overflow, and pretending otherwise is not useful.
Not gonna happen. AoC always starts with beginner level problems. That's why it's so commonly used for learning the basics of new languages.

A problem that wouldn't be immediately solvable by LLMs would either be too advanced or simply too large to be fun.

This is probably where programming as a whole is going. Many of the things that make programming fun for me, like deeply understanding a small but non-trivial problem and finding a good solution, are gonna be performed much faster by LLMs. After all most of what we do has been done before, just in a slightly different content or a different language.

Either LLMs will peak out at the current level and be often useful but very error prone and not-quite-there. Or they'll get better and we'll be just checking their output and designing the general architecture.

The first few days are supposed to be beginner-accessible, it's practically impossible to have something beginner accessible but GPT-inaccessible.
That's like going out for a run and taking an electrical scooter around the park instead. The point isn't finishing, the point is doing the activity.
Then why have a leaderboard?
Because someone likes to compete? There are 5k races as well, which people enjoy to do even though vehicles exist. And people would rightfully be upset if they got beaten by someone not running themselves.
And then allow aimbots for counterstrike, stockfish at chess tournaments and Epo on the tour de France. The leader board is intended for people to compete against each other, one could make a separate leaderboard for LLM, kind of similar to the chess AI leaderboards.
> allow aimbots for counterstrike

I'm not played counterstrike in over a decade, so you got me wondering - are there matches where everyone uses aimbots? What does the game look like then? I suppose there's a new mix of strategies evolving, with a higher focus on the macro movement planning?

> are there matches where everyone uses aimbots?

Yes

> What does the game look like then?

I have only observed the games, it requires a lot of hiding.

Most of the time the winning method is to act at the very last second and hope the other player is distracted.

False equivalence. The sole reason for counterstrike and chess to exist is competition. Programming is about solving a problem. If you want to turn programming into a competition you shouldn't take away tools from the programmer.
You’re saying programming isn’t not equivalent to chess here because programming isn’t a competition, but the Advent of Code leaderboard very much is a competition.
  • exitb
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I wonder how many seconds could be won by the organizers if the challenge included a blant prompt injection breaking the result.
Without condoning cheating, I am impressed with the automation aspect of it. 9 seconds sounds more or less like the inference time of the LLM, so this must have been automated. Login at midnight + lots of C&P may not have done it.

Perhaps there is a scope for an alternative AoC type competition aimed at AI submissions...

...though of course that would be experimenting to get us all out of work. Hmm.

  • zwnow
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
If real life problems were as easy and defined as AoC problems we might be able to be replaced at some point. I highly doubt you can replace software devs otherwise. Who else is going to take the blame for software issues?
"Write me a snippet that does X" is a step behind "figure out how to log into this page, download the data, write a snippet that gives the right answer to the sample data, then run it on the real thing and submit the output to the text box".
As with real life, the speed generally doesn't matter as long as you get a working solution and you find it fun. If you find "copy and paste into an LLM and then copy and paste the answer back out" fun, then I suppose you do you.

I didn't realise it was be timed, which is good because I casually set up a new rig to give future puzzles some kind of rig. I used C# which, although probably more wordy than other solutions, did the job and LINQ made light work of the list operations. Ended up with about 6.5 minutes for each one but most of that was refactoring out of pedantry.

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
  • rvz
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
At this point, it just shows that Advent of Code is completely worthless given the ease and accessibility of AI-assisted tools to solve these problems.

RIP Advent of Code.

Why? Solving interesting problems to learn is a worthwhile goal. Why should it matter to you that others are "cheating"?
Because competing against other people is the fun part for some people. Why not allow everyone to use stockfish at chess tournaments?
“For _some_ people” is at odds with “_completely_ worthless”, don’t you think?
To be fair, I read it as "_completely_ worthless for _some_ people"
  • zwnow
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
This is stupid though. Advent of Code Leaderbords were always full of cheaters. At least since 2020 when I first started. If you want competitive programming, AoC is not the place for that.
Sarcasm?
Nice to see that traditions are upheld, such as the unreadable font and colors.
And the timeless tradition of HN commentators cynicism
And the timeless tradition of criticising perfectly valid concerns. Not everyone wants to be a member of the dark mode lobby.
I had to fiddle with the colours in the web inspector to even read the page. So yeah...

Of all the cynical comments I see on HN, this ranks very very low.

Reader mode or "View -> Page Style -> High contrast" in your browser works perfectly fine.
And the timeless tradition of HN commentators contempt
Wouldn't have it any other way :)
It's a simple webpage. If you don't like it, you can customize the CSS with a few custom rules in your browser.
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Reposting a comment below: I used Stylus[1]. There are already some considerably more readable themes by the community.

[1]: https://github.com/openstyles/stylus

Personally I love the esthetic and hope they never change it.
  • xPaw
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Yeah, I made a userscript for myself to fix that up: https://gist.github.com/xPaw/4fffaf776fe14d15c9602991f51dbfa...
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I love AoC, but I hate the timing. December is always the busiest month of the year, so I really almost never find the time for it :(
You don’t have to do it in December. I was still working on last years in March.
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
[flagged]
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
[flagged]
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Is there a way to override the CSS (on Chromium)? The body font and weight, Source Code Pro is far too thin and far too wide and gives me a headache (and has regularly turned me off AoC). I'd like to change it to `sans-serif`.
Self-response: Stylus is useful here[1]. There is a list of already more readable styles than the default that the community has prepared.

[1]: https://github.com/openstyles/stylus

  • 9029
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I have used Stylus for CSS tweaks: https://addons.mozilla.org/firefox/addon/styl-us/
You can hit the "Reader" button on Firefox (ctrl-alt-r), I think Chrome also has that? Or an extension that does the same thing would probably work.

Bit simpler than writing an override or fetching the HTML.

  • babo
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
There are CLI tools to fetch and submit solutions. At least one of them allows you to download the puzzle description as markup: https://github.com/scarvalhojr/aoc-cli
On thing you can do is fetch the html and extract the main content to display it in your favorite way, it's been stable for years, and you can use the (stable) session_id cookie, it's how many people approach the challenge.
I'd just create a bookmarklet or run JS in devtools: `document.body.style.fontFamily = "sans-serif";` etc
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
[flagged]
[flagged]
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
[flagged]
[flagged]
  • devit
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
[flagged]
Using an AI to solve AoC is like taking an art class and complaining that the still life exercises aren’t very interesting because your camera can capture the image quickly.
This is already answered right on the about page[0]. AoC is meant to be an educational experience, feeding it directly into a LLM isn't that.

> The leaderboards are for human competitors; if you want to compare the speed of your AI solver with others, please do so elsewhere. (If you want to use AI to help you solve puzzles, I can't really stop you, but I feel like it's harder to get better at programming if you ask an AI to do the programming for you.)

[0] https://adventofcode.com/2024/about

Work on a side project this December instead of doing this. Solving advent of code just keeps you in your comfort zone. Creates a false sense of accomplishment. Redirect all the positive energy to something that will make you proud when you are old or help with an earlier retirement. This won't.
Advent of Code is fun, I like having fun! I have no shortage of challenges and things to be proud of, but when I’m old I don’t want to look back and realize I didn’t take the time to find little moments of joy along the way.

Everyone’s different, and it sounds like AoC isn’t for you, but remember not everyone is you :)

I used it to spend time in Haskell. You won’t win any prizes for speed, but it’s a good way to learn a bunch of new stuff.
That's fair. Just sending the message out to folks who are in similiar space and might do a reconsideration.
> Redirect all the positive energy to something that will make you proud when you are old or help with an earlier retirement. This won't.

So if some activity [work] doesn't contribute to your ability to never have to work again [retirement], you shouldn't do it?

What if I've retired, am I allowed to do AOC then? Or then does the first rule of, only do something the future you would be proud of apply?

What if all of the things I'm proud of are just a false sense of accomplishments? How do I know when I'm actually allowed to be proud of it, or if it's just a false sense of pride?

  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Or use it to practice a language that you just wanted to give a spin.
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
Yet you're on HN instead of working on your sideproject.
Learn to let go of the constant need to be productive.
  • ·
  • 3 weeks ago
  • ·
  • [ - ]
I’m gonna do a side project because it’s more fun and useful to me.
> help with an earlier retirement.

Like car accident?

No. Like make so much money that you can do whatever you want.