Earlier quoted context omitted.
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?
Advent of Code 2024
511–520 of 580 posts
Re: Advent of Code 2024
#512Earlier quoted context omitted.
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.
Re: Advent of Code 2024
#513Earlier quoted context omitted.
- 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 neve…
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.
Re: Advent of Code 2024
#514Earlier quoted context omitted.
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
Any idea how close that is to valid J code?
Re: Advent of Code 2024
#515Earlier quoted context omitted.
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
#516I 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 t…
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)?
Re: Advent of Code 2024
#517Earlier quoted context omitted.
Claude will do it for you.
What is the point in doing a programming challenge if you aren't learning anything
Re: Advent of Code 2024
#518I 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 stitch…
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.
That is if you have nothing against using VSCode.
Re: Advent of Code 2024
#519I 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 t…
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)?
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.