I\'m interested making an implementation of the 14-15 puzzle:
Here's what I found already answered here:
"This problem basically boils down to doing a standard shuffle algorithm with a small twist.
The key observation is that for the 15-puzzle to be solvable the parity of the permutation and the parity of the blank square must be the same.
First create a random permutation using a standard algorithm for that purpose. For example the Knuth shuffle algorithm: Random Permutations
The advantage of using Knuth's shuffle ( or Fisher-Yates shuffle ) is that it involves swapping numbers, so you can easily keep track of the parity of the permutation. Each swap either keeps the parity ( if you swap 1 & 3 ), or changes the parity ( if you swap 1 & 2 ).
Place the blank square on the same parity as the parity of the permutation, and you are done. If the permutation has odd parity then place the blank an odd square (1,3,5,... chosen at random ). If the permutation has even parity then place the blank on an even square."
Also, "In practice, roughly every 4 consecutively generated permutations will consist of two even and two odd permutations, so even the per-iteration cost is negligible."
You can also check this site out: http://eusebeia.dyndns.org/epermute