The $ n^k-1$ Puzzle

This PUZZLE is played on a hypercubical grid of $ n\times n \times n
\dots \times n$ elements. Each grid hypercube can be occupied by a single numbered tile, or may be empty. A single move consists of sliding a tile from its current position into an adjacent empty grid location. Figure 1 illustrates two STATEs of this PUZZLE. Figure 1 (b) arises from moving the tile ``3'' in configuration (a) into the empty grid location above it. A tile may only be moved along a single dimension at a time; ``diagonal'' moves are not allowed. Thus, in Figure 1 (a), it would be illegal to move the tile ``4'' into the empty grid location.

Figure 1: Example of two $ n^k-1$ puzzle ($ n=3$, $ k=2$) STATEs, joined by the move [2,1]->[1,1].
\begin{figure}\centering
\begin{tabular}{ccc}
\begin{tabular}{\vert c\vert c\ver...
...\hline
\end{tabular}\\
\textbf{(a)} &
&
\textbf{(b)}
\end{tabular}
\end{figure}

The object of this PUZZLE is to take a START STATE, given by an initial tile configuration, and a GOAL STATE, given by a desired tile configuration, and produce the shortest sequence of MOVEs that produce the GOAL from the START.

The PuzzleMuncher program MAY assume that all instances of the $ n^k-1$ puzzle have only a single blank tile, though they MAY choose to support multiple blank tiles. Furthermore, it MAY assume that every numbered tile is unique. If either of these conditions is violated, the PuzzleMuncher system MAY treat this as a RECOVERABLE or UNRECOVERABLE error, or it MAY silently handle it. If the PuzzleMuncher chooses to handle this case, it MUST do so correctly.

For the purposes of output, every MOVE is given by the expression:

MOVE $ i$: $ [p_1,p_2,...,p_k]$ -> $ [p_1',p_2',...,p_k']$

where $ i\in 0, 1, \dotsc $ denotes the current move, the left hand expression gives the location of the tile to be moved, and the right hand expression denotes the location into which it is moved. The values $ p_i$ give the index along each dimension of the puzzle. Note that because of restriction that moves may only be along a single dimension, $ p_j'=p_j$ for all but one $ j$.

The output of a board state is the same as the input format, specified by the rule NKPUZSTATE in Section 3.2.

The null move (changing nothing on the board) is disallowed.

Terran Lane 2004-03-24