This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Using iteratives again. It was a curveball to see all the ocean floor alternating the lighting on then off. Edited the macro, so that cells beyond the board are off or on depending on the iteration (which means that it doesn't work with the sample algorithm...😅)
I solved the first part by not building the iterative macro and just repeating the step twice, using the spatial tools were helpful to visualise the output when I was originally getting warnings about it being too high. So could see it was framing my answer with # due to the algorithm starting with a #, so needed to remove this depending on iterations.
Chris Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
Finally got a decent 2 part solution on this one! I did eventually enjoy this one after I figured out it was actually relevant that the image was infinitely large based on the algorithm value in position 0...
Dealing with position 0 being a # was... challenging. And like @dsmdavid my original solution then no longer worked for the sample solution because of the "brute force" logic I included to make it work for my actual data... but then I added a check box to toggle that "brute force" logic on & off, so now it will work for both once again 🙂
The macro - works for both Part 1 & 2 by changing the numeric value in config, as well as now working for both sample & actual data!
And with that, I've surpassed last year's total of 31 stars! (Shows 33, but I am counting it as 32 since I have absolutely NO idea what I did in Day 15 Part 1 to stumble into the correct answer, and since now I can't replicate the right answer, more research to come... hah)
The only tough bit here was ensuring that if we extend the cells beyond the border, you use the current cell value to do so (since it's infinite canvas).
Built this in 4 parts:
First a cleaner to turn the raw data in to the right shape Then a macro that adds in blank space around the edges Then a join to the neighbours to get the right lookup value for the cell A join to the enhancer based on this key
Here's the cleaner: It splits up the translations into a list; and splits up the image into rows and columns
Here's the bulker: This adds on empty cells around our current image
Iterator: This is relatively simple - it bulks out the data if needed; then does the neighbour lookup; then joins and applies the translation and loops
The Neighbour process: This is where we generate all 9 neighbours for the current cell - and calculate the lookup value for the translation. This is also the place where the infinite size of the image has an impact.