There are many ways to project the 3D surface of 6-sided dice into 2D by "unfolding" the faces and arranging them in a grid. Below is one example, first in the compact format given in the input file and then using ASCII art for demonstration purposes.
The number in each square gives the value of the corresponding face. Each line between squares represents an edge of the cube, or equivalently a place to "fold" the 2D surface to make a cube. When folding, the numbers should end up on the outside of the cube.
However, not every pattern of 6 squares can be folded to a cube. For example, the pattern below would only cover 5 of the cube's faces (with the "2" and "4" overlapping on one face).
Additionally, only some pattern that can be folded into a cube will form valid dice. The sum of values of opposite faces must be 7, and only right-handed arrangements (with the faces 1, 2, 3 ordered counter-clockwise around their shared corner) are considered valid for this puzzle. One such example is given below.
Each pattern (valid or invalid) is identified by the 6-digit integer formed by arranging the numbers left-to-right by row (i.e. in the order one reads words on a page), e.g. 123546 above.
Compute the product of all 6-digit identifiers of the valid dice patterns in the input data. The puzzle answer is this product modulo 1002004002001.
Copied!Couldn't copy the data or view the input data.
(You must solve part 1 before continuing.)
Coda
Placeholder for the coda.