Algs4: 8puzzle: finished