view day17.txt @ 33:676461cc3a70

Day 23 - track segments, not each space This allows us to explore the branches once then do quicker calculations for valid route lengths. But still requires exploring 1,262,816 routes to find the longest!
author IBBoard <dev@ibboard.co.uk>
date Thu, 04 Jan 2024 14:52:24 +0000
parents 79dc2ba41df2
children
line wrap: on
line source

--- Day 17: Clumsy Crucible ---

A route finding puzzle with the following constraints:

* Reduce the sum of values walked (the "cost" of the route)
* Do not go in a straight line for more than three blocks
* Don't count the starting square (unless you return to it)

Start at the top-left and move to the bottom-right

Given:

2413432311323
3215453535623
3255245654254
3446585845452
4546657867536
1438598798454
4457876987766
3637877979653
4654967986887
4564679986453
1224686865563
2546548887735
4322674655533

We could go:

2>>34^>>>1323
32v>>>35v5623
32552456v>>54
3446585845v52
4546657867v>6
14385987984v4
44578769877v6
36378779796v>
465496798688v
456467998645v
12246868655<v
25465488877v5
43226746555v>

This path never moves more than three consecutive blocks in the same direction and incurs a heat loss of only 102.