2023 Day 10: Pipe Maze

aoc_2023_10

1 Like
1 Like

LOL! I was wondering how y’all’s posts counted as spoilers until I realized that @zertovitch 's image suggests he adopted the same approach I did for Part 2: scale the maze by a factor of 2 in each direction, flood fill from the outside in, then count un-flooded points that correspond to interior points of the original maze.

Geez was this a difficult one for me.

  • I lost somewhere between 30-60 minutes on Part 1 by checking if my Animal was the same, rather than my animal’s Location.
  • The first value I submitted for Part 2 had forgotten to taken into a count the comment that “[a]ny tile that isn’t part of the main loop can count as being enclosed by the loop.” Worse, while I had hit on the double-then-flood approach, I was rebuilding the maze using the wrong history.
  • My final approach had a little trouble handling the start position because I rebuild the wall using the moved positions and the pipe in those locations.

In the end, I really like the approach I took; I just think I implemented it badly. Did anyone, including @zertovitch , use a different approach?

2 Likes

My approach is slightly different:

I have tripled the map. For instance L is drawn as

.#.
.##
...

Start S is drawn as a cross:

.#.
###
.#.

Here the map with the five cases (outside tile, inside tile, inside pixel on a path tile, outside pixel on a path tile, path pixel) in different colors:

aoc_2023_10

2 Likes