Other challenges (in advent and not in advent) like advent of code: https://github.com/NoelJacob/advent-and-other-calandars Compiled by myself.
Advent of Code 2024
461–470 of 580 posts
Re: Advent of Code 2024
#462Earlier 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.
Re: Advent of Code 2024
#463This 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.
Re: Advent of Code 2024
#464Earlier 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
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
#465Earlier 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?
I also don't see how it would be possible otherwise.
Re: Advent of Code 2024
#466And here I am doing it in Ruby instead of Java this year thinking I was giving myself a challenge.
Re: Advent of Code 2024
#467Earlier 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.
Re: Advent of Code 2024
#468Earlier 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.
Re: Advent of Code 2024
#469Earlier 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...
Re: Advent of Code 2024
#470I’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 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.