DEV Community

Discussion on: Advent of Code 2020 Solution Megathread - Day 17: Conway Cubes

Collapse
 
paddy3118 profile image
Paddy3118

Clarification request

we are given:

Before any cycles:

z=0
.#.
..#
###
Enter fullscreen mode Exit fullscreen mode

Lets put some coordinates around this and expand it so I can easily refer to things

Before any cycles:

z=0
  ABC

0 .#.
1 ..#
2 ###


After 1 cycle:

z=-1
  ABC

0 #..
1 ..#
2 .#.

z=0
  ABC

0 #.#
1 .##
2 .#.

z=1
  ABC

0 #..
1 ..#
2 .#.
Enter fullscreen mode Exit fullscreen mode

Now concentrate on the initial state, before any cycles: the cell at x=C, y=2 , z=0 or C,2,0 for short.
It is bottom-right. It has two active neighbours C,1,0 and B,2,0 That should mean that it stays active in cycle 1 but is shown inacative.

The rule that applies is:

*If a cube is active and exactly 2 or 3 of its neighbors are also active, the cube remains active. Otherwise, the cube becomes inactive.

That first cycle does not seem to fit the task explanation.

Could someone explain how they understand the explanation please, Thanks.

P.S. C,2,0 is marked 'X' below to help explain the coordinates

Before any cycles:

z=0
  ABC

0 .#.
1 ..#
2 ##X
Enter fullscreen mode Exit fullscreen mode
Collapse
 
rpalo profile image
Ryan Palo

This is confusing to look at too, but there's one important phrase that makes it correct:

and the frame of view follows the active cells in each cycle

This thread, makes it more clear. At time t=1, the possible grid is actually 5x5x3. The sample input is just shifted and shrunk to follow the boundary of actual cells.

In other words, for your diagram's time step 0, cell 2C is the same cell as cell 1, C, 0 in time step 1. Try it out yourself but fill it in in a 5x5x3 grid. Let me know if this makes sense! I agree that it's confusing and he would have probably been better off showing the whole potential state space and not shifting to follow the active cells. :)