Unable to load image

rDrama Advent of Code Day 10: Pipe ( | ) edition

Summary for those just joining us:

Advent of Code is an annual Christmas themed coding challenge that runs from December 1st until christmas. Each day the coding problems get progressively harder. We have a leaderboard and pretty good turnout, so feel free to hop in at any time and show your stuff!

Whether you have a single line monstrosity or a beautiful phone book sized stack of OOP code, you can export it in a nice little image for sharing at https://carbon.vercel.app

What did you think about today's problem?

https://adventofcode.com/2023

Our Code is 2416137-393b284c (No need to share your profile, you have the option to join anonymously if you don't want us to see your github)

15
Jump in the discussion.

No email address required.

Part 2 was a pain in the arse today, but there are two ways I could imagine solving it:

1) Double the resolution of the input grid, so that the "squeezing" behaviour becomes visible and allows you to flood fill.

2) Consider the path as a polygon and each pixel as a point, then check which points are in the polygon. If you're on Python shapely is a fairly good library for this.

I went for the latter, which is a bit slow but far less memory intensive.

Jump in the discussion.

No email address required.

Part 1 was really easy, so I was kind of figuring part 2 was going to throw a curveball. I did not expect it to be that much of a b-word to figure out on day 10 though. I also eventually did a polygon type solution, but if I could go back in time, I think I would have done the flood fill you mentioned instead. I probably could have saved myself a couple frustrating hours.

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.