Topic Link:
Http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=110&page=show_ problem&problem=1363
Type of topic: implicit graph Search
Original title:
There are black and white knights on a 5 by 5 chessboard. There are twelve of each color, and There are one square, is empty. At any time, a knight can move to an empty square as long as it moves like a knight in normal chess (what else did you E Xpect?).
Given an initial position of the board, the question Is:what are the minimum number of moves in which we can reach the fin Al position which is:
Input
The "I" of the input file contains an integer N (n<14) that indicates how many sets of inputs are. The description of each set is given below:
Each set consists of five lines; Each line represents one row of a chessboard. The positions occupied by White Knights are marked by 0 and the positions occupied from Black Knights are marked by 1. The space corresponds to the empty square on board.
There is no blank line between the two sets of input.
The ' the ' sample input below corresponds to this configuration:
Output
For each set your task are to find the minimum number of moves leading from the starting input configuration to the final O Ne. If is bigger than then output one line stating
Unsolvable in less than one move (s).
Otherwise output one line stating
Solvable in N-Move (s).
where n <= 10.
The output for each set was produced in a single line as shown in the sample output.
Sample Input
2
01011
110 1
01110
01010
00100
10110
01 11
10111
01001
00000
Sample Output
Unsolvable in less than one move (s).
Solvable in 7 move (s).