astar implementation for 8 puzzle