Advent of Code 2020 - BaseA Style (Day 17)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Discussion thread for day 17 of the Advent of Code : https://adventofcode.com/2020/day/17
- Labels:
- Advent of Code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Main issue with today was understanding the example... and I refused to do iterative as wanted to debug easier
And the inner macro:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
@jdunkerley79 the example was pretty horrid. I think it could have been much more clear without giving too much away.
Here is my solve. I took the iterative route for both parts and it ended up being surprisingly similar to my day 11 solution.
part 1 iterative
part 2 iterative
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Day17!
I almost gave up when I couldn't understand the example...It took much time. I agree with @jdunkerley79 on this point.
Today's my solution is Iterative route.
Part1 Iterative Macro
Part 2 Iterative Macro : Add w-axis to Part1 Macro
Finally, my challenge worked.
AS anonymous user #1105310
https://github.com/AkimasaKajitani/AdventOfCode
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I concur that the example was difficult to understand (at least for me, it took me a while to realize that there were rows/columns disappearing).
I went with an iterative, it required minor changes to incorporate the "w" from the second part.
I wondered if it would be any faster to precompute the whole board since I thought so many generate rows couldn't be that good
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I went for slow and simple with an iterative macro. I just computed entire board plus an extra space or 2. Lots of copying and pasting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Fun one this, mine runs in 0.8s for the whole flow. Two separate macros for 3d and 4d. 😊
1) filter out "." values you don't need them.
2) Generate only your collisions, this follows from 1)
3) shift your plane to stay within byte data types.
Workflow
Part 2 macro. This has 1 more generate rows than my part 1 macro for the extra w dimension. This could have its condition toggled and folded back into one macro.
My macro has a toggle for the number of iterations as I expected us to have to run 100 iterations in part 2 or something, I didn't need the toggle in the end and could have hard coded "6 iterations but I left it in anyway and made for a nice gif in the post below.
My macro steps.
1) Filter out "." from the initial data. This could in fact be done outside the macro as its not used after step 1.
2) generate collisions in each dimension, tripling rows at each step, looking at -1,self,+1.
3) tag the centre self collision.
4) keep only cubes with 2 or 3 collisions.
5) join back on against self colliders.
6) filter to only active cubes for next iteration.
7) repeat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
50 iterations of part 1 as a gif 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Optimised and golfed, 1 macro with a toggle for 3 or 4 dimensions. Workflow runs in 0.7s but it looks much cleaner now.
Macro, and no purple tools used 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
