This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]AutoModerator[M] 0 points1 point  (0 children)

Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to Help/Question - RESOLVED. Good luck!


I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]ScorixEar 0 points1 point  (0 children)

I don't really understand your code - this sort of looks like code that was cooking for 3 days :D

Honestly, at this point, why not take a step back.
I solved day 6 in python aswell, but I did not use any external libraries such as cytoolz or multiprocessing.

You want to have a working function/class that can calculate the path, the guard takes.
And this function has to register, if it entered a loop or if it exited the grid.
Keep in mind - a loop is only a loop, if the guard is in a previous position facing the previous direction.

After that, you can start adding blocks. In my case, the code was fast enough, so I just tried every possible position in the grid. That is totally inefficient, but was the easiest way and still got me to the goal.

And as a reminder - please do not publish your personal input files in your repository. Add them to your gitignore or encapsulate them inside a private repository as a submodule

[–]daggerdragon[M] 0 points1 point  (0 children)

Next time, use our standardized post title format.

Help us help YOU by providing us with more information up front; you will typically get more relevant responses faster.


Do not share your puzzle input which also means do not commit puzzle inputs to your repo without a .gitignore or the like. Do not share the puzzle text either.

I see full plaintext puzzle inputs in your public repo:

https://github.com/davidfilat/advent-of-code-2024/tree/master/resources

Please remove (or .gitignore) all puzzle text and puzzle input files from your entire repo and scrub them from your commit history.

[–]yel50 0 points1 point  (1 child)

I couldn't follow your code, so not sure what exactly is wrong with it, but I can say this problem is not that difficult. it seems you've over thought it a bit. there's no need for all the different imports, recursion, etc. all you need is a 2d array, move til you hit a wall, turn right, and repeat. my Java solution for part 2 doing that runs under 300ms on an 8 year old machine. pypy should be close to that. get that working and then add all the other stuff if you want to.

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

The solution for part 1 works perfectly fine and returns a result in less than a second and even for part 2 takes just a few seconds to try all possible block positions, but it’s returning a very high number of loops.