|
| 1 | +# Day 17: Clumsy Crucible |
| 2 | +The lava starts flowing rapidly once the Lava Production Facility is operational. As you leave, the reindeer offers you |
| 3 | +a parachute, allowing you to quickly reach Gear Island. |
| 4 | + |
| 5 | +As you descend, your bird's-eye view of Gear Island reveals why you had trouble finding anyone on your way up: half of |
| 6 | +Gear Island is empty, but the half below you is a giant factory city! |
| 7 | + |
| 8 | +You land near the gradually-filling pool of lava at the base of your new **lavafall**. Lavaducts will eventually carry |
| 9 | +the lava throughout the city, but to make use of it immediately, Elves are loading it into large |
| 10 | +[crucibles](https://en.wikipedia.org/wiki/Crucible) on wheels. |
| 11 | + |
| 12 | +The crucibles are top-heavy and pushed by hand. Unfortunately, the crucibles become very difficult to steer at high |
| 13 | +speeds, and so it can be hard to go in a straight line for very long. |
| 14 | + |
| 15 | +To get Desert Island the machine parts it needs as soon as possible, you'll need to find the best way to get the |
| 16 | +crucible **from the lava pool to the machine parts factory**. To do this, you need to minimize **heat loss** while |
| 17 | +choosing a route that doesn't require the crucible to go in a **straight line** for too long. |
| 18 | + |
| 19 | +Fortunately, the Elves here have a map (your puzzle input) that uses traffic patterns, ambient temperature, and |
| 20 | +hundreds of other parameters to calculate exactly how much heat loss can be expected for a crucible entering any |
| 21 | +particular city block. |
| 22 | + |
| 23 | +For example: |
| 24 | +``` |
| 25 | +2413432311323 |
| 26 | +3215453535623 |
| 27 | +3255245654254 |
| 28 | +3446585845452 |
| 29 | +4546657867536 |
| 30 | +1438598798454 |
| 31 | +4457876987766 |
| 32 | +3637877979653 |
| 33 | +4654967986887 |
| 34 | +4564679986453 |
| 35 | +1224686865563 |
| 36 | +2546548887735 |
| 37 | +4322674655533 |
| 38 | +``` |
| 39 | +Each city block is marked by a single digit that represents the **amount of heat loss if the crucible enters that |
| 40 | +block**. The starting point, the lava pool, is the top-left city block; the destination, the machine parts factory, is |
| 41 | +the bottom-right city block. (Because you already start in the top-left block, you don't incur that block's heat loss |
| 42 | +unless you leave that block and then return to it.) |
| 43 | + |
| 44 | +Because it is difficult to keep the top-heavy crucible going in a straight line for very long, it can move **at most |
| 45 | +three blocks** in a single direction before it must turn 90 degrees left or right. The crucible also can't reverse |
| 46 | +direction; after entering each city block, it may only turn left, continue straight, or turn right. |
| 47 | + |
| 48 | +One way to **minimize heat loss** is this path: |
| 49 | +``` |
| 50 | +2>>34^>>>1323 |
| 51 | +32v>>>35v5623 |
| 52 | +32552456v>>54 |
| 53 | +3446585845v52 |
| 54 | +4546657867v>6 |
| 55 | +14385987984v4 |
| 56 | +44578769877v6 |
| 57 | +36378779796v> |
| 58 | +465496798688v |
| 59 | +456467998645v |
| 60 | +12246868655<v |
| 61 | +25465488877v5 |
| 62 | +43226746555v> |
| 63 | +``` |
| 64 | +This path never moves more than three consecutive blocks in the same direction and incurs a heat loss of only **`102`**. |
| 65 | + |
| 66 | +Directing the crucible from the lava pool to the machine parts factory, but not moving more than three consecutive |
| 67 | +blocks in the same direction, **what is the least heat loss it can incur**? |
0 commit comments