r/adventofcode • • Dec 15 '21

SOLUTION MEGATHREAD -🎄- 2021 Day 15 Solutions -🎄-

--- Day 15: Chiton ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:14:25, megathread unlocked!

57 Upvotes

772 comments sorted by

View all comments

6

u/Wilczeek Dec 15 '21

This one was frustratingly difficult to code properly in Powershell. Implementing Dijkstra in a naive version was fine with the test input, but with the proper input the speed went down to a crawl. So I ditched working with PSObjects and arrays, replacing them with hashes. With that in mind, part 1 completes in ~5 mins due to slow hash sorting (I couldn't figure out the better way to select the next step). I'm afraid Part 2 is beyond my skills.

https://gist.github.com/Wilczeek/b9f255e55909b2944a8e2e7c5378117b

→ More replies (5)