I just completed "Disk Fragmenter" - Day 9 - Advent of Code 2024 #AdventOfCode in #ruby
I abandoned a whole strategy (stuck at off-by-1s) and tried a completely different approach.
You can peek: https://gitlab.com/oinak/advent-of-code-2024/-/tree/main/day09
=> More informations about this toot | More toots from oinak@ruby.social
@oinak
A bit lengthy, but written so clearly that I understood what you did, despite not knowing Ruby at all.
I guess, nobody said that about my code I publishes this morning. 😁
Good job!
=> More informations about this toot | More toots from mina@berlin.social
@mina I had a "clever" version all doing math on indexes/size/values vecause I feared the unfolded-input-size memory impact... but I got stuck on off-by-ones and my brain was oozing out my ears, so I scraped it all and started anew prograing ruby the way I like, very semantic/domain-close, not very perf-oriented.
It took 20s on part 2, so "good enough".
Reading your code I get nostalgic, I learnt Perl long before Ruby (but used it much less) and still see its influence often on ruby's ancestry
=> More informations about this toot | More toots from oinak@ruby.social
@oinak
Although, it's not what I usually do, I totally believe in good semantics.
If I manage to do tomorrow's assignments quickly ("if", because it very well might be a toughy), I shall try to make something readable.
=> More informations about this toot | More toots from mina@berlin.social
@mina you know Larry Wall is going to put you on the "naughty" list, right? 😈
=> More informations about this toot | More toots from oinak@ruby.social
@oinak
I know that very well.
BTW: I learned Turbo Modula in uni in the late 80s.
=> More informations about this toot | More toots from mina@berlin.social
@mina I learned TurboPascal! I wonder if there is a rule forcing universities to teach you something called /Turbo.*/ ?
=> More informations about this toot | More toots from oinak@ruby.social
@oinak
It was all the rage of the time.
Remember the "turbo" button on PCs?
=> More informations about this toot | More toots from mina@berlin.social
@mina yes I am that old, my first "program" (DOS batch) was written on this https://en.wikipedia.org/wiki/PC1512
=> More informations about this toot | More toots from oinak@ruby.social
@oinak
We must be roughly the same age.
My first "real" computer (after the ZX81) was a 286 AT, slightly more powerful than your machine.
=> More informations about this toot | More toots from mina@berlin.social This content has been proxied by September (3851b).Proxy Information
text/gemini