An Alternative Solution to n-Puzzle Problem

: The 3, 15 63 and n-1 puzzle problems are classical puzzle problem that has been celebrated for many years however, the conventional method for solving these problem is to use heuristic approach. Since the inception of these set of puzzle problems, researchers have made efforts to derive efficient methods of solving them. These methods require a lot of guessing that does not give a prescribed guideline to arrive at a possible solution. In this paper, an attempt was made to derive a procedure for solving n-1 puzzle problem, thereby, reducing guessing as much as possible. The derived procedure was tested on 3, 15 and 63, and the results got from the testing, were used to solven-1 puzzle problems.This paper has provided an alternative solution of how to solve n- puzzle problem, thereby reducing unnecessary guesses that were inherent in existing methods.

The n -puzzle problem consist of anm x m board with n numbered tiles and an empty space whereby, n = m 2 -1. A number on the tile next to an empty space can be slide to make way for other numbers attempting to arrange the puzzle. The objective of arranging these numbers is to reach a goal state, which completes the proper arrangements of the set of numbers on the puzzle board. The description of the problem solving an n -puzzleconsists of the following: set of states, initial state, goal state, path cost and successor function. Formally, P = (S, S0, F, f, C): Where, S = Set of states;S0 = Initial state;F = Final state. This can be one of the goal states already defined; f = Function called successor function generates the next state. This state can be described as a move from left to right, from up to down, etc; C = Path cost. It is the number of steps in the path of an arrangement, considering each move to be of unit cost.
This problem requires elicitation of transition rules and definite way of estimating the cost and making the heuristics. Each move in an n -puzzle problem generates a new configuration of arrangement in the puzzle board (Bhasin and Singla, 2012;Markov et al., 2006). For a period of twenty years, the 8-puzzle and 15-puzzle of Sam Loyd, have been a laboratory for testing search methods. The 15-puzzle has a long and interesting history that is said to date back to the 19 century and it continues to appear as apps on mobile devices and as mini-games inside larger video games.
It consists of 15 squares numbered from 1 to 15 that are placed in a 4x4 board leaving one empty space position,without a number. The goal is to reposition the numbers from a given arbitrary starting arrangement, by sliding each one of them at a time into the configuration, which completes the arrangement.Sometime, it may not be possible to arrive at a goal arrangement from an arbitrary starting position, because of the difficulty involved in guessing the right move that will move the arrangement towards a goal arrangement (Klimaszewski, 2014;Parberry, 2014;Ratner D;Warmuth, 1990;Horowitz and Sahni, 1978;Loy, 2005;Weisstein, 2016).
Since the time when 8, 15 and N puzzle problems were created, some researchers have made efforts to either find alternative solutions to these problems or recommends improvements to existing ones. Literature of existing research works are hereby review in this section. One of the open problems of a set of puzzle problems, is determine the average number of moves used in optimal length solutions to the 15-puzzle problem. Parberry (2014), in his paper, attempted to fine an alternative solution in arranging m 2 -1 numbers on the puzzle board. Experiments were conducted on 3, 15 63 and n-1 puzzle problems to understand the efficient way to arrange the numbers on the puzzle board. An algorithm was developed to formally describe the procedure of arranging m 2 -1 on the nxn puzzle board. Kuruvilla and Mujahid (2014) compares the performance of popular Artificial Intelligence (AI) techniques, namely the Breadth First Search, Depth First Search, A* Search, Greedy Best First Search and the Hill Climbing Search. The authors' research work looked at the complexity of each algorithm as it tries to approach the solution, in order to evaluate the operation of each technique and identify the better functioning one in various cases. The result of their research work shows that the A* search is best suited for solving the problem of this nature. Klimaszewski (2014) presented results of the experiment, in which data structures, used by the A* algorithm (i.e. priority queue and hash table), were tested. A* algorithm was used to solve 15-puzzle, where puzzle's state was kept in the 64-bit integer variable. Bhasin and Singla (2012) presented a Genetic Algorithm (GA) based technique to solve N -Puzzle problem. The algorithm has been analyzed and it is a belief that the presented algorithm has complexity better than most of the previous research works studied. Analysis on the complexity of the solution proposed in terms of time by taking the length of chromosome as power of 2, the calculations for complexity become simpler. The advantages of the method attributed to its simplicity and unknown constants of regression equation can be easily computed.

