Solution to solve sliding puzzles.