Live data from Hacker News

Advent of Code 2024

adventofcode.com

461–470 of 580 posts

Re: Advent of Code 2024

#461

Other challenges (in advent and not in advent) like advent of code: https://github.com/NoelJacob/advent-and-other-calandars Compiled by myself.

Hey! Thank you. I have updated mine to include the ones from your list.

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

Re: Advent of Code 2024

#462
post #160
post #76

Earlier quoted context omitted.

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.

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.

Re: Advent of Code 2024

#463

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!

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!

Re: Advent of Code 2024

#464

Earlier quoted context omitted.

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.

- 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

> 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.

Re: Advent of Code 2024

#465
post #84

Earlier quoted context omitted.

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?

See https://news.ycombinator.com/item?id=42287377

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

Re: Advent of Code 2024

#467

Earlier quoted context omitted.

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).

Re: Advent of Code 2024

#468

Earlier quoted context omitted.

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 mig…

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?

Re: Advent of Code 2024

#469
post #410

Earlier quoted context omitted.

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.

Re: Advent of Code 2024

#470
post #138

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 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.
Post reply on HN