This project uses A star algorithm to find the solution of famous 3x3 sliding puzzle
First of all a permutation of numbers from [0,8] is generated from Fisher Yates algorithm. It keeps generating new permutations untill a solvable permutations is found, then shuffled state is displayed.
An instance of solver class is generated which uses A star algorithm with manhattan distance as heuristic. A priority queue built with heap data structure gives the best possible solution at each step. At final state it backtract the path and put all those states in the stack. Then it iterates on the states changing only those nodes in the DOM which have been changed(only 2 at each step).
- 🔭 View this project here 8 Puzzle