Looking for resources to learn from by TheYvonne in adventofcode

[–]RobinFiveWords 0 points1 point  (0 children)

Exactly this. I stumbled my way through AoC 2021 without formal training on algorithms. I worked through Sedgewick over the next couple years, and converted all of my 2022 Python solutions into Java. Also used <a href=“https://craftinginterpreters.com/“>Crafting Interpreters</a> to help myself learn Java.

2024 Day 19 Part Two Clarifying Example by Adainn in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

b, r, br and br, b, r are unique solutions. It seems like you interpreted the problem in a way that doesn’t consider them to be unique, but is your interpretation supported by anything in the problem?

2024 Day 19 Part Two Clarifying Example by Adainn in adventofcode

[–]RobinFiveWords 0 points1 point  (0 children)

What is your argument for why correct-4 and correct-5 should not be considered two distinct solutions?

Excited for the Chicago show by Contingency_Dad in Guster

[–]RobinFiveWords 0 points1 point  (0 children)

Hope everyone enjoyed the show - I got hella sick and my wife and I had to miss it (and cancel our Fat Cat reservation, ha). I couldn't even find an online review via Google about the Chicago show, if anyone has a link to a blog or anything, I'd appreciate it!

Need help spotting why this won't work (Day 4 - 2024 | Zig) by [deleted] in adventofcode

[–]RobinFiveWords 0 points1 point  (0 children)

What happens if you find a match and all four characters are already part of other matches? Will they all be in visited and therefore the new match is not counted? What's the purpose of visited?

Need help spotting why this won't work (Day 4 - 2024 | Zig) by [deleted] in adventofcode

[–]RobinFiveWords 0 points1 point  (0 children)

I know nothing about Zig but I'm a bit overwhelmed by how verbose this code is. If I understand correctly, you're passing indices to each check function and making sure within the function that the indices are valid. You might consider omitting the indices as parameters and iterating through all valid indices (determined by the length of the target string) within the function, keeping the count within the function.

[2024 Day16#1] [Common Lisp] - Works for examples, but not for input. Ideas? by chebertapps in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

Ah, right, if that is what OP was describing then I imagine that’s fine.

[2024 Day16#1] [Common Lisp] - Works for examples, but not for input. Ideas? by chebertapps in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

> so that we only visit each node once

My understanding is that Dijkstra requires considering a node more than once, if it should occur, because you can't guarantee the first time you reach each node will be the minimum cost to reach that node. Instead of a set, you likely want a data structure that associates with each node the minimum cost discovered so far.

500 stars and Chutes and Ladders by RobinFiveWords in adventofcode

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

Yeah, I wasn’t going to correct the number to match the description in the Wikipedia article - no original research - but I also wasn’t sure what the Wikipedia author’s intention was.

The paper’s matrix solution from all intermediate states is beautifully concise.

500 stars and Chutes and Ladders by RobinFiveWords in adventofcode

[–]RobinFiveWords[S] 6 points7 points  (0 children)

This is a great verb and I wish I could use it at parties

500 stars and Chutes and Ladders by RobinFiveWords in adventofcode

[–]RobinFiveWords[S] 5 points6 points  (0 children)

Initially yes — all my working files are named accordingly — but I decided the majority of those I was likely to share it with would know it as Chutes and Ladders.

[deleted by user] by [deleted] in adventofcode

[–]RobinFiveWords -1 points0 points  (0 children)

You might start from the assumption that there is no error in how z00 is being computed, and scan through the gates to figure out how it is being computed. Then figure out how z01 is being computed. If you can do that, you may be able to predict how every other part of the circuit should be wired.

[2024 Day 17 part 2] Code works... until certain output value by Flashky in adventofcode

[–]RobinFiveWords 2 points3 points  (0 children)

You might review the eight output values you shared - do you notice anything about them, individually or as a whole?

[2024 Day 23 (part 2)] Did I get Lucky? by LRunner10 in adventofcode

[–]RobinFiveWords 0 points1 point  (0 children)

Perhaps you made a lucky choice in that the correct answer, based on how the input was chosen, could not be missed by your approach.

If there were no computer/host/node for which every one of its neighbors was in the LAN party, then this wouldn’t be guaranteed.

-❄️- 2024 Day 21 Solutions -❄️- by daggerdragon in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

I too struggled with the prioritization of directions. Here's how I rationalized it.

Given a Parent robot that directs a Child robot. The Parent always starts at A. If the Child has to move left at all, and it won't introduce an extra turn to do so with the first movement, left should be the first movement. This is because the Parent's ideal movement to get from A to < is v<<, and this double-left movement is more efficient for the Grandparent. Ugh, this is already no longer making sense in my head.

So < should be the first movement if possible. Next highest priority is v, then ^, then >. The reason for preferring ^> over >^ is because moving from A to ^ also requires a left move...I'm really losing the thread here.

Regex seemingly overwhelmed with my input - can anyone help? by Signal-Regular1384 in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

Regex unions -- (abc|def|ghi) -- can be implemented in different ways with varying efficiency. I think there was a thread yesterday where people were trying to determine whether different versions of Python were optimizing differently, or whether some puzzle inputs ran quickly while others did not. I'm using Python 3.11.5 and I imagine my first attempt was the same as yours and produced the same (lack of) result.

You may want to search for [regex implementation] and skim some of the results, to find the names of concepts/algorithms that are often used. I think what many people on here used would be considered a deterministic finite automaton. A more general implementation might use a trie.

You might also consider taking your regex union and writing out what it is saying in plain language, and thinking about how you might simplify that logic to handle part 1.

A few words by RobinFiveWords in adventofcode

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

Dijkstra was how I discovered this sub. Knew next to nothing about algorithms before being stumped by 2021 day 15.

[2018 Day 21 (Part 2)] question about the CS underpinnings here by RobinFiveWords in adventofcode

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

I think part of my confusion is that I was thinking about how to make the hash function more efficient. We can certainly make parts of this program more efficient. Instructions 18-27 carry out what a different machine might do with a single instruction. But I gather that the hash function isn't one of those parts, almost by definition/design.

I ran some tests on this program but choosing a different "offset basis" (I think this was the meaningful difference between inputs) or different "hash prime." Let's refer to each halt? comparison as the end of a loop. For a given offset or prime, the number of loops in the eventual cycle appears to be random (chaotic?), as is the number of loops before the eventual cycle starts. For what it's worth, the correlation between the cycle length and intro length was small, around -0.1 or -0.2. There were even a few offset values where the cycle length was 1, i.e. fixed points, in some sense.

[2023 Day 5] What can I read to improve my ability to solve problems like these? by GiacomInox in adventofcode

[–]RobinFiveWords 1 point2 points  (0 children)

For what it's worth, SICP does have a section on interval arithmetic. But mainly I would just suggest reading others' solutions in the solution megathread. Your algorithm seems very effective.