#2023 Day 10
58 messages · Page 1 of 1 (latest)
the brainfuck using nsew
instructions for part two https://hastebin.skyra.pw/apuwihikeg.md
Ugh, i struggled so hard on p2 
I eventually decided ||there is an easy mathematical way to determine when a node is looped or not, but it took me so long to figure out the actual method||
I fucked up part 1 for so long
And then I essentially had to google how to do p2, I had no idea
I did too. The part 2 search. ||I knew there was a way from earlier AoC and my studies but needed a refresh of memories||
i really like my p1... but p2 is... 
|| flood fill is necessary but not sufficient||

someone proposed ||shoelace formula|| in my comment section
seems interesting but I'm not sure how exactly to get it to work
I just used ||horizontal sweep toggling inside-ness each time you cross a vertical edge|| which is a trick I learned in a uni class :P
||you just need to make sure you handle cases like L-J and L-7 correctly too||
||yep; I did it with a parity flag but I think you can also just regex and delete L-*J and F-*7 lmao||
||I also used a flag for it||
i hate this, i hate everything about this
Why, it’s a nice task with actual applications of theoretical algorithms.
cuz i'm too dumb
|| shoelace || doesn't work and my || counting traversals approach || is scuffed as heck and doesn't do what it should, so now i redid it and i'm blanking hard
i did it using ||flood fill||
i don't see the issue 
based on that idea, which i think SHOULD work?
||do you count the pipe loop itself as inside there? Because it isn’t||
ouu
no, wait, || that should be set union, if i'm not tripping and include the loop itselflen(outcoords | set(lace)) ||
||ah true… and what would your algorithm say is a . at the far left of the field: inside or outside?||
oh no
|| i start with inside true
that sure isn't right||
well, -44 aint right either
|| prob means i subtract the thing twice now... but without that it's 3 instead of 4 - AAAAH off by 1 error 😢 ||
ooooh i might have it
i don't have it
OMG
apparently does work, if you apply || Pick's theorem https://en.wikipedia.org/wiki/Pick's_theorem as well || a buddy of mine did it with that
Yeah someone dropped that spoiler on me
👀 they know who
apart from this bs...
but apparently py does not have jump labels
but thanks to neutrino's introduction to || zip(a, a[1:])|| the other day - might've been yesterday, that || shoelace || looks mighty nice, imo
I do like how neatly pythons core functionality works
The basics are very clean
ngl, really did not like python until trying a bit more seriously at aoc with it
and the core things it offers just work so darn well
I love what you can do with array indexing alone
glad js finally has #at but it's just not as good 
I think I prefer JS for production stuff
or that's just because of familiarity
but for AoC python is just way too nice
JS's ecosystem is just too good
npm everything
That’s a crawl move
Just catching up after the weekend, but part 2 was a tough one to crack
In the end, my eureka moment was using a script to draw the traversed path using Unicode block symbols, to cut out the white noise and just see the path in isolation
From there, the solution was only a few lines long, but it took me ages to get to that point
