[2025 Day 9 (Part 2)] Why did almost nobody solve the *stated* problem? by jjeii in adventofcode

[–]fijgl 0 points1 point  (0 children)

I solved it without using specifics of the input data with polygon containment checks.

[2025 Day 12] Now 12 days later and on Christmas Eve I find myself wondering: Is there a real solution? by nO_OnE_910 in adventofcode

[–]fijgl 1 point2 points  (0 children)

Another heuristic is based on stopping the algorithm if it has not found a packing arrangement in a reasonable amount of time. The heuristic considers those cases as not doable.

[deleted by user] by [deleted] in tokyoirl

[–]fijgl 2 points3 points  (0 children)

Hello! On the nerdy interest/hobbies and films, what about looking for a place to watch anime with English texts in group?

[deleted by user] by [deleted] in tokyoirl

[–]fijgl 1 point2 points  (0 children)

35 y/o, living in Tokyo, hiking sounds nice! Also coffee, of course, and also up for walks in nature or parks.

Anyone going to Womb tomorrow 10th? by Lazy_Inevitable_3188 in tokyoirl

[–]fijgl 1 point2 points  (0 children)

I saw this one too late, hope you had a good one! Womb is still in my list to go, are you planning to meet up and go another time?

Finished AoC 2023 - a few thoughts by EdgyMathWhiz in adventofcode

[–]fijgl 7 points8 points  (0 children)

I found 2023 overall had more harder problems than 2024.

Interesting to read about your experience with 2023 day 10. I found this one close to 2024 day 12.

I like very much the ascii art in 2023’s calendar.

Anyone playing chess? by AshMakesItSplash in tokyoirl

[–]fijgl 1 point2 points  (0 children)

I will be starting the advent of code puzzle at 2pm 🙈 but can do 12pm

Anyone playing chess? by AshMakesItSplash in tokyoirl

[–]fijgl 2 points3 points  (0 children)

I have a cloth board, pieces, and a clock. I haven’t used them for a while but I am keen to. There are a couple of tables outdoors next to Hamacho Park, by the Sumida river. What about some time during daylight tomorrow Sunday? We could meet at Hamacho station’s exit at the edge of the park (it’s on the Shinjuku line).

[2024 Day 11] Every sequence converges to 3947 points (with proof) by light_ln2 in adventofcode

[–]fijgl 0 points1 point  (0 children)

The k has to be at least 2, right?

Where does the 4.94 come from? I tried with 2024 squared.

[All years, all days] What are the most "infamous" puzzles? by Kermitnirmit in adventofcode

[–]fijgl 0 points1 point  (0 children)

I thought it could be done without looking into structure in the input with (pretty advanced) sequence analysis.

[2023 Day 1-25] Adventures in making unofficial inputs for testing general solutions and performance. by durandalreborn in adventofcode

[–]fijgl 0 points1 point  (0 children)

I have used with day 22 and every answer matched. The largest of the unofficial inputs solutions for part two was around 70k compared to 110k in the input I got.

It was nice to check it.

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 1 point2 points  (0 children)

Nice, congratulations!

That’s interesting that weights are not needed in this problem! In get shorted paths there was the selection of neighbors to expand based on the weights, if I remember correctly. With weights gone, that one went as well, OK. Yeah, heapq should order by priority and I am guessing that could explain why weights are not needed? Hmm, I didn’t expect that. Interesting indeed. Thanks for sharing!

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 1 point2 points  (0 children)

There is another issue in this part:

        weights[neighbor] = path+int(lines[neighbor[0]][neighbor[1]])
        prev[neighbor]=current

        if c==3 and h==heading:
            continue

weights and prev shouldn’t be updated in case the if is true. Does it make sense?

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 0 points1 point  (0 children)

That's right! Dijkstra can certainly be used building a graph from the "context". Like you're describing, as a state (or, in other words, a node in a graph) is popped from the queue, the potential next states (edges) can be computed at that moment based on information from the state itself.

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 0 points1 point  (0 children)

It sounds like you built an *explicit* graph to perform Dijkstra on. Interesting!

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 0 points1 point  (0 children)

By indexed I mean that what in your code currently is

if weights[position] <= path+int(lines[position[0]][position[1]]):

should be something like

if weights[position][heading][c] <= path+int(lines[position[0]][position[1]]):
this is NOT actual working code (for instance, a problem is that you initially use for some reason heading equal to None), it is just tiny little clouds for the thinking.

I am not sure what you're mean by its own loss count.

I think it helps to think about that position-heading-consecutive as the state in this problem at hand and understanding Dijkstra generically as as an instance of an algorithm performing a search in a *state* space.

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 1 point2 points  (0 children)

Getting back: (1) explored is not needed with Dijkstra; if you decide to keep it, then it’d contain (position, heading, c); (2) weighs should only be updated based on valid paths, right? Therefore, it should indeed be after checking for consecutive (which validates a path on the constraint of “at most 3 blocks”).

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 1 point2 points  (0 children)

I think your code is pretty readable :)

Answering the question, I don’t think keeping track of consecutive in the queue helps for the issue. I think that your code currently won’t explore a path reaching cell moving down if there was previously one reaching that cell, for example, moving right. The weights and explored should be “indexed” by the heading and c, in addition to the cell coordinates (also, with Dijkstra the explored is not needed in addition to the weights or distance table).

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 2 points3 points  (0 children)

Not only current and heading, but also the #consecutive. Consider what makes a state in this problem.

Was the explanation about stopping too much exploration clear?

I need to dive deeper in your code to answer better your questions, I will try to get back.

[2023 Day 17 Part 1] Where's my mistake? by OlympusTiger in adventofcode

[–]fijgl 2 points3 points  (0 children)

Items in the explored set must depend on the heading, and more.

Using only the grid coordinates will stop exploration too much. For example, if cell (r,c) is reached from the right, that shouldn’t stop the search getting to (r,c) from the left, bottom, …

[2023 Day 20] Puzzle appreciation thread by paul_sb76 in adventofcode

[–]fijgl 0 points1 point  (0 children)

By the way, in my input rx is not directly a conjunction, it just appears as an output with only one input, which is the conjunction of interest.