Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A nice little Makefile driving each day too:

https://github.com/odnoletkov/advent-of-code-jq/blob/master/...

And I somehow just learned about asciicinema from it:

https://asciinema.org

This is parsing a maze into a graph and finding the shortest path:

https://github.com/odnoletkov/advent-of-code-jq/blob/master/...

I can kinda make out how it's parsing the input and converting it to a graph. I can't make heads or tails of the path finding and I don't see anything that really looks like Djikstra's algorithm.



I suspect it’s a breadth-first search, which is substantially easier to code. .front looks like the queue of nodes to visit.


You would hope so. Saw many people on r/adventofcode using dijkstra or even A* when every path step is just 1. I went with bfs because I'm pretty sure using a priority queue or heuristic function is going to slow those down.


For the input sizes in aoc, the slowdown shouldn't be measurable.

Taking input size into account, you do not even need a queue, just loops.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: