I decided to use a probabilistic approach. I pick 200 random pairs of nodes and find the paths between them. About half those paths use the cut-set edges, so those three edges will be used more than the others. That's enough to identity the cut-set.
A geometric approach to finding the solution, involving slicing up the map for part 2 into regions that would repeat, then finding how many of each I'd need for the final solution.
A day of two parts: variations on parsing the input, and some fiddling around with finding the area (which I admit, I just looked up after a bit of a struggle).
Things became much more simple when I stopped trying to be clever and instead represented the moves as actual Move records. I also used phantom types to handle the two types of move generation while keeping all the rest of the code the same.
Aha - haven't tried Mastodon's #bookmark feature before.
It seems like a useful feature for when you make a post that you intend to build on later.
For example, I got a new gadget and shared it in a toot, then bookmarked the toot. Now I can go back and tack on it, building a slow-moving thread with ease, rather than scrolling thru old posts trying to find it. Nice.
@ottaross I'm using #mastodon bookmarks to note #AdventOfCode2023 spoilers and solutions, I will get back to them later after I try the problems ... I need to prepare for Christmas so don't have time every day to work on them before Christmas.
Ca m'aura travaillé une partie de la nuit en batch.
J'étais vraiment parti sur un truc bien trop tordu mais je dois pouvoir faire encore pire pour résoudre le premier exercice du jour 12 de l'#AdventOfCode2023. Alors pour ne pas me pourrir la journée je m'en occupe vers 9h30 sur #Twitch.
Nothing much clever here. Depth first search to find the loop, breadth-first search to flood-fill the regions. The only clever bit is doubling the scale of the map to make it easy to "squeeze between pipes."
I feel really 50-50 about this day 10 of #AdventOfCode: the programming itself was quite nice and I got to use the Complex Number Coordinate System but I struggled with a few parts of figuring out how to solve things.
Still, I'm 20/20 with this year and it's only 4pm on Sunday evening so I still have plenty of time today to do other stuff.
I’ve tried theee times now to have an AI write programs to solve this year’s #AdventOfCode problems, and in each case they’ve written lovely code with useful comments that doesn’t work.
If there’s an AI that can actually generate solutions, I’d like to know which one. I used ChatGPT and GitHub Copilot.
(And yes, I only did this after I’d written my own working solutions.)
Over the years of learning and teaching programming, I've modeled card games, especially poker, so many times that day 7 of #AdventOfCode was straight-forward for me.
In terms of Python stuff, today's solution uses classes, inheritance and enums that I haven't yet used this year.