(1,2,3,4,5,6), (1,5,3,6,4,2), (1,4,3,2,6,5), (1,6,3,5,2,4),
(2,3,4,1,5,6), (2,5,4,6,1,3), (2,1,4,3,6,5), (2,6,4,5,3,1),
(3,2,1,4,6,5), (3,5,1,6,2,4), (3,4,1,2,5,6), (3,6,1,5,4,2),
(4,3,2,1,6,5), (4,6,2,5,1,3), (4,1,2,3,5,6), (4,5,2,6,3,1),
(5,2,6,4,3,1), (5,3,6,1,4,2), (5,4,6,2,1,3), (5,1,6,3,2,4),
(6,2,5,4,1,3), (6,3,5,1,2,4), (6,4,5,2,3,1), (6,1,5,3,4,2)
Figure 3: Labels for each of the faces on a cube.
which is reachable by rotating the cube i along the x-,
y-, or z-axis (see Eq. 8).
table({x
i,1
,...,x
i,6
},T
i
)∀i ∈ {1,...,4} (8)
Where table T
i
is defined by the possible piece config-
urations T and the given colors C
1
,...C
4
of the Instant
Insanity puzzle (see Eq. 9).
T
i
x,y
= C
i
[T
x,y
]
∀i ∈ {1,...,4},x ∈ {1,...,24},y ∈ {1,...,6}
(9)
Remark 4: Using the table constraint like
presented before, leads to a strict cube order
C
1
,C
2
,C
3
,C
4
, which is not given in the game. The
patterns we try to find (ADIIS or AEIIS) are indepen-
dent from the cube order. Thus, a solution for the
given variable order is always also a solution for ev-
ery other permutation of the 4 cubes. Doing this re-
duces the number of solutions and the search space
by factor
1
4!
=
1
24
, which leads to a speed up in the so-
lution process. If all solutions are searched, then the
real solution number is the number of detected solu-
tions times 24. We call such a constraint a symmetry
breaking constraint.
After constraining the color side dependencies of
the cubes, it is necessary to define the target require-
ment. For ADIIS, every side of a tower must use ev-
ery color once. Thus all equally positioned sides of
the different cubes must take distinct colors. There-
fore, (x
1,i
,x
2,i
,x
3,i
,x
4,i
∀i ∈ {1,2, 3, 4}) must satisfy
the allDifferent constraint, given by Eq. 10:
allDifferent(x
1,i
,x
2,i
,x
3,i
,x
4,i
)∀i ∈ {1,2,3, 4} (10)
For the AEIIS problem we need instead of the
constraint given by Eq. 10 an allEqual constraint
(see Eq. 11) for all variables x
1,i
,x
2,i
,x
3,i
,x
4,i
∀i ∈
{1,2,3,4}.
allEqual(x
1,i
,x
2,i
,x
3,i
,x
4,i
)∀i ∈ {1,2,3, 4} (11)
Results
After presenting our CSP model for finding an ADIIS
and an AEIIS, we want to show our results.
All the experiments (for all 5 problem instances)
are set up on a DELL laptop with an Intel i7-
4610M CPU, 3.00GHz, with 16 GB RAM, 1600
MHz DDR3 and running under Windows 7 profes-
sional with service pack 1. The algorithms are im-
plemented in Java under JDK version 1.8.0 191 and
Choco Solver (Prud’homme et al., 2016). We used the
DowOverW Deg search strategy which is explained in
(Boussemart et al., 2004) and is used as the default
search strategy in the Choco Solver (Prud’homme
et al., 2016).
For the ADIIS problem instance, we could find all
solutions in less than one second. There are eight so-
lutions in which every four solutions are equivalent
under rotation of the tower around the z-axis. The
two real different solutions (with respect to rotation)
are shown in Figure 4.
Figure 4: The two different solutions of the Instant Insanity
puzzle.
For the AEIIS problem instance the Choco Solver
can detect that no solution exists. This leads us to the
ICAART 2020 - 12th International Conference on Agents and Artificial Intelligence
334