Let C be a nite set of colors. Given a polyhedral piece shape, let k1 be the
number of potentially visible sides, and let k2 be the number of sides that arevisible in any given conguration. In this paper, we restrict ourselves to pieces
in the shape of a right prism, which often implies that k1 = k2. For each (poten-
tially visible) side of the piece shape, we assign a unique number from the set
f1; : : : ; k1g. Hence, a single piece can be represented by a tuple in Ck1 assigning
a color to each of the k1 sides. When dening a piece, we sometimes use the
special symbol , which represents a unique color used once in the entire puzzle.
The set of possible congurations of a single piece is given by the piece
congurations P f1; : : : ; k1gk2 . Each piece conguration indicates how the
colors in the original piece should be assigned to the visible sides. Specically, a
piece conguration is a mapping from each of the k2 visible sides to the index of
one of the sides of the piece shape. A single side of a single piece cannot appear
on multiple sides of the puzzle, so each piece conguration has the additional
restriction that no element of the tuple is repeated.
For each visible side 1 i k2, we dene the function Fi : Ck1 P ! C to
return the color of side i, given a piece and its conguration. Formally, we say:
Fi(ha1; : : : ; ak1 i; hq1; : : : ; qk2 i) = aqi :
As an example, we consider the original Instant Insanity puzzle. Each cube
has k1 = 6 sides with colors on them; only k2 = 4 of those sides are visible when
the cubes are stacked vertically. Suppose that we number the sides as depicted
in Fig. 4. Then there are 24 possible piece congurations: 6 ways to choose the
side that faces down, and 4 possible ways to rotate the visible faces. These 24
piece congurations are listed in Fig. 5.
Many piece shapes, including the cube, have a number of symmetries. In
particular, many have the following property:
Denition 1. The set of piece congurations P is rotationally symmetric if P
is closed under cyclic shifts.
Using this combinatorial denition of piece congurations, we can formally
dene two variants of the Instant InsanityDenition 2. The Complete-Insanity(P) problem is dened as follows:
Input: A set of colors C and a sequence of pieces A1; : : : ;An, where n = jCj.
Output: Yes if and only if there is a sequence of congurations p1; : : : ; pn 2 P
such that for each side 1 i k2, the set of visible colors fFi(Aj ; pj) j 1
j ng = C.
Denition 3. The Partial-Insanity(P) problem is dened as follows:
Input: A set of colors C and a sequence of pieces A1; : : : ;An, where n jCj.
Output: Yes if and only if there is a sequence of congurations p1; : : : ; pn 2 P
such that for each side 1 i k2, all of the visible colors Fi(Aj ; pj) on side
i are distinct.
Note that both problems require all visible colors on a single side to be dis-
tinct; however, the Partial-Insanity(P) problem only requires a subset of all of
the colors to be visible on a single side, while the Complete-Insanity(P) prob-
lem requires all colors to be visible. Clearly, the Partial-Insanity(P) problem
is at least as hard as the Complete-Insanity(P) problem, and both are con-
tained in the complexity class NP.