So what I did for day 10 was a ray casting algorithm but I didn't replace any of the pipes with a regex like you did. First I create an empty list. Whenever I hit a "|", "L" or "J", I add an "n" to the list if there's no "n" in it, otherwise I remove the "n" from it. Similarly, when I hit a "|", "F" or "7", I add an "s" to the list if there's no "s", otherwise remove it. If the tile I'm in is not a pipe, and there's both an "n" and an "s" in the list, then it's inside the loop and I increment the count by one.
@1337Ch33z11 ай бұрын
Only at day 3 but any reason you don't use defaultdict? Removes some boilerplate for the gears on day 3 and colors for day 2. Edit: TIL about for else 🎉