Algorithm For 8 Puzzle Problem In Python