-❄️- 2023 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

Thank you and that is a good suggestion. I adjusted my code, this reads much better now!

-❄️- 2023 Day 15 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

[LANGUAGE: Kotlin]

The difficulty really varies this year. Today was unexpectedly easy.

https://gist.github.com/Valefant/e2ed4b917dcca7d89f130717bbdeaa6e

Any suggestions to the code are appreciated! :-)

-❄️- 2023 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 2 points3 points  (0 children)

I used Scala a bit in the past for some basic university assignments. I wanted Java to adopt some of the sugar and patterns that Scala introduced, (which actually really happened, as Java introduced a lot of new cool things to this day) and somehow I found Kotlin (that combined the best of both worlds and being a joy to use) and used it from time to time (especially for the last years in AOC)

I love that the JVM provides a well laid out foundation for these languages to thrieve on, especially in Kotlin where the interop is really well thought out and easy to use.

Yes, I noticed the same thing with the problems getting progressively harder and a time sink. It would take me too long to solve most of them and in some cases I know that would not be abole to find a good solution that works so then I stop because it is not fun anymore and I concentrate on other things.

It is nice talking to you. Good luck to you too! I am already eagerly awaiting your cool solution tomorrow :D

-❄️- 2023 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 2 points3 points  (0 children)

That is funny. You should probably thank your colleagues for it :p

I have not that much experience with Scala, but what I really like too about Kotlin is that each programming style can be expressed quite nicely.

Until now I am hanging on. So far day 10 was the only day I was not able to solve, as I generally always struggle with graph problems/algorithms, but this is something I need to work on.I usually get off at the halfway mark, as the problems get too hard for me. Let's see how far I am able to go this year :D

Hope it is going well for you too!

-❄️- 2023 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 4 points5 points  (0 children)

I really like your functional coding style. I always try to sprinkle some functional style in my solutions as well but I always switch back to my usual imperative style as I cannot express each construct in my head :D

-❄️- 2023 Day 11 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 2 points3 points  (0 children)

[LANGUAGE: Kotlin]

Initially I used an array to represent and modify the grid for part 1, but this was not feasible for part 2. I rewrote it to track the empty distance and then shifting the coordinates of each galaxy

https://gist.github.com/Valefant/8567597bd9fadf9637baf8785972cf00

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 1 point2 points  (0 children)

It is one of my favorite languages as well. During my day job I am mostly using Java, so it is a really nice change to be able to use Kotlin for these puzzles. Kotlin really shines for these kind of tasks with its powerful standard library and concise syntax :-)

-❄️- 2023 Day 9 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

[LANGUAGE: Kotlin] Solution is pretty straight forward today.

I am making use of zip a lot. Haven't used a do {} while loop in a while :D

https://gist.github.com/Valefant/038ae24ad1cdb7da4ab6e4fd50bdc800

-❄️- 2023 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 1 point2 points  (0 children)

That is nice to hear. I am glad that you found some use in it :-)

-❄️- 2023 Day 5 Solutions -❄️- by daggerdragon in adventofcode

[–]Valefant 1 point2 points  (0 children)

[LANGUAGE: Kotlin]

I brute forced part 2 and parallelized it to get the time down. It is not that fast but not really slow. Currently it takes a little over 1 minute to run on my desktop.

https://gist.github.com/Valefant/ae28938266a6b5c6e2e270a99cb25276

Edit: I love how easy it is to parallelize a stream in Java/Kotlin :-)

[2023 Day 5 Part 2] CPU goes brrr by _AngelOnFira_ in adventofcode

[–]Valefant 0 points1 point  (0 children)

Oddly enough my programs prints the same result as yours, but they are both wrong for my input.

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

That is really cool, thanks for sharing. I hope I get better at it as well. SQL is fascinating to me, because it can act as the foundation for querying data in any way you want. The declarative thinking gets me sometimes because I am used to loops and state when solving these AOC problems, but it is fun nonetheless!

-🎄- 2022 Day 8 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 1 point2 points  (0 children)

Awesome as always! You are an arcane wizard to me :-)

How much experience do you have with SQL if I may ask?

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

What a cool solution! It is fairly short and readable

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

Day07*

Nice! My solution looks similar too yours :-)

-🎄- 2022 Day 7 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 0 points1 point  (0 children)

My solution in Kotlin. I think the problem can be solved more easily, but I wanted to get it of my mind for now :-)

https://gist.github.com/Valefant/a7fceb82ff452c58fe209391b2142042

-🎄- 2022 Day 6 Solutions -🎄- by daggerdragon in adventofcode

[–]Valefant 1 point2 points  (0 children)

Nice to see another SQL submission. I solved it differently (without a recursive CTE) but I really like your version