summaryrefslogtreecommitdiff
path: root/16.c
AgeCommit message (Collapse)Author
2023-01-18Puzzle 16: Improve debug outputAdam Spragg
2023-01-17Puzzle 16: Speed up the permute skipping codeAdam Spragg
By realising that the first time we hit the need to skip, the items to be skipped will be in sorted order; to change them to reverse-sorted order just requires reversing the items, not re-sorting them backwards. (On part 1 of the puzzle with a 40 minute limit, the timing goes from 6.6s to 4.3s, average of 5 runs.)
2023-01-17Puzzle 16: Attempt to speed up the "reverse" functionAdam Spragg
Even though we change from 3 small memcpy()s per 2 items, to 1 small memcpy() per item plus 1 big memcpy(), it goes slower? (On part 1 of the puzzle with a 40 minute limit, the timing goes from 6.6s to 6.8s, average of 5 runs.) Leave commented out for now.
2023-01-17Puzzle 16: Extract function to reverse a series of elementsAdam Spragg
2023-01-16Puzzle 16: Commit partial solve of part 2Adam Spragg
This solves the actual the puzzle, in the case where two plumbers (you and the elephant) can't reach all the valves in time. But it doesn't work for the test case, where you can, and it has to look for the most efficient split of resources. So, I got the gold star, but I wanted to create a full solution before committing it. Obviously that didn't happen at the time. Might as well commit what I have now, and look at improving it with a later fix.
2022-12-17Free the valve input regex on exitAdam Spragg
2022-12-17Keep the start point separate from the permutable pathAdam Spragg
2022-12-17Allow debug mode to work with real data.Adam Spragg
Only tried it with test data before, where we don't need the permutation pruning system. If you enable it with live data, it prevents any permutations from being skipped, so it takes forever.
2022-12-17Allow variable time until eruptionAdam Spragg
2022-12-17Solve puzzle 16 part 1Adam Spragg
That was a tough one. Still takes 2.5s on my hardware. Should be able to multithread the permuation search at some point, if I want to.