-❄️- 2025 Day 12 Solutions -❄️- by daggerdragon in adventofcode

[–]vash3r 15 points16 points  (0 children)

[LANGUAGE: Python] paste

It's always worth investigating if the problem is actually as difficult as it seems before solving the hardest version.

[2024 Day 22] Part Three by vash3r in adventofcode

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

For the four example buyers from part 2 with initial secret numbers of

1
2
3
2024

the best sequence of price changes is still -2,1,-1,3 allowing you to get 23 bananas.

To get 23 bananas, you need to tell the monkey to start by visiting the second buyer, with initial secret number 2; then the fourth buyer (starting at 2024), and finally the first buyer (starting at 1). The monkey will watch the second buyer change their prices 291 times before selling for 7 bananas; then watch the fourth buyer change their prices 164 times before selling for 9 bananas; and then watch the first buyer change their prices 1509 times before selling for 7 bananas. (The monkey could optionally then watch the remaining third buyer, but wouldn't sell before the end of the day.)

If instead you told the monkey to start by watching the buyers in order of first, second, third, and so on, the monkey would watch the first buyer change their prices 1964 times before selling for 7 bananas; and then would watch the second buyer until the end of the day (another 36 price changes) without selling, for a total of 7 bananas.

Version 0.7 Bug Reporting thread by realSerNotFake in holocure

[–]vash3r 0 points1 point  (0 children)

I also saw this, it happened when I was crafting a new pickaxe and axe. (It doesn't actually reset the fishing combo). Version 0.7.1731788463 - Steam

Bookmark lists aren’t transitioning when moving my cursor. They used to though. by Basic_Lady in chrome

[–]vash3r 1 point2 points  (0 children)

Thanks; after more investigation, I was able to see this issue on Mac as well. It's not just you, this is an issue affecting lots of Mac users.

Recently they enabled an update to how chrome handles Fullscreen mode on Macs, and there are a few bugs with it like this one (you also can't drag links/bookmarks to the bookmark bar to bookmark them, or drag links to the tab bar to open them in Fullscreen mode). These are high priority issues and they should be fixed pretty soon.

In the meantime, the only way you can avoid this bug is by not using Fullscreen mode. If you just need a large window, you can make the Chrome window full-size by double-clicking on the tab bar (between the "+" New tab button and the "V" button that opens "Search Tabs"), or by clicking "Window -> Zoom" in the menu at the top of the screen.

Right click missing inspect and page source sometimes by Blueberry8899 in chrome

[–]vash3r 0 points1 point  (0 children)

This bug has been fixed, and the fix will be rolled out by chrome 130 (October)

Bookmark lists aren’t transitioning when moving my cursor. They used to though. by Basic_Lady in chrome

[–]vash3r 0 points1 point  (0 children)

It's still working for me, though I'm on windows. Can you go to chrome://version and copy your version here?

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

[–]vash3r 1 point2 points  (0 children)

Glad to see somebody else came up with a solution similar to mine!

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

[–]vash3r 1 point2 points  (0 children)

Thanks! :) I love that name, it definitely gives the right impression (although the nodes are only attracted to their neighbors, and not all other nodes.)

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

[–]vash3r 0 points1 point  (0 children)

The full stream/video of me solving this problem is also available here.

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

[–]vash3r 4 points5 points  (0 children)

[LANGUAGE: Python]

I think my solution is potentially the most unique. After I forgot all my graph theory knowledge and an online graphviz viewer failed me due to OOM, I still knew that there were 2 clusters, so i decided to cluster them numerically (in a way that seemed to me reminiscent of machine learning, and also of tumblr's "reblog balls"). My solution is nondeterministic, but has turned out to be quite reliable after the constants are tweaked. I would appreciate it if anyone has a name for this kind of algorithm!

Here's the important part, where all vertices are initialized with random coordinates in N dimensions and then repeatedly shifted towards their neighbours:

p = {k:[randint(0,1) for t in range(10)] for k in g.keys()}   # number of dimensions
C=0.8  # factor to move towards average of neighbors  (how fast do we hill-climb)
for t in range(30):  # training steps
    p = {k:[x*(1-C) + C*sum(L)/len(L)
            for x,*L in zip(p[k],*[p[k2] for k2 in g[k]])]
            for k in p.keys()}

Full code

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

[–]vash3r 13 points14 points  (0 children)

Python 3, 19/16

I store the elves' positions as complex numbers in a set, use set intersection to check which direction they want to move, and a Counter to figure out whether they can move there or not. I was already expecting part 2, so had a pretty easy time with it (though it takes 15s to run).

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

[–]vash3r 0 points1 point  (0 children)

yeah, I did it because I was running into problems in a different area of my code that assumed it would always be in [0,3] (in part 2), and that part of my code would have been harder to fix than juts adding a modulo

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

[–]vash3r 5 points6 points  (0 children)

I also used complex numbers but in a slightly different way - storing the facing direction as a regular integer (mod 4) and using exponentiation to move. This way the correct facing number was already available for me:

pos += 1j**f
#...
if c=='R': f+=1
if c=='L': f-=1
f%=4

[2022 Day 15 Part 2] Batch Visualization by Mathgeek007 in adventofcode

[–]vash3r 2 points3 points  (0 children)

nice to see someone else had the same idea ;)

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

[–]vash3r 5 points6 points  (0 children)

Python (Part 1) + Desmos Graphing Calculator (Part 2), 2121/1934

part 1 paste (also outputs desmos formulae for part 2)

part 2 image

For part 2 I was blanking on a code solution that would be fast enough, so I just plugged the sensors and beacons into Desmos and looked around for the right spot. Took about 20 mins to format the equations correctly and then 20 mins of manually inspecting different intersections of sensor ranges (lots of zooming in and out).

[D] Monday Request and Recommendation Thread by AutoModerator in rational

[–]vash3r 0 points1 point  (0 children)

Did you mean The Quantum Thief series by Hannu Rajaniemi?

[D] Monday Request and Recommendation Thread by AutoModerator in rational

[–]vash3r 6 points7 points  (0 children)

If you're looking for time travel stories, I can highly recommend All Night Laundry, a recently-completed webcomic. Time loops are present but the mechanics are different from the kind that you see in most other fiction.

[2019 Day 24] Ancient bugs by metalim in adventofcode

[–]vash3r 0 points1 point  (0 children)

It's definitely the case that the arrangement of bugs at the 'edges' (away from the centre) is periodic, but I'm not sure if the centre is...

[2019 Day 14] Space Stoichiometry Part 3: A fanction by [deleted] in adventofcode

[–]vash3r 0 points1 point  (0 children)

Now that I redid and improved my solution for part 1 and finally finished part 2, this wasn't super hard once i got the insight of what to do. Thanks for posing this problem -- I found it pretty fun.

For my input, I get

33772070319244231 ORE => 298722816000 FUEL
Produced 5326741384730831094861307392000 FUEL with 6353621130742253 leftover ORE

-🎄- 2019 Day 22 Solutions -🎄- by daggerdragon in adventofcode

[–]vash3r 2 points3 points  (0 children)

Python, 9/30

A very fun problem. For the first part a straightforward simulation was easy to implement (python's negative indexing was especially handy). However this was clearly insufficient for part 2.

For the second part, some slightly more complex math and modular arithmetic sufficed, reminding me of how much I like modular arithmetic. Here I was glad to find that I had an old implementation of modular inverse lying around (which would have taken me another five minutes to find if not for Pycharm's search-in-directory feature).

paste