This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.
GoalThe knight is a chess piece that, when placed on the o-marked square, can move to any of the x-marked squares (as long as they are inside the board):
Eight knights, numbered from
They can neither attack each other, nor share the same square, nor leave the board: the only valid moves are jumps to the empty square.
Compute the minimum number of valid moves required to reach the following ordered configuration by any sequence of valid moves:
Example detailed: Possible in 3 moves
128 12. 123 123
356 --> 356 --> .56 --> 456
7.4 784 784 78.
Three lines of three characters (containing each of the characters
1- 8 and . exactly once).
One single integer corresponding to the smallest number of moves needed to reach the ordered configuration.
-1 if it is not reachable.
128 356 7.4
A higher resolution is required to access the IDE