5
votes
Day 16: Proboscidea Volcanium
Today's problem description: https://adventofcode.com/2022/day/16
Please post your solutions in your own top-level comment. Here's a template you can copy-paste into your comment to format it nicely, with the code collapsed by default inside an expandable section with syntax highlighting (you can replace python
with any of the "short names" listed in this page of supported languages):
<details>
<summary>Part 1</summary>
```python
Your code here.
```
</details>
Only Part 1 so far and slow at over 2s. I adapted it for Part 2 (which works for the test input!) but is a combinatorial explosion with the real input. I have a couple of ideas to tame that but haven't got it working yet. Once it's done (if it works), I suspect Part 1 will also improve.
Part 1
I'm using a graph library to get the distances between all pairs valves; it just saves me with the tedious busywork of repeated bfs.
I haven't done any of the other puzzles this year, but the description looked fun, so I gave Part I a shot.
Of course it ended up being way harder than I imagined; I'm not even going to attempt Part II.
Part 1 (Rust)
I've omitted the code for parsing and pathfinding -- the former is just standard
nom
parsing and the latter is (a) ugly and (b) a direct translation from Python code on Wikipedia.