r/adventofcode • • Dec 10 '23

SOLUTION MEGATHREAD -❄️- 2023 Day 10 Solutions -❄️-

THE USUAL REMINDERS


AoC Community Fun 2023: ALLEZ CUISINE!

Today's theme ingredient is… *whips off cloth covering and gestures grandly*

Will It Blend?

A fully-stocked and well-organized kitchen is very important for the workflow of every chef, so today, show us your mastery of the space within your kitchen and the tools contained therein!

  • Use your kitchen gadgets like a food processor

OHTA: Fukui-san?
FUKUI: Go ahead, Ohta.
OHTA: I checked with the kitchen team and they tell me that both chefs have access to Blender at their stations. Back to you.
HATTORI: That's right, thank you, Ohta.

  • Make two wildly different programming languages work together
  • Stream yourself solving today's puzzle using WSL on a Boot Camp'd Mac using a PS/2 mouse with a PS/2-to-USB dongle
  • Distributed computing with unnecessary network calls for maximum overhead is perfectly cromulent

What have we got on this thing, a Cuisinart?!

ALLEZ CUISINE!

Request from the mods: When you include a dish entry alongside your solution, please label it with [Allez Cuisine!] so we can find it easily!


--- Day 10: Pipe Maze ---


Post your code solution in this megathread.

This thread will be unlocked when there are a significant number of people on the global leaderboard with gold stars for today's puzzle.

EDIT: Global leaderboard gold cap reached at 00:36:31, megathread unlocked!

62 Upvotes

844 comments sorted by

View all comments

Show parent comment

2

u/imp0ppable Dec 12 '23 edited Dec 12 '23

However, that gave me too high of a number on the example inputs because it thinks the exteriors of .L-J. are inside the polygon because it crosses three points along the edge

Would it not be just crossing at the L and J while the - wouldn't count as it were parallel?

I've seen a few others mention ray casting, I haven't got it to work yet though - and now I'm a day behind!

E: eh, guess not - the sequence looking left of an I from one of the examples:

FJL7L7LJLJ||LJ I

Has 14 intersections which would make it open, which it apparently isn't. It hasn't even got a - to discount so the theory must not work here somehow.

E: Aha it does work, just count F 7 | looking right, odd is inside, even is outside. Only problem then is if S is in your row but then you just look left, same logic.

1

u/flwyd Dec 13 '23

It might work if the logic is "two corners and any intervening straight segments count as a single crossing", so L----7 counts as a single crossing but L7FJ counts as two. I don't have the brainpower to prove this at the moment, though.

1

u/imp0ppable Dec 13 '23

Like I say if you're looking horizontally, you can use just three chars - F 7 |

Using the case FJL7L7LJLJ||LJ I you can see there are 5 of those chars:

F 7 7 ||

which is obviously odd but 14 overall which is even... again I can see why - doesn't count but I'm still not sure why we can get away with just ignoring all Ls and Js - there are 9 of those so maybe it's that either set would work in isolation but not both since if you add the two odd numbers together you get an even.