Kurt Schwind · @Discordanian
27 followers · 160 posts · Server techhub.social

Just 81 days left until !!!!

#adventofcode

Last updated 1 year ago

atkiw · @kate0543
1 followers · 8 posts · Server techhub.social

I've completed "Calorie Counting" - Day 1 - Advent of Code 2022 adventofcode.com/2022/day/1

#adventofcode

Last updated 1 year ago

Sotolf · @sotolf
649 followers · 1544 posts · Server social.linux.pizza

This is one of my favourite kinds of excercises, where you have to set up a simulation and let it run, I had a lot of fun with it, so I may have overengineered it a tad bit, but I'm kind of proud of this one :)

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
648 followers · 1528 posts · Server social.linux.pizza

So another optimising puzzle here, part 1 was troublesome at first because I used the wrong datastructure, got that changed over to an IntSet, and then I got that running pretty smoothly.

For the second part though 50 000 000 000 iterations is a lot, and I didn't find any looping, I'm also terrible at these, so after a little while I had to look at some hints, and then it was pretty obvious.

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
648 followers · 1499 posts · Server social.linux.pizza

This was rather fiddly to get to work, first thing I tried was way too slow, then at least I found a way to optimise it a bit, it's still slow, but now runs in ~1 min in debug mode or 0.52 sec in fully optimised mode (-d:danger) never really thought of trying that since I mostly just run these in debug mode and it's quick enough.

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
648 followers · 1476 posts · Server social.linux.pizza

This was a really easy one, but it was fun, I like these that create some ascii art, the only thing I had to do here was to just binary search my way into figuring out the size of the characters, and then it just showed up correctly :)

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
647 followers · 1469 posts · Server social.linux.pizza

For fun this time I implemented a doubly linked ring manually, since I didn't really need that many operations to do on it, it was quite a fun excercise, the second part is a bit slow, but I'm sure I could make it faster, I just don't feel like it right now.

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1575 posts · Server social.linux.pizza

I really had a lot of fun with this one, was a bit difficult to wrap my head around in the beginning, but when I got it it was a fun goal to build towards.

It was a lot of fun to build some custom iterators for this one, it was way easier than I thought it would be, and just feel really natural to use, I love how nim's syntax both feels so cohesive and still so flexible :)

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1573 posts · Server social.linux.pizza

Having done some experimentations with a gapbuffer actually helped quite a bit with this one, I also think it's the only time I've ever used xor in an if statement before :p

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1571 posts · Server social.linux.pizza

Got to try out some date stuff in nim, like the rest of the language it felt intuitive. Also more for fun I tried out using range-types, which are pretty nice, that way I could make sure that the month would be in the range 1..12 and the day in the range 1..31 very nice to make sure your numbers aren't something you didn't expect :) it's like an int enum :p

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1546 posts · Server social.linux.pizza

So today I learned that nim has Levenstein distance algorithm in its standard library, that's nifty, also breaking to labels was useful in this one, in the first part countTable made it pretty trivial.

codeberg.org/sotolf/adventOfCo

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1567 posts · Server social.linux.pizza

This is a bit slow, there is probably a good way of making it more performant, but the code looks and feels really nice :) so that is good, function overloading and UFCS makes this pretty nice :)

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
643 followers · 1561 posts · Server social.linux.pizza

I have to say I had to find some help on this one, for the first one I used a singly linked ring, and since it was small it went fast, when we then expanded it in orders of magnitude everywhere the searching for a number got way too slow, I read that many used an array where each "link" was stored, and using this I could do lookups in normal array time rather than having to scan through in the worst case a million pointers.

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
639 followers · 1498 posts · Server social.linux.pizza

Man of man this ended up as a fucking mess of a solution, took me ages to get right, now my code has a lot of repetition, and parts that could probably be redone otherwise, not even sure it would work for other inputs than mine, but it works :D

That took me 3 days or something, and now it finally works :D

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
629 followers · 1340 posts · Server social.linux.pizza

At first I thought a 3D game of life was complex, but I did it, then I had to solve a 4D game of life, and I was getting nervous, luckily it worked out :)

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Luke · @ltriant
157 followers · 643 posts · Server hachyderm.io

It's disgustingly early to be thinking about it, but I'm getting excited for this year.

#adventofcode

Last updated 1 year ago

Sotolf · @sotolf
626 followers · 1383 posts · Server social.linux.pizza

Once I finally wrapped my head around how 90º rotations work in a coordinate system this one wasn't that bad.

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
624 followers · 1479 posts · Server social.linux.pizza

This was another fun one, first a DFS through containers, and then afterwards I'm not quite sure what that algorithm is called but it was basically the other way that I can use to avoid recursion, nim doesn't do tail call elimination, so will have to work with a queue or a stack, I kind of find that easier to work with anyway :)

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Sotolf · @sotolf
622 followers · 1465 posts · Server social.linux.pizza

I really enjoyed doing this one, and I did get to use one of my favourite nim tricks, using an array with enum indices to emulate a small hashtable with a set number of fields.

Just that little thing guided the rest of the programme in a way that made it very easy to do, and the compiler kept telling me when there was a case I still hadn't handeled, which is wonderful :)

codeberg.org/sotolf/adventofco

#adventofcode #nim

Last updated 1 year ago

Enthalpiste · @Bibobu
287 followers · 649 posts · Server mastodon.xyz

22/50 étoiles sur le de 2015 en pour l'apprendre (vu qu'on me le vend comme le futur).

Slowly but surely... je dois admettre que c'est quand même vachement bien comme langage.

Bon j'étais monté à 40 en 2020 en mais je prends mon temps.

#adventofcode #julialang #python

Last updated 1 year ago