I am developing a simple game using Java swing. I want to know whether this particular game has a solution in the following scenario. If I am convinced that theoretically a solution cannot be arrived at this point, I will throw a notification to the user.
3×3
http://img814.imageshack.us/img814/7449/screenshot20100924at206.png
4×4
http://img39.imageshack.us/img39/1851/screenshot20100924at241.png
The objective of this game is to fill numbers from 1 to 8 (or 1 to 15) using the one space available to push the numbers to that empty space. Every time I end up with the combination shown above. I just want to convince myself that there is no way to attain the proper solution from the above scenario. Please help.
Yes, and no. If you generate the numbers randomly, I believe that there is a situation that could occur that causes the puzzle to be unsolvable. The way I’d suggest generating a puzzle is starting with the solved puzzle, and executing a number (increasing based on difficulty) of moves in reverse. That way you know that the end puzzle is solvable.