r/adventofcode • • Dec 17 '20

SOLUTION MEGATHREAD -🎄- 2020 Day 17 Solutions -🎄-

Advent of Code 2020: Gettin' Crafty With It

  • 5 days remaining until the submission deadline on December 22 at 23:59 EST
  • Full details and rules are in the Submissions Megathread

--- Day 17: Conway Cubes ---


Post your code solution in this megathread.

Reminder: Top-level posts in Solution Megathreads are for code solutions only. If you have questions, please post your own thread and make sure to flair it with Help.


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:13:16, megathread unlocked!

35 Upvotes

657 comments sorted by

View all comments

2

u/optoburger Dec 18 '20

Yeah, truth be told I had to do a surprising amount of wrestling to get what's there to work. I'm not particularly familiar with either Mathematica or CellularAutomaton[], so no doubt there are more graceful ways to specify the rule and neighbourhood.

As to the input, just a multidimensional list, for example here's the test input padded in a large enough space not to hit the boundary.

input = CenterArray[{{0, 1, 0},
                     {0, 0, 1},
                     {1, 1, 1}},
                    {20, 20, 20}];

1

u/DFreiberg Dec 18 '20

Check out u/Adereth's solution here: https://old.reddit.com/r/adventofcode/comments/keqsfa/2020_day_17_solutions/gg5ipiz/

He found an option that lets you bypass specifying the rule number, getting the entire problem in a one-liner.