I just completed "Chiton" - Day 15 - Advent of Code 2021
https://adventofcode.com/2021/day/15 #AdventOfCode
https://github.com/coderbyheart/adventofcode/tree/2021/day15
Part 2 computes in 70 minutes with Node.js, so this could use some more love.
A static archive of Markus Tacker's tweets. Follow me on Mastodon: @[email protected].
I just completed "Chiton" - Day 15 - Advent of Code 2021
https://adventofcode.com/2021/day/15 #AdventOfCode
https://github.com/coderbyheart/adventofcode/tree/2021/day15
Part 2 computes in 70 minutes with Node.js, so this could use some more love.
That's the fix:
https://github.com/coderbyheart/adventofcode/commit/b9c57830331f8669da34bbed83c6fb1ed457cdee
Instead of iterating over all remaining positions all the time, only put the
last visited into the queue. Eventually the algorithm will visit all points
anyway. Runtime is now 4 seconds.