Solver for 8 and 15 Puzzles