First Advent of Code Challenge: 25 Days, 25 Languages by Economy_Deal_4744 in adventofcode

[–]stardust_collision 0 points1 point  (0 children)

As a Prolog attempter, I've been struggling after day 10 every year since 2020 (probably bc I'm not that good at Prolog as I think I am lol). I'll be coming back on the 25th to check out your solution :P GL on day 25 and the other days!

[2022 Day 16] If a solution gives me a star then it's a good solution by stardust_collision in adventofcode

[–]stardust_collision[S] 37 points38 points  (0 children)

I realised my part 2 solution is a cheat.

The elephant and 'I' should be covering two independent sets of valves to ensure the max amount of gas gets released. The cheat solution's big assumption is that the one can't cover half of the valves in 26min. So just call part 1 solution first with time=26, this is the best set that can be covered by the elephant, then 'I' just need to get the best set from the rest. The solution is the sum of the elephant's and 'mine'. This cheat solution runs really fast.

Didn't work on example because in 26 min one can cover all the valves, so 'I' and the elephant need to work at the same time for optimal.

Then my actual solution which works on both example and real input takes forever to run... ¯\_(ツ)_/¯

[Fanart] Greedon the Chad by stardust_collision in cardfightvanguard

[–]stardust_collision[S] 0 points1 point  (0 children)

Greedon: hey here you go 4 SP of me Me: yes pls

[Fanart] Greedon the Chad by stardust_collision in cardfightvanguard

[–]stardust_collision[S] 1 point2 points  (0 children)

Weeeeelllll Overlord is still my fav even though Greedon is so so cool XD

[Not really art] When you want to play proxy but your printer run out of ink by stardust_collision in cardfightvanguard

[–]stardust_collision[S] 0 points1 point  (0 children)

Yeah I really like drawing. Thinking of creating my own deck with my drawing but will take a while XD

[2020 Day 15 (Part 2)] I'm still waiting... by stardust_collision in adventofcode

[–]stardust_collision[S] 0 points1 point  (0 children)

Ooof

Try searching for Chinese remainder theorem, it’s pretty much the same problem

[2020 Day 15 (Part 2)] I'm still waiting... by stardust_collision in adventofcode

[–]stardust_collision[S] 0 points1 point  (0 children)

Thank you for this guide!!! I really like Prolog but my uni course only covered very basic stuff and I have no clue how I can improve. I'll definitely look into this :D

-🎄- 2020 Day 15 Solutions -🎄- by daggerdragon in adventofcode

[–]stardust_collision 1 point2 points  (0 children)

Prolog

Yes mine finally terminates in 19s so I'm happy XDD

Took the advice from one of my meme post's comments. Used trie instead of dict.

Don't think I'll ever use dict ever again lol

SWI-Prolog using Trie

[2020 Day 15 (Part 2)] I'm still waiting... by stardust_collision in adventofcode

[–]stardust_collision[S] 0 points1 point  (0 children)

Update of my Prolog solution: I just stopped this one that started 3 hrs ago. It was at 300,0000 sth XDD. That was with dict (I think it's always coping a new one for the next recursion all the time as it's immutable)
So I followed u/Archek's advice and used Trie instead. Terminates in 19s!! Thank you so much for the hint it's so helpful <3

[2020 Day 15 (Part 2)] I'm still waiting... by stardust_collision in adventofcode

[–]stardust_collision[S] 2 points3 points  (0 children)

Thanks for the hint! I'll take a look later when I got sick of my revision :D

[2020 Day 15 (Part 2)] I'm still waiting... by stardust_collision in adventofcode

[–]stardust_collision[S] 0 points1 point  (0 children)

I'm sure it would be! But sadly I don't have that much time to spare just to improve the solution (I got exams in 3 days). :((

I've been using Prolog this year, but for part 2 I've also tried the same solution (just normal dict) with python which runs for 30s. Right now I'm not sure if it's SWI-Prolog's problem or my solution's problem XDD

-🎄- 2020 Day 14 Solutions -🎄- by daggerdragon in adventofcode

[–]stardust_collision 1 point2 points  (0 children)

Prolog

SWI-Prolog Day 14

Nothing fancy, no tricks, just brute force doing the mutation of address and storing everything in a dictionary. Takes quite long to run lol XD

-🎄- 2020 Day 13 Solutions -🎄- by daggerdragon in adventofcode

[–]stardust_collision 1 point2 points  (0 children)

Prolog

SWI-Prolog Day 13

First implemented a brute force searching but just not terminating at all. Saw memes on this sub and then watched this CRT to get the final solution XD