Discussion thread for day 12 of the Advent of Code - https://adventofcode.com/2024/day/12
take me awhile to remember how to use "Make Group" tool. save time from build manualy.
thanks for past events got similar questions.
I applied spatial analysis to both part 1 & 2. It was hard to solve for me.
Very cool problem with application in (ML) Image Processing for edge detection.
V2 (no macro; thanks to the very powerful Make Group Tool + a lot of simplification throughout the workflow):
I did not use macros. For P2, I struggled by drawing diagrams in Excel.
For P1, I grouped adjacent elements using the "Make Group" Tool. A single plant would have fences on all four sides, but if it is adjacent to others, the shared sides are subtracted in the calculation.
For P2, I took the approach that irregularities (convexities or concavities) add more edges, and I calculated the edges by dividing the analysis into vertical and horizontal directions.
I got stuck with Part 2 and got a hint from @gawa that Spatial Tools works, and it actually worked. Thanks gawa-san!
Spatial Tools are very powerful in "visualizing" the process.👍
I hadn't come across the Make Group tool before but it did exactly what I needed for this challenge when I was struggling to identify the area and perimeter of distinct groups. I didn't use any macros as I was able to find and check the values of adjacent cells using Generate Rows. I did find Part 2 very tricky and was originally considering a convoluted method to try and count the number of corners (because corners = edges), but couldn't wrap my head around the best way to do that. In the end... (see spoiler)
Solved!
Taking hint from @gawa's spatial approach, part 1 become very easy
Fun use case for spatial tools today 😀
My solution.
Finally finished up with #12! Spent an insane amount of time going down rabbit holes that would all work for all but one of the sample grids, before taking a few hints from here & getting over the line!
Day12. More in spoiler
I tried solving Day 12 P1 and P2 again using the Spatial Tool although I solved it without spartial tool.Last time, I struggled a lot, drawing diagrams in Excel and pondering over them, but this time, I was able to solve it very easily.As expected, the Spatial Tool at bottom container is much better because it's more visually intuitive.
Solved without macro.
And she is finally back in the game. Thanks to Cory on the WhatsApp for helping me find what I was missing. Turns out my dataset also had a few red herrings in there too. But I finally found all those. Phew. Spoiler below. #darkmoding
This one took me awhile to wrap my head around. Part 1 was one thing, Part 2 was another. After looking at some other solutions, @Yoshiro_Fujimori 's really resonated. Thanks for your insights!
Took the spatial route. Didn't do anything different than others here.
A HUGE thank you to @DaisukeTsuchiya . I was trying to solve Part 1 the way that you did but instead of using the Make Groups, I just made a huge mess of it multiple times. I was actually pretty close with my first attempt, which was a macro to make the groups (only off by 2k for the final answer). When I used yours as a guide for doing a proper Make Groups and then seeing how to Join everything back together, I was able to solve it.
Part 2 was actually relatively easy, compared to Part 1. Excel helped me visualize it and then it was just a case of making sure my Sorts were in the right order
Please no one judge me for anything in the disabled containers. I'm so glad this one is done!
Took a little bit. Almost skipped for later but I was so close.