METHODOLOGY
The proposed method of solving n-1 puzzle problem is derived by attempting to solve 3, 15, 63 and n-1 puzzles. The observations noticed from solving3, 15 and 63 puzzles, will assist in deriving a procedures for solving n-1 puzzles.
Solution to 3-puzzle Problem: Given the following 3 puzzle problem shown in Table 1, it is observed that there is only one upward shift movement, to complete the arrange of the numbers in their goal position. The symbol ø is used to indicate empty space in the tiles. From the initial arrangement positions of the numbers, the goal arrangement is achieved by shifting the number 2 upward, to occupy the second column of the first row, in the 4 tiles configuration. The only movement made is the shifting of the number 2 upward, created an empty space in its former position. So, the first observation will now be: Given a 2x2 tiles, only one number (i.e., 2) is shifted upward one position and let's represent the shift as S. Then, S1=2 is define as only a shift upward in a 3-puzzle configuration.
Solution to 15 puzzle Problem: Given the following 15 puzzle problem shown in Table 2, it is observed that there is a 4x4 tiles of 15-puzzle arrangement. It is assumed that the gamer is initially presented with an arrangement of an arbitrary the 15-puzzle problem, which looks like the one shown in T1 of Table 2. Table  2 comprises of six different arrangements that is aimed at achieving the goal arrangements of the 15-puzzle problem. The arrangements are Labeled T1 to T6. The first arrangement to the puzzle starts from T1, were it is assumed that the gamer is presented with an arbitrary scattered 15 different numbers of the puzzle. In T2, There is an attempt to create a range leader (L1), whereby three other numbers are placed behind it. The number 12 was chosen because it will be used to lead other set of numbers horizontally, onto the last row. In T1, the set of numbers 12 is leading, are 15, 14 and 13 respectively. These set of numbers are queued up behind their leader 12 and their positions are labeled as P1, P2 and P3 respectively. Then, the first leader L1 (i.e., 12), leads the set of numbers 15, 14 and 13 onto the last row, which is seen in the configuration of T3. It was observed that L1is the results of subtracting 3 from 15 (that is the maximum number in the puzzle) and the values of the led set (15, 14, 13) is the same, when 0, 1, and 2 were subtracted from P1 P2, P3, respectively. In T3, L2 leads P1, P2, P3 into onto the last row of T3. The next leader L2 (8) is chosen to lead the set of numbers P1 (11), P2 (10) and P3 (9) onto the next row, after the last one. In other words, in T4, L2 leads P1 P2, P3 onto the next row, after the last. Same in T4, the leader L3was created by subtracting 11 from 15 and this number is leading P1 (7), P2 (6) and P3 (5) respectively. In T5, L3 leads P3 P4, P5 set of numbers to the second row and at the same time, it is rotating all the numbers in the first and second rows to their correct positions. And in T6, L3 (4) leads other leaders namely, L2 and L1to their correct positions, resulting in a complete arrangements of the 15 puzzle configuration. In the shifting arrangement S3=4, which indicates that the number 4 is the head leader and it will shift other 3 numbers, including itself.
Solution to 63 puzzle Problem: Given the following 63 puzzle problem shown in Table 3, the arrangement of the puzzle is achieved on an 8x8 tiles. To start the arrangement, it is assumed that the gamer may be presented with an initial arrangement of the 63-puzzle, shown in set of tiles displayed in T1. As similar to the earlier description of how to start the arrangement of 15 puzzle, a leader will be selected and will lead a set of numbers to occupy the last row of the 8x8 tiles, as shown in Figure 3.  Tables 5 and 6, an arbitrary leader Li can be derived whereby, i ranges from 4 to 7. This arbitrary number was derived after observing the current arrangement of numbers in Tables 3 and 4. In concluding the arrangements of the set of numbers on the 63 puzzle, the number 8 in T10, leads other set of leaders in an upward shifting to place the leaders in their respective correct positions. In the shifting arrangement S7=8, which indicates that the number 8 is the head leader and it will shift other 7 numbers, including itself. It is shown in Table 7. After shifting the set of leaders upward in one position, the arrangement of 63 puzzles is complete. In Table 6, after leaders L4, L5, L6, and L7 have finished leading their various set of numbers onto their respective rows, up to the second row, the configurations of how the numbers will appear on the 64 tiles are shown in T7 and T8.Interestingly, in T9 of Table 7, as the leader L7, is leading its set of numbers onto the second row, its automatically rotates a set of numbers around the first and second row, creating a semi-arranged configuration for the first two rows. The only number that has not been positioned on the first row is the number 8. The reason why the number 8 is not yet in its position is that, it is the head of the leaders to shift the other leaders vertically onto the last column of the board.    ?  33  34  35  36  37  38  39  32  41  42  43  44  45  46  47  40  41  42  43  44  45  46  47  40  49  50  51  52  53  54  55  48  49  50  51  52  53  54  55  48  57  58  59  60  61  62  63  56  57  58  59  60  61  62 63 56  ?  ?  ?  ?  ?  17  18  19  20  21  22  23  16  25  26  27  28  29  30  31  24  25  26  27  28  29  30  31  24  33  34  35  36  37  38  39  32  33  34  35  36  37  38  39  32  41  42  43  44  45  46  47  40  41  42  43  44  45  46  47  40  49  50  51  52  53  54  55  48  49  50  51  52  53  54  55  48  57  58  59  60  61  62  63  56  57  58  59  60  61  62 63 56

Solution to n-1 puzzle Problem:
Given the following n-1 puzzle problem shown in Table 8, it is observed that there are nxn tiles of n-1puzzleproblem. It is assumed that the gamer can be presented with any initial arrangement of the n-1puzzle.
The initial scattered arrangement was not shown in this arrangement because, it is assumed that the initial arbitrary arrangement of n-1 puzzle can be imagine by the gamer and it has been illustrated in previous examples of this puzzles. The attention of current example of the solution to n-1 puzzle problem, is rather on how the various leaders, lead the numbers to their positions on the tiles and the shifting procedure that completes the configuration.

RESULTS AND DISCUSSION
In Table 1, an alternative method for solving n-1 puzzle problem, whereby a leading number drags other set of numbers into their respective positions has been described. The proposed method was used to solve 3, 15, 63 and eventually n-1 puzzles problems. The first problem that was solved was the 3 puzzle problem. Although this problem is almost trivial because to achieve a goal arrangement, requires a gamer to rotate the set of numbers either clockwise or anticlockwise to place numbers in their respective positions. In this research, it was observed that there is an empty spot that is symbolized as ø and this symbol must be at the second row and second column of the 4 tiles board, to complete the goal arrangement. So, as a convention in this research work, ø is placed on the first row and last column in the initial arrangement and last row last column on the goal arrangement.