In this section, first we give some definitions and notation, then provide basic tools to solve the torus puzzle, and finally show how to solve the torus puzzle with the basic tools.
2.1. Definitions and Notation
This subsection introduces definitions, notation, and conventions. Let O be an operation in . We denote by the execution of i consecutive O operations on , where is a row (respectively, column) of the board if (respectively, ). We simply write as . We call for some i and (respectively, ) a row (respectively, column) operation. It is easy to see that (respectively, ) is the same action as (respectively, ).
In this paper, a configuration means a placement of the pieces on the board. We will refer to the following configuration as initial configuration and denote it by : the piece numbered is placed at the ith row and the jth column for each and . There are two ways to refer a piece in a configuration. One is by its number and the other is by its position on the board: The piece having number r is referred to as “the piece numbered r”, and the piece placed at the ith row and the jth column in a configuration is called “the piece placed at ” in the configuration.
Let denote the set of configurations of the m by n board (a configuration of the board can be considered as an m by n matrix in which the pieces are numbered bijectively from ). We say that the board has a configuration if the piece placed at has number r iff for each and . The symbol (respectively, ) is used to refer to the kth row (respectively, column). We say that the piece numbered r is at its right position in if , where and . For , , we write , or simply , if can be obtained from by performing a sequence of the basic operations . We thus also write , or simply , if there is no sequence of the basic operations such that can be obtained from by applying .
Let be a sequence of the basic operations, where for and we are assuming that . The integer ℓ and the value are referred to as drag number and push number of the sequence , respectively. We denote the drag and push numbers of by and , respectively. For configurations and , we denote the values and by and , respectively, where both minimums are taken over all sequences deriving from . Specially, in the case where is the initial configuration , we simply write and instead of and . The value and are both natural values to measure how far is from the initial configuration . In a situation where the torus puzzle is implemented on a touch-panel device, it would be natural to consider a consecutive iterations of the same operation as a single step. In this paper, we use , that is, for each is counted as one step, not k steps.
2.2. A Basic Tool: Three Elements Rotations
In this section, we introduce a basic tool called three elements rotation, which plays a fundamental role in the solution.
Consider the the following eight patterns of four consecutive operations.
Figure 2 is used for showing how the eight patterns work. In
Figure 2, there are five points: (the
ith row, the
jth column), (the
th row, the
jth column), (the
ith row, the
th column), and there are four triangles consisting of three of these points:
A,
B,
C, and
D. It is a routine to check that each pattern makes a clockwise or counterclockwise rotation of the three corners of a triangle
A,
B,
C, or
D without other changes of piece positions.
- 1.
, , , → clockwise on A,
- 2.
, , , → counterclockwise on A,
- 3.
, , , → clockwise on B,
- 4.
, , , → counterclockwise on B,
- 5.
, , , → clockwise on C,
- 6.
, , , → counterclockwise on C,
- 7.
, , , → clockwise on D,
- 8.
, , , → counterclockwise on D.
These patterns are referred to as “triangle rotations”.
By combining two triangle rotations, a useful rotation can be built as follows. Let
be a configuration in
. Let
be the configuration obtained from
by applying basic operations to the board in the following order:
,
,
,
,
,
,
for
and
(see
Figure 3).
It is easy to see that the only difference between
and
is the
ith row, and the
ith row in
is:
That is, only the part of the ith row is changed (rotated) into . We will refer to this change as three elements rotation on (, p, q, west) (the east version can be defined similarly). Specially, we denote the three elements rotation on (, 1, 1, west) by (the corresponding east version is denoted by ). For example, results in .
2.3. Solution
In this section, we show how to solve the torus puzzle by considering the two cases where
is even and
is odd. Not surprisingly, there is a difference between the even case and the odd case. In the even case, for
any ,
can be changed into the initial configuration
by applying a sequence of the basic operations. But this is not true for the odd case. (A similar thing happened for the 15 puzzle [
4].) To describe our solution of the torus puzzle, we need the following lemmas.
Lemma 1. Suppose that is an even integer. For any two consecutive pieces and in a row of a configuration , we can swap the positions of two pieces without causing any other change of position by applying a sequence of basic operations. More precisely, it holds that , where , , and for .
Proof. Suppose (the case of is trivial). It is sufficient to show that there is a sequence of basic operations which changes the first row into . Apply , , , , in this order, then the first row becomes . Finally, execute , then we have the desired result. □
The next lemma is inspired by an argument on the parity of permutations in [
4].
Lemma 2. Suppose that is an odd integer. For any two consecutive pieces and in a row of a configuration , we cannot swap the positions of two pieces without causing any other change of position. More precisely, it holds that , where , , and for .
Proof. Suppose not, then there is a sequence of basic operations which swaps the positions. Let h (respectively, v) be the number of row (respectively, column) operations in , Then, has h permutations of n elements and v permutations of m elements (i.e., h cycles of length n and v cycles of length m). As any permutation of elements can be represented by the production of transpositions, can be represented with transpositions. This, however, means that is even permutation, since both and are even. However, should be odd permutation, a contradiction. □
We are now ready to demonstrate our solution. Let
be the initial configuration. We first show how to obtain a configuration
from any configuration
such that
for
,
,
i.e.,
achieves the initial configuration except for the bottom row. Suppose that the pieces numbered 1,
,
are already at their right positions. Let
p and
q be the integers such that
and
. We now wish to have a configuration in which the pieces numbered 1,
,
r are at their right positions. Let
be the position of the piece numbered
r in the current configuration. We will refer to the outside of the region placed the pieces numbered 1,
,
as
work space. By proper choice of a third corner
(from work space) and executing a proper triangle rotation on the three corners
,
, and
, we can have the desired configuration. Note that, because of the work space, we can take a third corner properly (see
Figure 4).
We now show how to achieve the initial configuration from the configuration . First, consider the case where is even. Without loss of generality, we may assume that n is even. Since the case of is easy, we assume . By applying three elements rotation as many times as necessary, the piece numbered can be replaced at its right position . We repeat this process for pieces numbered , , . By Lemma 1, we can swap the positions of pieces numbered and if necessary (i.e., if the last row is . Then, we have the initial configuration .
Now consider the case where is odd. In a similar fashion as above, the last row in can be changed into by applying three elements rotation as many times as necessary. If we assume that (i.e., ), then, by Lemma 2, it is impossible to be . Thus, should be , which means that we have already had the desired result.